BerriAI/litellm · error · ValueError
embedding_config is required in litellm_params for Azure AI
Error message
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'} What it means
Alongside the embedding model, the search transform requires the connection settings for it. litellm_params.get('litellm_embedding_config', {}) returns an empty dict by default, and an empty dict is falsy, so both a missing key and an explicitly empty dict raise this error.
Source
Thrown at litellm/llms/azure_ai/vector_stores/transformation.py:138
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
try:
embedding_response: Final = litellm.embedding(
model=embedding_model,
input=[query],
**embedding_config,
)
query_vector: Final = embedding_response.data[0]["embedding"]View on GitHub (pinned to 6c2dcb801b)
Solutions
- Set litellm_params['litellm_embedding_config'] = {'api_base': 'https://<resource>.cognitiveservices.azure.com/', 'api_key': os.environ['AZURE_API_KEY'], 'api_version': '2025-09-01'}
- Note the key prefix: it is litellm_embedding_config, not embedding_config
- If the embedding deployment lives in the same resource as OCR/chat, reuse those credentials explicitly — they are not inherited
Example fix
# before
litellm_params={..., 'litellm_embedding_model': 'azure/text-embedding-3-large'} # no config
# after
litellm_params={..., 'litellm_embedding_model': 'azure/text-embedding-3-large', 'litellm_embedding_config': {'api_base': 'https://my-resource.cognitiveservices.azure.com/', 'api_key': os.environ['AZURE_API_KEY'], 'api_version': '2025-09-01'}} Defensive patterns
Strategy: validation
Validate before calling
emb_cfg = litellm_params.get('litellm_embedding_config')
if not emb_cfg or not isinstance(emb_cfg, dict):
raise ValueError('litellm_embedding_config must be a non-empty dict with api_base/api_key') Type guard
def is_valid_embedding_config(cfg) -> bool:
return isinstance(cfg, dict) and bool(cfg.get('api_base')) and bool(cfg.get('api_key')) Prevention
- Remember both a missing key and {} fail — always populate the dict
- Note the litellm_ prefix on both embedding keys
When it happens
Trigger: Configuring litellm_embedding_model but omitting litellm_embedding_config; or setting it to {} — both fail. The config must contain at minimum the api_base and api_key (and typically api_version) for the embedding deployment.
Common situations: Assuming the embedding call reuses the vector store's api_key; supplying the config under embedding_config without the litellm_ prefix; leaving a placeholder {} while migrating.
Related errors
- embedding_model is required in litellm_params for Azure AI S
- Azure AI Search service name is required. Provide it via lit
- api_base is None. Please set AZURE_AI_API_BASE or dynamicall
- api_key is None. Please set AZURE_AI_API_KEY or dynamically
- api_key is required
AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15).
Data as JSON: /api/errors/935f49b91fa75822.
Report an issue: GitHub.