Skip to main content

Azure AI Foundry provider for lmux

Project description

lmux-azure-foundry

Azure AI Foundry provider for lmux. Uses the openai SDK's AzureOpenAI client.

Supports chat completions, streaming, and embeddings.

Part of the lmux ecosystem: standardized interface, cost tracking on every response, and registry-based routing across providers.

Optional Extras

  • lmux-azure-foundry[identity]: Azure AD token authentication via azure-identity

Auth

Three authentication methods:

API Key (default)

Set AZURE_FOUNDRY_API_KEY in your environment:

from lmux_azure_foundry import AzureFoundryProvider

provider = AzureFoundryProvider(endpoint="https://your-resource.openai.azure.com")

Azure AD Token

from lmux_azure_foundry import AzureFoundryProvider, AzureAdToken

provider = AzureFoundryProvider(
    endpoint="https://your-resource.openai.azure.com",
    auth=my_auth_returning_azure_ad_token,
)

Token Provider

from lmux_azure_foundry import AzureFoundryTokenAuthProvider

provider = AzureFoundryProvider(
    endpoint="https://your-resource.openai.azure.com",
    auth=AzureFoundryTokenAuthProvider(),  # uses azure-identity DefaultAzureCredential
)

Usage

Chat

from lmux import UserMessage

response = provider.chat("gpt-4o", [UserMessage(content="Hello")])
print(response.content)
print(response.cost)

Streaming

for chunk in provider.chat_stream("gpt-4o", [UserMessage(content="Hello")]):
    if chunk.delta:
        print(chunk.delta, end="")

Embeddings

response = provider.embed("text-embedding-3-small", "Hello")
print(response.embeddings)

Async

All methods have async variants: achat, achat_stream, aembed.

Registry

Use with the lmux registry to route across multiple providers:

from lmux import Registry

registry = Registry()
registry.register("azure", provider)
response = registry.chat("azure/gpt-4o", messages)

Provider Params

from lmux_azure_foundry import AzureFoundryParams

response = provider.chat(
    "gpt-4o",
    messages,
    provider_params=AzureFoundryParams(deployment_type="data_zone"),
)
Parameter Type Description
reasoning_effort "low" | "medium" | "high" Reasoning effort for o-series models
seed int Deterministic sampling seed
user str End-user identifier
deployment_type "global" | "data_zone" | "regional" Affects cost calculation only, not sent to API

Constructor Options

AzureFoundryProvider(
    endpoint=...,      # required, Azure resource endpoint
    auth=...,          # AuthProvider, default: AzureFoundryKeyAuthProvider()
    api_version=...,   # API version (default: "2024-12-01-preview")
    timeout=...,       # Request timeout in seconds
    max_retries=...,   # Max retry attempts
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lmux_azure_foundry-0.4.3.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lmux_azure_foundry-0.4.3-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file lmux_azure_foundry-0.4.3.tar.gz.

File metadata

  • Download URL: lmux_azure_foundry-0.4.3.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lmux_azure_foundry-0.4.3.tar.gz
Algorithm Hash digest
SHA256 4e3dc630f031955b5183a782f7f29b63f5bcefadbb4ac6b472153ea208087668
MD5 d6d546c81e89579ce20fb6257f9c0ee1
BLAKE2b-256 3f2e7a0c8710e2d6755b4d77f10dae9f60a4e153929f0a1109d44ba49abbd153

See more details on using hashes here.

Provenance

The following attestation bundles were made for lmux_azure_foundry-0.4.3.tar.gz:

Publisher: publish.yml on cluebbehusen/lmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lmux_azure_foundry-0.4.3-py3-none-any.whl.

File metadata

File hashes

Hashes for lmux_azure_foundry-0.4.3-py3-none-any.whl
Algorithm Hash digest
SHA256 96db4285a63cf84c480ee53a25cb9d9324ab9b2b67b8436734f3ed0c1fdb6bc2
MD5 8342e4f5d75637775de7065b06fa9b18
BLAKE2b-256 adcf8f560247f70aaa238d3132ca9be74a30e9ca7098d407dbfcf777f08f657d

See more details on using hashes here.

Provenance

The following attestation bundles were made for lmux_azure_foundry-0.4.3-py3-none-any.whl:

Publisher: publish.yml on cluebbehusen/lmux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page