scene_service.scene_graph.llm_client¶
Minimal async OpenAI-compatible LLM client for scene graph inference.
Reuses the same VLM_BASE_URL / VLM_API_KEY / VLM_MODEL / VLM_REASONING_EFFORT environment variables already used by the VLM fallback detector in perception_vlm.py.
Classes
|
Thin wrapper around an OpenAI-compatible chat-completions endpoint. |
- class scene_service.scene_graph.llm_client.SceneGraphLLMClient(*, base_url: str | None = None, api_key: str | None = None, model: str | None = None, timeout: float = 30.0, reasoning_effort: str | None = None)[source]¶
Bases:
objectThin wrapper around an OpenAI-compatible chat-completions endpoint.
All errors are caught internally — callers always get a dict back (empty dict on failure) so the scene graph loop never crashes due to LLM issues.
- property available: bool¶
- async chat_json(system_prompt: str, user_message: str, *, timeout: float | None = None, images: list[str] | None = None) dict[str, Any][source]¶
Send a chat-completions request expecting JSON output.
Returns the parsed JSON dict, or
{}on any failure. Never raises — all errors are logged and swallowed.imagesare base64-encoded JPEG strings (no data-url prefix). When present the user turn is sent as multimodal content ([{text}, {image_url}, ...]) so a vision model can see the frame; otherwise the user turn is the bareuser_messagestring. The image-url shape matches the VLM perception detector (perception_vlm._DETECTION_PROMPTrequest).