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 environment variables already used by the VLM fallback detector in perception_vlm.py.

Classes

SceneGraphLLMClient(*[, base_url, api_key, ...])

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)[source]

Bases: object

Thin 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) 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.