{"record":{"id":"d47d2a70ae754602","repo":"microsoft/autogen","slug":"default-embedding-model-not-found-in-config-models","errorCode":null,"errorMessage":"default_embedding_model not found in config.models","messagePattern":"default_embedding_model not found in config\\.models","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py","lineNumber":211,"sourceCode":"\n        Args:\n            root_dir: Path to the GraphRAG root directory\n            config_filepath: Path to the GraphRAG settings file (optional)\n\n        Returns:\n            An initialized LocalSearchTool instance\n        \"\"\"\n        # Load GraphRAG config\n        config = load_config(root_dir=root_dir, config_filepath=config_filepath)\n\n        # Get the language model configurations from the models section\n        chat_model_config = config.models.get(defs.DEFAULT_CHAT_MODEL_ID)\n        embedding_model_config = config.models.get(defs.DEFAULT_EMBEDDING_MODEL_ID)\n\n        if chat_model_config is None:\n            raise ValueError(\"default_chat_model not found in config.models\")\n        if embedding_model_config is None:\n            raise ValueError(\"default_embedding_model not found in config.models\")\n\n        # Initialize token encoder based on the model being used\n        try:\n            token_encoder = tiktoken.encoding_for_model(chat_model_config.model)\n        except KeyError:\n            # Fallback to cl100k_base if model is not recognized by tiktoken\n            token_encoder = tiktoken.get_encoding(\"cl100k_base\")\n\n        # Create the models using ModelManager\n        model = ModelManager().get_or_create_chat_model(\n            name=\"local_search_model\",\n            model_type=chat_model_config.type,\n            config=chat_model_config,\n        )\n\n        embedder = ModelManager().get_or_create_embedding_model(\n            name=\"local_search_embedder\",\n            model_type=embedding_model_config.type,","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-ext/src/autogen_ext/tools/graphrag/_local_search.py#L193-L229","documentation":"GraphRAG LocalSearchTool.from_settings requires both 'default_chat_model' and 'default_embedding_model' in config.models. If the embedding model entry is missing, ValueError('default_embedding_model not found in config.models') is raised. Local search embeds the query and compares it against embedded entities/relationships, so an embedding model is mandatory, unlike global search.","triggerScenarios":"Calling LocalSearchTool.from_settings where settings.yaml has models.default_chat_model but no models.default_embedding_model key. Raised right after the chat-model check passes.","commonSituations":"Reusing a global-search-only settings file for local search; settings produced by a graphrag CLI that named the embedding entry differently; deleting the embedding entry to save cost and forgetting local search depends on it.","solutions":["Add models.default_embedding_model (e.g. type: openai_embedding, model: text-embedding-3-small, api_key) to settings.yaml.","Ensure the model name is one the embedding model factory supports for the declared type.","If you only need map-reduce style global search, use GlobalSearchTool instead, which does not require the embedding entry.","Regenerate settings.yaml with a matching graphrag version if the schema is old."],"exampleFix":"# settings.yaml — before\nmodels:\n  default_chat_model:\n    type: openai_chat\n    model: gpt-4o\n\n# settings.yaml — after\nmodels:\n  default_chat_model:\n    type: openai_chat\n    model: gpt-4o\n  default_embedding_model:\n    type: openai_embedding\n    model: text-embedding-3-small\n    api_key: ${GRAPHRAG_API_KEY}","handlingStrategy":"validation","validationCode":"cfg = load_config(root_dir=root_dir, config_filepath=config_filepath)\nrequired = {\"default_chat_model\", \"default_embedding_model\"}\nmissing = required - set(cfg.models or {})\nif missing:\n    raise ValueError(f\"settings.yaml missing models entries: {sorted(missing)}\")","typeGuard":null,"tryCatchPattern":"try:\n    tool = await LocalSearchTool.from_settings(root_dir=root_dir)\nexcept ValueError as e:\n    raise ConfigError(f\"GraphRAG config incomplete: {e}\") from e","preventionTips":["Treat models.default_embedding_model as mandatory for any vector-based search tooling.","Keep a minimal settings.yaml example in-repo and diff your config against it.","Automate settings validation in a preflight step before running indexing or query jobs."],"tags":["graphrag","config","embedding","settings","yaml"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}