BerriAI/litellm · error · ValueError

embedding_model is required in litellm_params for Azure AI S

Error message

embedding_model is required in litellm_params for Azure AI Search. Example: litellm_params['embedding_model'] = 'azure/text-embedding-3-large'

What it means

Azure AI Search vector similarity search must embed the query before searching, so the config requires an embedding model. transform_search_vector_store_request reads litellm_params['litellm_embedding_model'] and raises when it is missing, with the expected format shown in the message.

Source

Thrown at litellm/llms/azure_ai/vector_stores/transformation.py:131

        vector_store_search_optional_params: VectorStoreSearchOptionalRequestParams,
        api_base: str,
        litellm_logging_obj: LiteLLMLoggingObj,
        litellm_params: dict,
        extra_body: dict[str, Any] | None = None,
    ) -> tuple[str, dict[str, Any]]:
        """
        Transform search request for Azure AI Search API

        Generates embeddings using litellm.embeddings and constructs Azure AI Search request
        """
        # Convert query to string if it's a list
        if isinstance(query, list):
            query = " ".join(query)

        # Get embedding model from litellm_params (required)
        embedding_model: Final = litellm_params.get("litellm_embedding_model")
        if not embedding_model:
            raise ValueError(
                "embedding_model is required in litellm_params for Azure AI Search. "
                "Example: litellm_params['embedding_model'] = 'azure/text-embedding-3-large'"
            )

        embedding_config: Final = litellm_params.get("litellm_embedding_config", {})
        if not embedding_config:
            raise ValueError(
                "embedding_config is required in litellm_params for Azure AI Search. "
                "Example: litellm_params['embedding_config'] = {'api_base': 'https://krris-mh44uf7y-eastus2.cognitiveservices.azure.com/', 'api_key': 'os.environ/AZURE_API_KEY', 'api_version': '2025-09-01'}"
            )

        # Get vector field name (defaults to contentVector)
        vector_field: Final = litellm_params.get("azure_search_vector_field", "contentVector")

        # Get top_k (number of results to return)
        top_k: Final = vector_store_search_optional_params.get("top_k", 10)

        # Generate embedding for the query using litellm.embeddings

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Add litellm_params['litellm_embedding_model'] = 'azure/text-embedding-3-large' (or any deployment you can embed with)
  2. Pair it with litellm_embedding_config containing that model's api_base/api_key/api_version
  3. Confirm the embedding model name is callable via litellm.embedding(model=..., input=['ping']) before wiring search

Example fix

# before
litellm_params={'api_key': k, 'azure_search_service_name': svc}

# after
litellm_params={'api_key': k, 'azure_search_service_name': svc, 'litellm_embedding_model': 'azure/text-embedding-3-large', 'litellm_embedding_config': {'api_base': emb_base, 'api_key': emb_key, 'api_version': '2025-09-01'}}
Defensive patterns

Strategy: validation

Validate before calling

if not litellm_params.get('litellm_embedding_model'):
    raise ValueError('azure_ai_search search requires litellm_params["litellm_embedding_model"]')

Prevention

When it happens

Trigger: Calling vector store search against an azure_ai_search store whose litellm_params lacks litellm_embedding_model — the create-time config skipped embedding setup even though search requires it.

Common situations: Copying a vector-store config example that omitted the embedding block; renaming the key to embedding_model instead of litellm_embedding_model; only using the store for document indexing and later adding search.

Related errors


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/73b08aff21235cc2. Report an issue: GitHub.