Azure / Azure/azure-sdk-for-python

azure-ai-inference : LangChain `AzureAIChatCompletionsModel` Does Not Support OpenAI-Style JSON Schema Format

オープン
#44,201 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
AI Model Inference customer-reported needs-team-attention question Service Attention
主要言語
Python
スター
5.6k
フォーク
3.4k
平均マージ
2日 2時間
マージ済み PR(30日)
213

説明

- 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.

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず構造化出力の例を再現し、サポートされていない response_format エラーが発生する azure/ai/inference/_patch.py を調べます。OpenAI-style の json_schema 形式がどのように検証されるかを追跡し、次に AzureAIChatCompletionsModel がその形式を受け入れ、構造化出力の呼び出しが ValueError なしで完了することを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
api
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。