azure-openai-to-responses
Skill76k starsChanged 5 months agoMITView on GitHub
权威指南 — 请严格遵循 该技能将使用 Azure OpenAI 聊天补全的 Python 代码库 迁移到统一的 Responses API。请严格遵循这些说明。 不要即兴映射参数或发明 API 形态。 当用户希望时启用此技能: - 将 Python 应用从 Azure OpenAI 聊天补全迁移到 Responses API - 升级 Python OpenAI SDK 的用法至针对 Azure OpenAI 的最新 API 形态 - 为需要 Azure 上 Responses 的 GPT-5 或更新模型准备 Python 代码 - 从 AzureOpenAI/AsyncAzureOpenAI 切换到带 v1 端点的标准 OpenAI/AsyncOpenAI 客户端 - 修复与 AzureOpenAI 构造函数或 api_version 相关的弃用警告 迁移前,请验证您的 Azure OpenAI 部署支持 Responses API。 <strong>注意</strong>:在 Azure OpenAI 上,max_output_tokens 最小为 16。低于 16 会返回 400 错误。用于快速测试时请使用 50 以上。 如果返回 404,该部署的模型尚不支持…
- Reads credentials
- Commits and pushes
2 other projects use a version of this, 1 of them edited.
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Most recently taken up by
- microsoft/generative-ai-for-beginnerstheir own version, first seen Jul 14, 2026
- Azure-Samples/azure-openai-to-responsesedited, first seen Apr 6, 2026
Who's talking about microsoft/ai-agents-for-beginners
- @rodtrent.com“AI Agents for Beginners - 10 Lessons teaching everything you need to know to start building AI Agents …”Bluesky · Feb 14, 2025 · 25 likes
- A Hacker News story“Lessons to Get Started Building AI Agents”Hacker News · Jul 4, 2025 · 10 points
- @rdenadai.dev“Pô, parece legal a grade hein... Deixar na lista aqui pra estudar depois da certificação da AWS.”Bluesky · Sep 7, 2025 · 7 likes
- @alvinashcraft.com“AI Agents for Beginners - 10 Lessons to Get Started Building AI Agents. …”Bluesky · Feb 22, 2025 · 7 likes
- @ottorinobruni.bsky.social“🚨 Want to learn AI Agents from scratch? Microsoft’s free 18-lesson course covers frameworks, tools, RAG, …”Bluesky · Nov 20, 2026 · 4 likes
The biggest 5 of 88 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 88
Talked about on GitHub, Bluesky and Hacker News (88 times).
On GitHub · 50
- Oct 14, 2026"Lesson" is not being translated. (en→ja) — Azure/co-op-translator1 reaction
- Jul 25, 2026Previous and Next lessons have not been translated. (en→jp) — Azure/co-op-translator1 reaction · 1 comment
- Jul 4, 2026Translated the markdown header ## Summary to ## まとめ (en→jp) — Azure/co-op-translator1 reaction · 1 comment
- Mar 31, 2026"Join the [Microsoft Foundry Discord]~" has not been translated. (en→ja) — Azure/co-op-translator1 reaction · 3 comments
- Mar 17, 2026The headline has not been translated (en→ja) — Azure/co-op-translator1 reaction · 2 comments
45 more on GitHub
- Mar 15, 2026Code block before and after it has not been translated. (en→ja) — Azure/co-op-translatorsays it tested it1 reaction · 3 comments
- Nov 18, 2025README Structure — notoriousmic/github-copilot-workshop1 reaction
- Oct 2, 2025[KO] Translation improvement for "{days}" usage — Azure/co-op-translator1 reaction · 1 comment
- Oct 2, 2025[KO] Translation improvement for "{days}" usage — Azure/co-op-translator1 reaction
- Sep 15, 2025HTML tags (e.g., <a>) are stripped or lost during translation — Azure/co-op-translator1 reaction · 2 comments
- Sep 7, 2025``` not handled correctly (en→ja) — Azure/co-op-translator1 reaction · 3 comments
- May 7, 2025Correcting all misc errors found across code samples for Lessons 04, 06, 09. — jabari-max/Mohammadhadi-Jabari1 reaction
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T010: retrieval with source attribution — scenario assessment [05-agentic-rag] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T009: confidence-gated escalation — evaluation experiment [09-metacognition] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T008: allowlisted action policy — failure and recovery example [06-building-trustworthy-agents] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T007: dependency-plan validation — worked example with checks [07-planning-design] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T006: dependency-plan validation — refactor the teaching example [08-multi-agent] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T005: bounded agent loop — offline service adapter [01-intro-to-ai-agents] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T004: trace aggregation — invariant and state trace [10-ai-agents-production] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T003: agent-component routing — compare two approaches [03-agentic-design-patterns] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T002: retrieval with source attribution — boundary-case lesson extension [05-agentic-rag] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Jayesh Aher (261105B306021) — R17-T001: bounded agent loop — runnable concept example [01-intro-to-ai-agents] — S-AI-Final-Projects-SMRU/ai-agents-for-beginners0 reactions
- Nov 28, 2026Yatharth Ujwal (2601010406) — R17-T030: model-manifest selection — scenario assessment [17-creating-local-ai-agents] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Yatharth Ujwal (2601010406) — R17-T029: trace aggregation — evaluation experiment [16-deploying-scalable-agents] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Yatharth Ujwal (2601010406) — R17-T028: bounded agent loop — failure and recovery example [14-microsoft-agent-framework] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Yatharth Ujwal (2601010406) — R17-T033: retrieval with source attribution — invariant and state trace [05-agentic-rag] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Yatharth Ujwal (2601010406) — R17-T032: bounded agent loop — compare two approaches [14-microsoft-agent-framework] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Tanmay (2601010364) — R17-T038: prompt-template escaping — failure and recovery example [12-context-engineering] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Tanmay (2601010364) — R17-T037: typed tool dispatch — worked example with checks [04-tool-use] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Tanmay (2601010364) — R17-T036: bounded conversation memory — evaluation experiment [13-agent-memory] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Tanmay (2601010364) — R17-T035: bounded conversation memory — refactor the teaching example [11-agentic-protocols] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Tanmay (2601010364) — R17-T034: retrieval with source attribution — offline service adapter [05-agentic-rag] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Rudransh (2601010295) — R17-T040: confidence-gated escalation — scenario assessment [09-metacognition] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Rudransh (2601010295) — R17-T039: bounded conversation memory — boundary-case lesson extension [13-agent-memory] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Rudransh (2601010295) — R17-T044: bounded conversation memory — invariant and state trace [11-agentic-protocols] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Rudransh (2601010295) — R17-T043: agent-component routing — offline service adapter [03-agentic-design-patterns] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Rudransh (2601010295) — R17-T042: dependency-plan validation — compare two approaches [08-multi-agent] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Himanshi Gupta (2601010156) — R17-T049: tamper-evident action receipt — scenario assessment [18-securing-ai-agents] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Himanshi Gupta (2601010156) — R17-T048: prompt-template escaping — evaluation experiment [12-context-engineering] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Himanshi Gupta (2601010156) — R17-T047: agent-component routing — failure and recovery example [02-explore-agentic-frameworks] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Himanshi Gupta (2601010156) — R17-T046: trace aggregation — worked example with checks [10-ai-agents-production] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Hasrat Marwaha (2601010152) — R17-T050: confidence-gated escalation — runnable concept example [09-metacognition] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Hasrat Marwaha (2601010152) — R17-T055: confidence-gated escalation — offline service adapter [09-metacognition] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Hasrat Marwaha (2601010152) — R17-T052: agent-component routing — compare two approaches [02-explore-agentic-frameworks] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Avi Garg (2601010083) — R17-T057: dependency-plan validation — worked example with checks [08-multi-agent] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 28, 2026Avi Garg (2601010083) — R17-T056: agent-component routing — refactor the teaching example [03-agentic-design-patterns] — s-and-ai-ru-4/ai-agents-for-beginners0 reactions
- Nov 16, 2026agent-skills.github.microsoft.ai-agents-for-beginners: 0-unstable-2026-09-10 → 0-unstable-2026-11-07 — sudosubin/agents.nix0 reactions
- Oct 14, 2026agent-skills.github.microsoft.ai-agents-for-beginners: 0-unstable-2026-07-13 → 0-unstable-2026-09-10 — sudosubin/agents.nix0 reactions
- Sep 30, 2026agent-skills.github.microsoft.ai-agents-for-beginners: init at 0-unstable-2026-07-13 — sudosubin/agents.nix0 reactions
- Sep 6, 2026Batch 78: Claude usage-limit tips, n8n grounding technique, coding-agent CLIs, OSS-to-service ideas — dmavridi6478/business0 reactions
On Bluesky · 35
- Feb 14, 2025AI Agents for Beginners - 10 Lessons teaching everything you need to know to start building AI Agents github.com/microsoft/ai...… — @rodtrent.com25 likes and reposts · 1 reply
- Sep 7, 2025Pô, parece legal a grade hein... Deixar na lista aqui pra estudar depois da certificação da AWS. — @rdenadai.dev7 likes and reposts
- Feb 22, 2025AI Agents for Beginners - 10 Lessons to Get Started Building AI Agents. https://github.com/microsoft/ai-agents-for-beginners #ai #aiagents… — @alvinashcraft.com7 likes and reposts
- Nov 20, 2026🚨 Want to learn AI Agents from scratch? Microsoft’s free 18-lesson course covers frameworks, tools, RAG, multi-agents, production & more… — @ottorinobruni.bsky.social4 likes and reposts
- Apr 4, 202510 Lessons teaching everything you need to know to start building AI Agents github.com/microsoft/ai... — @asiermarques.com3 likes and reposts
30 more on Bluesky
- Mar 23, 2025📦 microsoft / ai-agents-for-beginners ⭐ 5,023 (+55) 🗒 Jupyter Notebook 10 Lessons to Get Started Building AI Agents — @github-trending.bsky.social3 likes and reposts
- Oct 20, 2026Stage 3: Agent fundamentals AI Agents for Beginners, Microsoft (18 lessons, 77k+ stars) github.com/microsoft/a... Hugging Face AI Agents… — @astrodevil1.bsky.social2 likes and reposts · 1 reply
- May 18, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / ai-agents-for-beginners ⭐ 62,102 (+180) 🗒 Jupyter Notebook 12 Lessons to Get Started… — @github-trending.bsky.social2 likes and reposts
- Dec 17, 2025Microsoft AI agents for beginners resource 👀 #fyp #typescript #agent #coding #llm #viral #viralvideo github.com/microsoft/ai... — @krystalmess.bsky.social2 likes and reposts
- Nov 12, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / ai-agents-for-beginners ⭐ 44,431 (+193) 🗒 Jupyter Notebook 12 Lessons to Get Started… — @github-trending.bsky.social2 likes and reposts
- Sep 7, 2025AI Agents for Beginners 11 Lessons to Get Started Building AI Agents. https://github.com/microsoft/ai-agents-for-beginners — @pythonhub.dev2 likes and reposts
- Jun 16, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / ai-agents-for-beginners ⭐ 27,064 (+437) 🗒 Jupyter Notebook 11 Lessons to Get Started… — @github-trending.bsky.social2 likes and reposts
- Apr 26, 2025🚀 Dive into Microsoft’s “AI Agents for Beginners” a 10-lesson course designed to help you build AI agents using tools like Azure AI Agent… — @sean.techsnazzy.com2 likes and reposts
- Apr 21, 2025DesktopCommander MCP is trending on GitHub! Check it out alongside other amazing projects from: @microsoft github.com/microsoft/ai..., @n8n… — @desktopcommander.bsky.social2 likes and reposts
- Feb 14, 2025Microsoft’s #AI Agents for Beginners is a great hands-on resource for learning AI agents from scratch. Perfect for beginners and developers… — @mertyeter.bsky.social2 likes and reposts
- Jul 17, 2026微软开源了一套免费课程《AI Agents for Beginners》,GitHub 已封战 61k+ 星。 课程内容:什么是 AI Agent、怎么用 Tool/MCP、多代理人系统、Context 管理、让 AI 操作浏览器、安全部署——一路到完整实战。… — @anotherbug.com1 likes and repost
- Jun 8, 2026https://github.com/microsoft/ai-agents-for-beginners — @tom-doerr.bsky.social1 likes and repost
- May 3, 2026https://github.com/microsoft/ai-agents-for-beginners — @tom-doerr.bsky.social1 likes and repost
- Apr 21, 2026🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / ai-agents-for-beginners ⭐ 57,227 (+131) 🗒 Jupyter Notebook 12 Lessons to Get Started… — @github-trending.bsky.social1 likes and repost
- Feb 14, 2026https://github.com/microsoft/ai-agents-for-beginners — @tom-doerr.bsky.social1 likes and repost
- Jan 10, 2026https://github.com/microsoft/ai-agents-for-beginners — @tom-doerr.bsky.social1 likes and repost
- Dec 5, 20254) ai-agents-for-beginners ↳ 11 Lessons teaching everything you need to know to start building AI Agents. GitHub: github.com/microsoft/ai... — @analyticalrohit.bsky.social1 likes and repost · 1 reply
- Sep 8, 2025AI Agent for Beginners: github.com/microsoft/ai... ---- 📌 Join 3,000+ ML enthusiasts and professionals from 100 countries. ✅ Learn AI for… — @analyticalrohit.bsky.social1 likes and repost · 1 reply
- Jul 23, 20254) ai-agents-for-beginners ↳ 11 Lessons teaching everything you need to know to start building AI Agents. GitHub: github.com/microsoft/ai... — @analyticalrohit.bsky.social1 likes and repost · 1 reply
- Jun 12, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / ai-agents-for-beginners ⭐ 25,485 (+175) 🗒 Jupyter Notebook 11 Lessons to Get Started… — @github-trending.bsky.social1 likes and repost
- May 29, 2025🔥 Hot Repo! 🔥 (100+ new stars) 📦 microsoft / ai-agents-for-beginners ⭐ 22,020 (+180) 🗒 Jupyter Notebook 11 Lessons to Get Started… — @github-trending.bsky.social1 likes and repost
- Apr 14, 2025🎉 Celebrating! 🎉 (500+ new stars) 📦 microsoft / ai-agents-for-beginners ⭐ 14,149 (+688) 🗒 Jupyter Notebook 10 Lessons to Get Started… — @github-trending.bsky.social1 likes and repost · 1 reply
- Apr 10, 2025🚀 Skyrocketing! 🚀 (200+ new stars) 📦 microsoft / ai-agents-for-beginners ⭐ 11,709 (+403) 🗒 Jupyter Notebook 10 Lessons to Get Started… — @github-trending.bsky.social1 likes and repost
- Mar 23, 2025Fundamentals of building AI Agents, a place to start. github.com/microsoft/ai... — @cloudnativeboy.bsky.social1 likes and repost
- Feb 22, 2025🤖 Include anche esempi di implementazione di workflow usando #Autogen. 🚀 È un contributo davvero interessante. Insieme al corso… — @alessiopomaro.it1 likes and repost · 1 reply
- Jul 1, 20261. Hugging Face — AI Agents Course huggingface.co/learn/agent... 2. Microsoft — AI Agents for Beginners github.com/microsoft/a... 3.… — @aipromptgirl.bsky.social0 likes and reposts · 1 reply
- Jan 3, 2026AI Agents for Beginners (Microsoft) A free, structured 11-lesson course to get started with AI agents the right way.… — @jackfusion.bsky.social0 likes and reposts · 1 reply
- Jul 20, 20252️⃣ AI Agents for Beginners Free 11-part intro course, build your first AI agents step-by-step. 🔗 github.com/microsoft/a... — @arindam-1729.bsky.social0 likes and reposts · 1 reply
- Jun 13, 2025GitHub repo → github.com/microsoft/a... — @arindam-1729.bsky.social0 likes and reposts · 1 reply
- Mar 24, 2025Microsoft's "AI Agents for Beginners," is designed to teach you everything you need to know to start building AI Agents. The course… — @kuanhoong.bsky.social0 likes and reposts · 1 reply
On Hacker News · 3
- Jul 4, 2025Lessons to Get Started Building AI Agents10 points
- Apr 14, 2025AI Agents for Beginners2 points
- Feb 14, 2025AI Agents for Beginners – A 10 Lesson Course2 points
Other versions2 projects use a version of this.
Word for word · 0
None found.
Edited · 1
- Azure-Samples/azure-openai-to-responses★ 615% same
Wrote their own version · 1
- microsoft/generative-ai-for-beginners★ 121ksame name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository338 other files it gives its agents.
- AGENTS.mdAGENTS.md
- translations/ar/AGENTS.mdAGENTS.md
- translations/bg/AGENTS.mdAGENTS.md
- translations/bn/AGENTS.mdAGENTS.md
- translations/cs/AGENTS.mdAGENTS.md
- translations/da/AGENTS.mdAGENTS.md
- translations/de/AGENTS.mdAGENTS.md
- translations/el/AGENTS.mdAGENTS.md
- translations/en/AGENTS.mdAGENTS.md
- translations/es/AGENTS.mdAGENTS.md
- translations/et/AGENTS.mdAGENTS.md
- translations/fa/AGENTS.mdAGENTS.md
- translations/fi/AGENTS.mdAGENTS.md
- translations/fr/AGENTS.mdAGENTS.md
- translations/he/AGENTS.mdAGENTS.md
- translations/hi/AGENTS.mdAGENTS.md
- translations/hr/AGENTS.mdAGENTS.md
- translations/hu/AGENTS.mdAGENTS.md
- translations/id/AGENTS.mdAGENTS.md
- translations/it/AGENTS.mdAGENTS.md
- translations/ja/AGENTS.mdAGENTS.md
- translations/km/AGENTS.mdAGENTS.md
- translations/kn/AGENTS.mdAGENTS.md
- translations/ko/AGENTS.mdAGENTS.md
- translations/lt/AGENTS.mdAGENTS.md
- translations/ml/AGENTS.mdAGENTS.md
- translations/mr/AGENTS.mdAGENTS.md
- translations/ms/AGENTS.mdAGENTS.md
- translations/my/AGENTS.mdAGENTS.md
- translations/ne/AGENTS.mdAGENTS.md
- translations/nl/AGENTS.mdAGENTS.md
- translations/no/AGENTS.mdAGENTS.md
- translations/pa/AGENTS.mdAGENTS.md
- translations/pcm/AGENTS.mdAGENTS.md
- translations/pl/AGENTS.mdAGENTS.md
- translations/pt-BR/AGENTS.mdAGENTS.md
- translations/pt-PT/AGENTS.mdAGENTS.md
- translations/ro/AGENTS.mdAGENTS.md
- translations/ru/AGENTS.mdAGENTS.md
- translations/sk/AGENTS.mdAGENTS.md
- translations/sl/AGENTS.mdAGENTS.md
- translations/sr/AGENTS.mdAGENTS.md
- translations/sv/AGENTS.mdAGENTS.md
- translations/sw/AGENTS.mdAGENTS.md
- translations/ta/AGENTS.mdAGENTS.md
- translations/te/AGENTS.mdAGENTS.md
- translations/th/AGENTS.mdAGENTS.md
- translations/tl/AGENTS.mdAGENTS.md
- translations/tr/AGENTS.mdAGENTS.md
- translations/uk/AGENTS.mdAGENTS.md
- translations/ur/AGENTS.mdAGENTS.md
- translations/vi/AGENTS.mdAGENTS.md
- translations/zh-CN/AGENTS.mdAGENTS.md
- translations/zh-HK/AGENTS.mdAGENTS.md
- translations/zh-MO/AGENTS.mdAGENTS.md
- translations/zh-TW/AGENTS.mdAGENTS.md
- 15-browser-use/llms.txtllms.txt
- azure-openai-to-responsesSkill
- deploying-scalable-agentsSkill
- jupyter-notebookSkill
- The first 60 shown.
The file
Files
将 Python 应用从 Azure OpenAI 聊天补全迁移到 Responses API
权威指南 — 请严格遵循
该技能将使用 Azure OpenAI 聊天补全的 Python 代码库 迁移到统一的 Responses API。请严格遵循这些说明。 不要即兴映射参数或发明 API 形态。
触发条件
当用户希望时启用此技能:
- 将 Python 应用从 Azure OpenAI 聊天补全迁移到 Responses API
- 升级 Python OpenAI SDK 的用法至针对 Azure OpenAI 的最新 API 形态
- 为需要 Azure 上 Responses 的 GPT-5 或更新模型准备 Python 代码
- 从
AzureOpenAI/AsyncAzureOpenAI切换到带 v1 端点的标准OpenAI/AsyncOpenAI客户端 - 修复与
AzureOpenAI构造函数或api_version相关的弃用警告
⚠️ 模型兼容性 — 先检查
迁移前,请验证您的 Azure OpenAI 部署支持 Responses API。
1. 快速测试您的部署(最快)
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["AZURE_OPENAI_API_KEY"],
base_url=f"{os.environ['AZURE_OPENAI_ENDPOINT'].rstrip('/')}/openai/v1/",
)
try:
resp = client.responses.create(
model=os.environ["AZURE_OPENAI_DEPLOYMENT"],
input="ping",
max_output_tokens=50,
store=False,
)
print(f"✅ Deployment supports Responses API: {resp.output_text}")
except Exception as e:
print(f"❌ Deployment does NOT support Responses API: {e}")
<strong>注意</strong>:在 Azure OpenAI 上,max_output_tokens最小为 16。低于 16 会返回 400 错误。用于快速测试时请使用 50 以上。
如果返回 404,该部署的模型尚不支持 Responses — 请检查下面的参考资料或使用支持的模型重新部署。
2. 查看您所在区域可用模型(推荐)
运行内置的模型兼容性工具,查看在您所在的具体区域中支持 Responses API 的可用模型:
python migrate.py models --subscription YOUR_SUB_ID --location YOUR_REGION该命令查询 Azure ARM 实时数据并显示兼容性矩阵——哪些模型支持 Responses、结构化输出、工具等。用 --filter gpt-5.1,gpt-5.2 缩小结果范围或用 --json 用于脚本处理。
3. 完整的模型支持参考
<strong>实时查询</strong>:python migrate.py models(见上文——特定区域,始终最新)<strong>可用浏览</strong>:模型汇总表及区域可用性<strong>快速入门和指南</strong>:https://aka.ms/openai/start
⚠️ 较旧模型的限制
<strong>警告</strong>:较旧模型(gpt-4.1之前的)可能不完全支持所有 Responses API 功能。已知的旧模型限制:
reasoning参数:许多非推理模型不支持。仅当原代码已经存在reasoning时才迁移。seed参数:Responses API 完全不支持,需从所有请求中移除。- 通过
text.format实现的结构化输出:旧模型可能无法可靠强制执行strict: true的 JSON schema。<strong>工具编排</strong>:GPT-5+ 作为内部推理部分协调工具调用。旧模型使用 Responses 仍能工作,但缺少深度集成。<strong>温度限制</strong>:迁移到gpt-5时必须省略温度或设置为1。旧模型没有此类限制。
O 系推理模型(o1、o3-mini、o3、o4-mini)
O 系模型有独特的参数限制。迁移目标为 o 系模型的应用时:
temperature:必须为1(或省略)。O 系模型不接受其他值。max_completion_tokens→max_output_tokens:使用 Azure 专有的max_completion_tokens的应用必须切换到max_output_tokens。设置较高值(4096+),因为推理用的标记计入限制。reasoning_effort:如果应用使用reasoning_effort(低/中/高),请保留—Responses API 支持此参数用于 o 系模型。<strong>流式行为</strong>:O 系模型可能在推理完成前缓冲输出,然后再发出文本增量事件。流式仍然可用,但首个response.output_text.delta可能比 GPT 模型延迟更长。top_p:O 系不支持,存在则移除。<strong>工具使用</strong>:O 系模型通过 Responses API 支持工具,类似 GPT 模型,但工具调用编排质量依模型而异。
措施 — 主动模型建议:扫描阶段检查应用目标模型(部署名、环境变量、配置)。如果模型早于 gpt-4.1(不是 gpt-4.1+),主动告知用户:
- 当前模型下迁移支持基础文本、聊天、流式和工具。
- 新模型(
gpt-5.1、gpt-5.2)在工具编排、结构化输出强制、推理和跨区域可用性方面表现更好。 - 用户应考虑在适当时升级部署 — 这不影响迁移本身。
不因模型版本阻止或拒绝迁移。该建议为信息性质。
GitHub 模型不支持 Responses API
GitHub 模型(
models.github.ai、models.inference.ai.azure.com)不支持 Responses API。
如果代码库有 GitHub 模型的代码路径(检查 base_url 是否指向 models.github.ai 或 models.inference.ai.azure.com),<strong>迁移时请完全移除</strong>。Responses API 需要 Azure OpenAI、OpenAI 或兼容的本地端点(如支持 Responses 的 Ollama)。
扫描阶段操作:
- 标记所有 GitHub 模型代码路径以备删除。
框架迁移
许多应用使用 OpenAI 之上的高级框架。迁移它们时,需变更框架自身 API,而非仅底层 OpenAI 调用。
Microsoft 代理框架 (MAF)
先检查您的 MAF 版本 — 迁移依赖于您使用的是 MAF 1.0.0+ 还是 1.0.0 前的 beta/rc 版本。
MAF 1.0.0+ (agent-framework-openai >= 1.0.0)
OpenAIChatClient 已经使用 Responses API — 无需迁移。如果代码库使用旧版 OpenAIChatCompletionClient(调用 chat.completions.create),请替换为 OpenAIChatClient。
| 之前 | 之后 |
from agent_framework.openai import OpenAIChatCompletionClient | from agent_framework.openai import OpenAIChatClient |
OpenAIChatCompletionClient(...) | OpenAIChatClient(...) |
查看版本:python -c "import agent_framework_openai; print(agent_framework_openai.__version__)"
MAF 1.0.0 前版本 (beta/rc 发布)
在 MAF 1.0.0 前,OpenAIChatClient 使用聊天补全。升级至 agent-framework-openai>=1.0.0,默认使用 Responses API。
其他接口不变 — Agent 和工具 API 保持一样。
LangChain (langchain-openai)
在 ChatOpenAI() 中添加 use_responses_api=True。并将响应访问由 .content 改为 .text。
| 之前 | 之后 |
ChatOpenAI(model=..., base_url=..., api_key=...) | ChatOpenAI(model=..., base_url=..., api_key=..., use_responses_api=True) |
result['messages'][-1].content | result['messages'][-1].text |
详细的前后代码示例,参见 cheat-sheet.md。
前端迁移指导
Responses API 是服务器端的 concern。 迁移您的 Python 后端;前端的 HTTP 协议不应更改,除非后端仅是薄代理——在此情况下,考虑采用 Responses 请求形态以消除翻译层。如果前端使用客户端密钥直接调用 OpenAI,请先将这类调用移至后端。
@microsoft/ai-chat-protocol 弃用
@microsoft/ai-chat-protocol npm 包已弃用,应替换为 ndjson-readablestream。如在前端遇到:
- 替换 CDN 脚本标签:
<!-- Before --> <script src="https://cdn.jsdelivr.net/npm/@microsoft/ai-chat-protocol@.../dist/iife/index.js"></script> <!-- After --> <script src="https://cdn.jsdelivr.net/npm/ndjson-readablestream@1.0.7/dist/ndjson-readablestream.umd.js"></script> - 移除
AIChatProtocolClient实例化(new ChatProtocol.AIChatProtocolClient("/chat"))。 - 将
client.getStreamedCompletion(messages)替换为对后端流式端点的直接fetch()调用。 - 将
for await (const response of result)替换为for await (const chunk of readNDJSONStream(response.body))。 - 更新属性访问,由
response.delta.content/response.error改为chunk.delta.content/chunk.error。
目标
- 枚举所有使用 Chat Completions 或旧版 Completions 调用 Azure OpenAI 的 Python 代码位置。
- 提出 Python 代码库的迁移方案与步骤。
- 应用安全且最小化的编辑切换至 Responses API。
- 更新调用者以消费 Responses 输出模式;不使用向后兼容封装。
- 执行测试/静态检查;修复迁移带来的轻微破坏。
- 准备小型、易复审的变更集并提供最终带差异摘要(不提交)。
保护措施
- 仅修改 git 工作区内的文件,绝不向外写文件。
- 不保留向后兼容 shim;将代码迁移至新 API 形态。
- 不留墓碑/过渡注释或备份文件。
- 如先前使用流式,请保留流式语义;否则使用非流式。
- 审批模式下运行命令或网络请求前请求批准。
- 不运行
git add/git commit/git push;仅生成工作区编辑。
步骤 0:Azure OpenAI 客户端迁移(前提)
如果代码库使用 AzureOpenAI 或 AsyncAzureOpenAI 构造函数,先迁移到标准 OpenAI / AsyncOpenAI 构造函数。Azure 专用构造函数在 openai>=1.108.1 中已弃用。
为什么使用 v1 API 路径?
新的 /openai/v1 端点使用标准的 OpenAI() 客户端替代 AzureOpenAI(),无须 api_version 参数,且在 OpenAI 和 Azure OpenAI 上表现一致。相同客户端代码具备未来兼容性,无需版本管理。
关键变更
| 之前 | 之后 |
AzureOpenAI | OpenAI |
AsyncAzureOpenAI | AsyncOpenAI |
azure_endpoint | base_url |
azure_ad_token_provider | api_key |
api_version=... | 完全移除 |
清理检查项
- 从客户端构造中移除
api_version参数。 - 从
.env、应用设置和 Bicep/基础设施文件中移除AZURE_OPENAI_VERSION/AZURE_OPENAI_API_VERSION环境变量。 - 将
.env、应用设置、Bicep/基础设施及测试夹具中的AZURE_OPENAI_CLIENT_ID重命名为AZURE_CLIENT_ID(遵守 Azure Identity SDK 标准惯例)。 - 确保
requirements.txt或pyproject.toml中使用openai>=1.108.1。
环境变量迁移
| 旧环境变量 | 操作 | 备注 |
AZURE_OPENAI_VERSION | <strong>移除</strong> | v1 端点无需 api_version |
AZURE_OPENAI_API_VERSION | <strong>移除</strong> | 同上 |
AZURE_OPENAI_CLIENT_ID | <strong>重命名</strong> → AZURE_CLIENT_ID | Azure Identity SDK 标准,用于 ManagedIdentityCredential(client_id=...) |
AZURE_OPENAI_ENDPOINT | <strong>保留</strong> | 仍用于构造 base_url |
AZURE_OPENAI_CHAT_DEPLOYMENT | <strong>保留</strong> | 用作 responses.create 的 model 参数 |
AZURE_OPENAI_API_KEY | <strong>保留</strong> | 用作基于密钥认证的 api_key |
客户端设置代码示例(同步、异步、EntraID、API 密钥、多租户)见 cheat-sheet.md。
步骤 1:检测旧版调用点
运行 detect_legacy.py 脚本查找所有需迁移的调用点:
python skills/azure-openai-to-responses/scripts/detect_legacy.py .或手动搜索——每个匹配都是迁移目标:
# 旧版API调用(必须重写)
rg "chat\.completions\.create"
rg "ChatCompletion\.create"
rg "Completion\.create"
# 已弃用的Azure客户端构造函数(必须替换)
rg "AzureOpenAI\("
rg "AsyncAzureOpenAI\("
# 响应结构访问模式(必须更新)
rg "choices\[0\]\.message\.content"
rg "choices\[0\]\.delta\.content"
rg "choices\[0\]\.message\.function_call"
rg "choices\[0\]\.message\.tool_calls"
# 旧嵌套格式的工具定义(必须扁平化)
rg '"function":\s*{\s*"name"'
rg "pydantic_function_tool"
# 旧格式的工具结果(必须转换为function_call_output)
rg '"role":\s*"tool"'
rg '"tool_call_id"'
# 已弃用的参数(必须删除或重命名)
rg "response_format"
rg "max_tokens\b" # 重命名为max_output_tokens
rg "['\"]seed['\"]" # remove entirely
# 已弃用的环境变量(清理)
rg "AZURE_OPENAI_API_VERSION|AZURE_OPENAI_VERSION"
rg "AZURE_OPENAI_CLIENT_ID" # 应为AZURE_CLIENT_ID
# GitHub模型端点(必须删除 — 不支持Responses API)
rg "models\.github\.ai|models\.inference\.ai\.azure"
# 框架级旧模式(必须更新)
rg "OpenAIChatCompletionClient" # MAF 1.0.0+:替换为OpenAIChatClient
rg "ChatOpenAI\(" | grep -v "use_responses_api" # LangChain:需要use_responses_api=True
# 测试基础设施(必须更新)
rg "ChatCompletionChunk|AsyncCompletions\.create" tests/
rg "_azure_ad_token_provider" tests/
rg "prompt_filter_results|content_filter_results" tests/
rg "choices\[0\]" tests/
# 内容过滤器错误体访问(必须更新 — 结构已更改)
rg 'innererror.*content_filter_result|error\.body\["innererror"\]'
rg "content_filter_result\[" # 旧的单数形式 — 现在是content_filters数组内的content_filter_results(复数)
# 直接调用Chat Completions端点的原始HTTP请求(必须更新URL)
rg "/openai/deployments/.*/chat/completions"
rg "api-version="规则(检测与重写)
<strong>聊天补全客户端</strong>:client.chat.completions.create→client.responses.create(...)。- Azure 客户端构造函数:
AzureOpenAI(...)→OpenAI(base_url=..., api_key=...)。 <strong>工具</strong>:将函数调用工具定义从嵌套格式({"type": "function", "function": {"name": ...}})转换为扁平的 Responses 格式({"type": "function", "name": ...});使用tool_choice;返回工具结果作为{"type": "function_call_output", "call_id": ..., "output": ...}项(而非{"role": "tool", ...})。<strong>工具往返</strong>:当模型返回函数调用时,将response.output项追加到对话中(而不是手动添加{"role": "assistant", "tool_calls": [...]}字典),然后为每个结果追加function_call_output项。<strong>少样本工具示例</strong>:如果对话中包含硬编码的工具调用示例,转换为{"type": "function_call", "id": "fc_...", "call_id": "fc_...", ...}+{"type": "function_call_output", ...}项。ID 必须以fc_开头。pydantic_function_tool()<strong>:此辅助仍生成旧的嵌套格式,</strong>不兼容responses.create()。请替换为手动工具定义或扁平化包装器。<strong>多轮</strong>:在应用中维护对话历史;通过input项传递之前的轮次。<strong>格式化</strong>:将 Chat 的顶层response_format替换为 Responses 的text.format。规范形态:text={"format": {"type": "json_schema", "name": "Output", "strict": True, "schema": {...}}}。<strong>内容项</strong>:将 Chat 的content[].type: "text"替换为 Responses 的content[].type: "input_text",适用于用户/系统回合。<strong>图片内容项</strong>:将 Chat 的content[].type: "image_url"替换为 Responses 的content[].type: "input_image"。image_url字段由嵌套对象{"url": "..."}变为扁平字符串。详见备忘清单的前后示例。<strong>推理工作</strong>:仅在原始代码中已存在reasoning时迁移。<strong>内容过滤错误处理</strong>:错误体结构变化。Chat Completion 使用error.body["innererror"]["content_filter_result"](单数);Responses API 使用error.body["content_filters"][0]["content_filter_results"](复数,数组内)。访问innererror的代码将引发KeyError,需重写为新路径。- 原始 HTTP 调用:如果应用直接调用 Azure OpenAI REST API(通过
requests、httpx等)使用/openai/deployments/{name}/chat/completions?api-version=...,需重写为/openai/v1/responses。请求体变化:messages→input,新增max_output_tokens和store: false,移除api-version查询参数。响应体变化:choices[0].message.content→output[0].content[0].text(注意:output_text是 SDK 便捷属性,原始 REST JSON 无)。
步骤 2:应用迁移
迁移说明(Chat Completions → Responses)
<strong>为何迁移</strong>:Responses 是文本、工具和流式的统一接口;Chat Completions 属于遗留接口。使用 GPT-5 时,必须使用 Responses 以获得最佳性能。- HTTP:Azure 端点从
/openai/deployments/{name}/chat/completions变更为/openai/v1/responses。 <strong>字段</strong>:messages→input,max_tokens→max_output_tokens。temperature不变。<strong>格式化</strong>:response_format→text.format(对象)。<strong>内容项</strong>:将 Chat 的content[].type: "text"替换为 Responses 的content[].type: "input_text",适用于系统/用户回合。<strong>图片内容项</strong>:将 Chat 的content[].type: "image_url"替换为 Responses 的content[].type: "input_image"。image_url字段由{"image_url": {"url": "..."}}扁平为{"image_url": "..."}(纯字符串,https URL 或data:image/...;base64,...数据 URI)。
参数映射参考
| Chat Completions | Responses API |
prompt | input |
messages | input(项数组) |
max_tokens | max_output_tokens |
response_format | text.format(对象) |
temperature | temperature(不变) |
stop | stop(不变) |
frequency_penalty | frequency_penalty(不变) |
presence_penalty | presence_penalty(不变) |
tools / 函数调用 | tools(不变) |
seed | <strong>移除</strong>(不支持) |
store | store(设为 false) |
content[].type: "text" | content[].type: "input_text" |
content[].type: "image_url" | content[].type: "input_image" |
"image_url": {"url": "..."} | "image_url": "..."(扁平字符串) |
完整的前后代码示例见 cheat-sheet.md。
测试基础设施迁移(模拟、快照、断言)见 test-migration.md。
错误排查及注意事项见 troubleshooting.md。
数据保留与状态
- 对所有 Responses 请求设置
store: false。 - 不依赖先前消息 ID 或服务器存储的上下文;保持状态由客户端管理,且最小化元数据。
验收标准
代码级门控(全部通过)
- 已迁移文件中无
rg "chat\.completions\.create|ChatCompletion\.create|Completion\.create"命中。 - 已迁移代码中无
rg "AzureOpenAI\(|AsyncAzureOpenAI\(",全部构造函数使用基于 v1 端点的OpenAI/AsyncOpenAI。 - 已迁移代码中无
rg "models\.github\.ai|models\.inference\.ai\.azure",GitHub 模型代码路径已移除。 - 已迁移代码中无
rg "OpenAIChatCompletionClient",MAF 1.0.0+ 使用OpenAIChatClient(采用 Responses API)。1.0.0 以前版本升级至agent-framework-openai>=1.0.0。 - 所有
ChatOpenAI(...)调用包含use_responses_api=True。 - 无
rg "choices\[0\]"命中,所有响应访问使用resp.output_text或 Responses 输出结构。 - 顶层没有
response_format,所有结构化输出使用text={"format": {...}}。 requirements.txt或pyproject.toml中包含openai>=1.108.1和azure-identity,依赖已重新安装。- 所有
responses.create调用设置了store=False。 - 客户端构造无
api_version,环境文件和基础设施移除了AZURE_OPENAI_API_VERSION。
测试基础设施门控(全部通过)
- 测试文件中无
rg "ChatCompletionChunk|AsyncCompletions\.create|chat\.completions"命中。 - 测试文件中无
rg "_azure_ad_token_provider"命中,断言更新为检查isinstance(client, AsyncOpenAI)或者base_url。 - 测试文件中无
rg "prompt_filter_results|content_filter_results"命中,移除 Azure 特定过滤模拟。 - 模拟夹具使用
kwargs.get("input")替代kwargs.get("messages")。 - 快照/黄金文件更新为 Responses 流式形态(无
choices[0]、function_call、logprobs等)。 - 执行
pytest后零失败。
行为门控(手动或测试框架验证)
<strong>基础完成</strong>:非流式responses.create返回非空output_text。<strong>流式一致性</strong>:若原代码使用流式,迁移代码流式返回且产出response.output_text.delta事件,且 delta 非空。<strong>结构化输出</strong>:若使用text.format的json_schema,json.loads(resp.output_text)成功且符合模式。<strong>工具调用循环</strong>:如果使用工具,模型发起工具调用,应用执行,后续请求返回最终output_text(无无限循环)。<strong>异步一致性</strong>:若使用过AsyncAzureOpenAI,则等效的AsyncOpenAI可正常使用await。<strong>错误率</strong>:与迁移前基线比较,无新增 400/401/404 错误。
交付物
- 总结包括已编辑文件、老旧调用点的转换前后计数、以及后续步骤。
- 变更为工作区未提交编辑(无提交)。
SDK 版本要求
| 包名 | 最低版本 |
openai | >=1.108.1 |
azure-identity | 最新版(用于 EntraID 认证) |
参考资料
- 备忘清单 — 所有代码片段
- 测试迁移 — 模拟、快照、断言
- 故障排查 — 错误、风险表、注意事项
- detect_legacy.py — 自动扫描器
- Azure OpenAI 入门包
- Azure OpenAI Responses API 文档
- Azure OpenAI API 版本生命周期
- OpenAI Responses API 参考
<!-- CO-OP TRANSLATOR DISCLAIMER START -->免责声明: 本文件由 AI 翻译服务 Co-op Translator 翻译完成。尽管我们力求准确,但请注意,自动翻译可能包含错误或不准确之处。原始语言版文件应视为权威来源。对于重要信息,建议使用专业人工翻译。我们对因使用本翻译而产生的任何误解或误释不承担责任。
<!-- CO-OP TRANSLATOR DISCLAIMER END -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

