Skip to main content
Microsoft Foundry provides two LangChain decision model adapters in langchain-azure-ai>=1.4.1 that implement LangChain’s shared BaseDecisionModel interface (Runnable[ClassifierRequest, ClassifierResponse]): Both adapters answer named Noul, Choice, and Score questions from langchain_core.decisions (also re-exported from langchain_azure_ai.decisions) and return structured answers on nouls, choices, scores, and answers. Neither adapter supports Box questions.
AzureAIOpenAIApiDecisionsClassifier extends the beta OpenAIClassifier from langchain-openai>=1.8.0 and emits ExperimentalWarning on construction.

Setup

Install langchain-azure-ai 1.4.1 or later:
Set AZURE_AI_PROJECT_ENDPOINT (or FOUNDRY_PROJECT_ENDPOINT) to your Microsoft Foundry project URL and authenticate with Microsoft Entra ID (az login for local development). Pass your Foundry deployment name, not the underlying model name, as model.

Quickstart

Adapter differences

Microsoft Decision

AzureAIMicrosoftDecisionsClassifier calls compatible Microsoft Decision deployments through /providers/microsoft/v1/systemone.
  • Inputs: Accepts text strings, JSON objects, and JSON arrays. It does not convert LangChain messages or send image assets.
  • Endpoints: Accepts project_endpoint (defaults to AZURE_AI_PROJECT_ENDPOINT, then FOUNDRY_PROJECT_ENDPOINT) or a direct Foundry resource URL via endpoint.
  • Authentication: Defaults to DefaultAzureCredential(). Pass an API key string or AzureKeyCredential as credential for key-based authentication. Async-only credentials require ainvoke or abatch.

Azure OpenAI Decisions

AzureAIOpenAIApiDecisionsClassifier extends OpenAIClassifier and calls /openai/v1/decisions.
  • Inputs: Accepts strings, JSON objects and arrays, and root LangChain messages (including supported images). Media nested inside JSON state is dropped with a warning. If the API refuses any question, ModelRefusalError is raised for the entire request.
  • Endpoints: Accepts project_endpoint (derives <resource>/openai/v1) or a direct resource endpoint ending in /openai/v1 (falls back to AZURE_AI_OPENAI_ENDPOINT, then AZURE_OPENAI_ENDPOINT with /openai/v1 appended).
  • Authentication: project_endpoint requires a Microsoft Entra token credential and defaults to DefaultAzureCredential(). For API key authentication, pass a direct resource endpoint ending in /openai/v1 with credential (or set AZURE_OPENAI_API_KEY).
  • Compatibility alias: AzureAIOpenAIApiDecisions remains available as an alias for AzureAIOpenAIApiDecisionsClassifier.

See also