{"record":{"id":"cd6526307c6cfc99","repo":"zylon-ai/private-gpt","slug":"openai-like-llm-dependencies-are-not-installed-in","errorCode":null,"errorMessage":"OpenAI-like LLM dependencies are not installed. Install with `uv sync --inexact --extra llm-openai-compatible`.","messagePattern":"OpenAI-like LLM dependencies are not installed\\. Install with `uv sync --inexact --extra llm-openai-compatible`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"private_gpt/components/llm/factories/completions/openailike.py","lineNumber":18,"sourceCode":"from typing import Any\n\nfrom llama_index.core.llms import LLM\n\nfrom private_gpt.components.llm.factories.base import LLMFactory\nfrom private_gpt.components.llm.prompt_helper import get_prompt_style\nfrom private_gpt.components.llm.tokenizers.tokenizer_base import TokenizerBase\nfrom private_gpt.settings.settings import LLMModelConfig, Settings\nfrom private_gpt.utils.dependencies import format_missing_dependency_message\n\n\ndef _load_patched_openai_like() -> type[Any]:\n    try:\n        from private_gpt.components.llm.custom.openailike import PatchedOpenAILikeLLM\n\n        return PatchedOpenAILikeLLM\n    except ImportError as e:\n        raise ImportError(\n            format_missing_dependency_message(\n                \"OpenAI-like LLM\",\n                extras=\"llm-openai-compatible\",\n            )\n        ) from e\n\n\nclass OpenAILikeCompletionsFactory(LLMFactory):\n    \"\"\"Chat Completions factory for OpenAI-compatible endpoints (vLLM, Ollama, etc.).\"\"\"\n\n    def __init__(self, settings: Settings):\n        super().__init__(settings)\n        self.openai_settings = settings.openai\n\n    def _create_llm(\n        self, model_config: LLMModelConfig, tokenizer: TokenizerBase | None = None\n    ) -> tuple[LLM, str | None]:\n        PatchedOpenAILikeLLM = _load_patched_openai_like()","sourceCodeStart":1,"sourceCodeEnd":36,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/components/llm/factories/completions/openailike.py#L1-L36","documentation":"ImportError raised by the lazy loader in the OpenAI-like completions factory: importing PatchedOpenAILikeLLM failed because the optional 'llm-openai-compatible' extra is not installed. This factory serves OpenAI-compatible endpoints such as vLLM and Ollama, which need the llama-index openai-like integration packages.","triggerScenarios":"Setting the LLM mode to an OpenAI-compatible backend (vLLM, Ollama, LM Studio, etc.) without the llm-openai-compatible extra installed.","commonSituations":"Self-hosted deployments pointing at a local vLLM/Ollama server on a machine where only core dependencies were synced; slim Docker images; switching from hosted OpenAI to local inference without adding the extra.","solutions":["Run `uv sync --inexact --extra llm-openai-compatible`.","Otherwise install the packages listed under the llm-openai-compatible extra in pyproject.toml.","Rebuild deployment images with the extra included."],"exampleFix":"# before\nuv sync\n\n# after\nuv sync --inexact --extra llm-openai-compatible","handlingStrategy":"validation","validationCode":"def openai_compatible_extra_available() -> bool:\n    try:\n        from llama_index.llms.openai_like import OpenAILike  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    factory = registry.get_factory(\"openai-like\")\nexcept ImportError as e:\n    if 'llm-openai-compatible' in str(e):\n        raise SystemExit('Install extras: uv sync --inexact --extra llm-openai-compatible') from e\n    raise","preventionTips":["Map every LLM mode you configure to its required extra in a setup checklist.","Use a lockfile-based sync with all needed extras in Docker builds.","Smoke-test the configured mode in a healthcheck endpoint after deploy."],"tags":["dependencies","openai-compatible","vllm","ollama","import-error"],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}