Azure / Azure/azure-sdk-for-python
azure-ai-inference : LangChain `AzureAIChatCompletionsModel` Does Not Support OpenAI-Style JSON Schema Format
- Vorherrschende Sprache
- Python
- Sterne
- 5.6k
- Forks
- 3.4k
- Ø Merge
- 2 T.
- Gemergte PRs (30 T.)
- 217
Beschreibung
- Issue description
When using `langchain_azure_ai.AzureAIChatCompletionsModel` with structured output (e.g., create_agent(..., response_format=ProviderStrategy()...), the integration fails with:
`ValueError: Unsupported `response_format` {'type': 'json_schema', 'json_schema': {...}}`
This occurs in `azure/ai/inference/_patch.py`
- Steps to Reproduce
```
from langchain_azure_ai.chat_models import AzureAIChatCompletionsModel
from pydantic import BaseModel, Field
import os
llm = AzureAIChatCompletionsModel(
endpoint=os.getenv("GITHUB_INFERENCE_ENDPOINT"),
credential=os.getenv("GITHUB_TOKEN"),
model="gpt-4o",
)
class ContactInfo(BaseModel):
name: str = Field(description="The name of the person")
email: str = Field(description="The email of the person")
phone: str = Field(description="The phone number of the person")
agent = create_agent(
model = gllm_4_1,
tools = [search_tool],
response_format=ProviderStrategy(ContactInfo)
)
agent.invoke({"messages": [HumanMessage(content="Extract contact info from: John Doe, john@example.com, (555) 123-4567")]})
```
- Alternatives considered
Use `langchain-openai` instead, which treats Azure-compatible endpoints as OpenAI endpoints.
Beitragsleitfaden
Rechercherichtung
Beginne damit, das Beispiel für strukturierte Ausgaben zu reproduzieren, und untersuche azure/ai/inference/_patch.py, wo der Fehler „unsupported response_format“ auftritt. Verfolge, wie das OpenAI-style json_schema-Format validiert wird, und überprüfe anschließend, dass AzureAIChatCompletionsModel das Format akzeptiert und der Aufruf für strukturierte Ausgaben ohne den ValueError abgeschlossen wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- api
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100