Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.upsonic.ai/llms.txt

Use this file to discover all available pages before exploring further.

Overview

Azure OpenAI provides managed access to OpenAI embedding models through Azure infrastructure. Supports both API key and Managed Identity authentication with enterprise-grade security and compliance features. Provider Class: AzureOpenAIEmbedding Config Class: AzureOpenAIEmbeddingConfig

Dependencies

uv pip install openai
For Managed Identity support:
uv pip install azure-identity

Examples

from upsonic import Agent, Task, KnowledgeBase
from upsonic.embeddings import AzureOpenAIEmbedding, AzureOpenAIEmbeddingConfig
from upsonic.vectordb import ChromaProvider, ChromaConfig, ConnectionConfig, Mode

# Create embedding provider with API key
embedding = AzureOpenAIEmbedding(AzureOpenAIEmbeddingConfig(
    azure_endpoint="https://your-resource.openai.azure.com/",
    deployment_name="text-embedding-ada-002",
    model_name="text-embedding-ada-002"
))

# Setup KnowledgeBase
vectordb = ChromaProvider(ChromaConfig(
    collection_name="azure_docs",
    vector_size=1536,
    connection=ConnectionConfig(mode=Mode.IN_MEMORY)
))

kb = KnowledgeBase(
    sources=["document.txt"],
    embedding_provider=embedding,
    vectordb=vectordb
)

# Query with Agent
agent = Agent("anthropic/claude-sonnet-4-5")
task = Task("What is this document about?", context=[kb])
result = agent.do(task)
print(result)

Parameters

ParameterTypeDescriptionDefaultSource
azure_endpointstr | NoneAzure OpenAI endpoint URLNoneSpecific
api_keystr | NoneAzure OpenAI API key (uses AZURE_OPENAI_API_KEY env var if None)NoneSpecific
deployment_namestr | NoneAzure deployment nameNoneSpecific
api_versionstrAzure OpenAI API version"2024-02-01"Specific
use_managed_identityboolUse Azure Managed IdentityFalseSpecific
tenant_idstr | NoneAzure tenant IDNoneSpecific
client_idstr | NoneAzure client ID for managed identityNoneSpecific
model_namestrEmbedding model name"text-embedding-ada-002"Specific
enable_content_filteringboolEnable Azure content filteringTrueSpecific
data_residency_regionstr | NoneData residency regionNoneSpecific
parallel_requestsintParallel requests (Azure has lower limits)3Specific
requests_per_minuteintRequests per minute for Azure240Specific
tokens_per_minuteintTokens per minute for Azure240000Specific
batch_sizeintBatch size for document embedding100Base
max_retriesintMaximum number of retries on failure3Base
normalize_embeddingsboolWhether to normalize embeddings to unit lengthTrueBase