UXDL Docs

Embedding Models

OpenAI/Azure chat and embedding model selection and rules.

LLM providers for chat/completion and embedding models for semantic search.

Chat and completion models

Model selection belongs in agent config or the graph repo, not in controllers.

ProviderConfigTypical use
OpenAIOPENAI_API_KEYIn-process agents, one-shot generation
Azure OpenAIUSE_AZURE_OPENAI=true plus endpoint/deployment varsProduction where Azure is standard
LangGraph hostConfigured on the graph deploymentNodes inside hosted graphs

For agent patterns, see Agents & pipelines and Integration flow.

Embeddings

Support both OpenAI and Azure via a shared utility pattern:

  • USE_AZURE_OPENAI=false: OpenAI text-embedding-3-small
  • USE_AZURE_OPENAI=true: Azure deployment from AZURE_EMBEDDINGS_* vars

When to embed:

  • Search and discovery (embed user query or document text)
  • Personalization (embed user preferences for vector similarity)
  • Deduplication or clustering (optional)

Implementation rules:

  • Store vectors on the document or request row.
  • Document embedding text construction (which fields are concatenated) so indexes stay consistent.
  • Fall back to non-vector sort (e.g. created_at) when embedding generation fails.

Next step: Vector search.

Environment variables

VariablePurpose
OPENAI_API_KEYEmbeddings via OpenAI
USE_AZURE_OPENAISwitch to Azure
AZURE_EMBEDDINGS_*Azure embedding deployment

Full list: Environment variables.

See also

Official documentation