zylon-ai/private-gpt · error · ImportError
OpenAI Responses LLM dependencies are not installed. Install
Error message
OpenAI Responses LLM dependencies are not installed. Install with `uv sync --inexact --extra llm-openai`.
What it means
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.
Source
Thrown at private_gpt/components/llm/custom/openairesponses.py:39
OpenAIResponses as OpenAIResponsesBase,
)
from openai.types.responses import ( # ty:ignore[unresolved-import]
ResponseFunctionToolCall,
)
logger = logging.getLogger(__name__)
def _load_openai_responses_base() -> type[Any]:
try:
return cast(
type[Any],
importlib.import_module("llama_index.llms.openai").OpenAIResponses,
)
except (ImportError, AttributeError) as e:
from private_gpt.utils.dependencies import format_missing_dependency_message
raise ImportError(
format_missing_dependency_message(
"OpenAI Responses LLM",
extras="llm-openai",
)
) from e
if not TYPE_CHECKING:
OpenAIResponsesBase = _load_openai_responses_base()
_RESPONSES_REASONING_EFFORT_MAP = {
ReasoningEffort.LOW: "low",
ReasoningEffort.MEDIUM: "medium",
ReasoningEffort.HIGH: "high",
ReasoningEffort.MAX: "high",
}
View on GitHub (pinned to 4a030776a3)
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.
Example fix
# before uv sync --inexact # after uv sync --inexact --extra llm-openai
Defensive patterns
Strategy: try-catch
Validate before calling
def openai_responses_available() -> bool:
try:
import llama_index.llms.openai # noqa: F401
return hasattr(llama_index.llms.openai, 'OpenAIResponses')
except ImportError:
return False Try / catch
try:
from private_gpt.components.llm.custom.openairesponses import PatchedOpenAIResponsesLLM
except ImportError as e:
if 'llm-openai' in str(e):
raise RuntimeError('run: uv sync --inexact --extra llm-openai') from e Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- OpenAI-like Responses LLM dependencies are not installed. In
- OpenAI embeddings dependencies are not installed. Install wi
- OpenAI LLM dependencies are not installed. Install with `uv
- Harmony parser dependencies are not installed. Install with
- Redis cache dependencies are not installed. Install with `uv
AI-assisted analysis of zylon-ai/private-gpt@4a030776a3 (2026-08-15).
Data as JSON: /api/errors/c9269ef8c2cf6f00.
Report an issue: GitHub.