{"record":{"id":"c9269ef8c2cf6f00","repo":"zylon-ai/private-gpt","slug":"openai-responses-llm-dependencies-are-not-installe","errorCode":null,"errorMessage":"OpenAI Responses LLM dependencies are not installed. Install with `uv sync --inexact --extra llm-openai`.","messagePattern":"OpenAI Responses LLM dependencies are not installed\\. Install with `uv sync --inexact --extra llm-openai`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/llm/custom/openairesponses.py","lineNumber":39,"sourceCode":"        OpenAIResponses as OpenAIResponsesBase,\n    )\n    from openai.types.responses import (  # ty:ignore[unresolved-import]\n        ResponseFunctionToolCall,\n    )\n\nlogger = logging.getLogger(__name__)\n\n\ndef _load_openai_responses_base() -> type[Any]:\n    try:\n        return cast(\n            type[Any],\n            importlib.import_module(\"llama_index.llms.openai\").OpenAIResponses,\n        )\n    except (ImportError, AttributeError) as e:\n        from private_gpt.utils.dependencies import format_missing_dependency_message\n\n        raise ImportError(\n            format_missing_dependency_message(\n                \"OpenAI Responses LLM\",\n                extras=\"llm-openai\",\n            )\n        ) from e\n\n\nif not TYPE_CHECKING:\n    OpenAIResponsesBase = _load_openai_responses_base()\n\n_RESPONSES_REASONING_EFFORT_MAP = {\n    ReasoningEffort.LOW: \"low\",\n    ReasoningEffort.MEDIUM: \"medium\",\n    ReasoningEffort.HIGH: \"high\",\n    ReasoningEffort.MAX: \"high\",\n}\n\n","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/llm/custom/openairesponses.py#L21-L57","documentation":"ImportError raised by _load_openai_responses_base when llama_index.llms.openai cannot be imported or has no OpenAIResponses attribute. It fires at module import time (the base class is loaded immediately when TYPE_CHECKING is off), so merely importing the module with the dependency missing crashes. The message names the required extra: llm-openai.","triggerScenarios":"Installing or running the app without the llm-openai extra while any code path imports private_gpt.components.llm.custom.openairesponses — commonly when the configured LLM profile uses OpenAI Responses.","commonSituations":"Slim installs for local/Ollama-only deployments that still import the module; CI linting importing all modules; llama-index version where OpenAIResponses was renamed/removed (AttributeError branch).","solutions":["Run: uv sync --inexact --extra llm-openai.","Confirm the class exists in your installed version; if not, align llama-index version with the project's lockfile.","If you do not use OpenAI Responses, ensure the module is not imported (check profile wiring / lazy import guards).","Rebuild containers so the new dependency is baked in."],"exampleFix":"# before\nuv sync --inexact\n\n# after\nuv sync --inexact --extra llm-openai","handlingStrategy":"try-catch","validationCode":"def openai_responses_available() -> bool:\n    try:\n        import llama_index.llms.openai  # noqa: F401\n        return hasattr(llama_index.llms.openai, 'OpenAIResponses')\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    from private_gpt.components.llm.custom.openairesponses import PatchedOpenAIResponsesLLM\nexcept ImportError as e:\n    if 'llm-openai' in str(e):\n        raise RuntimeError('run: uv sync --inexact --extra llm-openai') from e","preventionTips":["Because this loads at import time, a missing extra crashes any importer — keep module imports lazy behind profile selection.","Pin llama-index to the lockfile version; the AttributeError branch indicates a version mismatch."],"tags":["llm","openai","dependencies","installation"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}