azure-openai-to-responses
Skill76k starsChanged 5 months agoMITView on GitHub
權威指南 — 請嚴格遵循 本技能將使用 Azure OpenAI Chat Completions 的 Python 代碼庫 遷移到統一的 Responses API。請精確遵循這些指令。 不得自行即興映射參數或創建 API 形態。 當用戶想要: - 將 Python 應用從 Azure OpenAI Chat Completions 遷移到 Responses API - 升級 Python OpenAI SDK 使用方式,改用針對 Azure OpenAI 的最新 API 形態 - 為需要 Azure Responses 的 GPT-5 或更新模型準備 Python 代碼 - 從 AzureOpenAI / AsyncAzureOpenAI 切換到使用標準的 OpenAI / AsyncOpenAI 客戶端,搭配 v1 端點 - 修正與 AzureOpenAI 建構子或 api_version 相關的棄用警告 遷移前,請確認您的 Azure OpenAI 部署支援 Responses API。 <strong>注意</strong>:Azure OpenAI 上 max_output_tokens 的<strong>最小值為 16</strong>。低於 16…
- 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 Chat Completions 遷移到 Responses API
權威指南 — 請嚴格遵循
本技能將使用 Azure OpenAI Chat Completions 的 Python 代碼庫 遷移到統一的 Responses API。請精確遵循這些指令。 不得自行即興映射參數或創建 API 形態。
觸發條件
當用戶想要:
- 將 Python 應用從 Azure OpenAI Chat Completions 遷移到 Responses API
- 升級 Python OpenAI SDK 使用方式,改用針對 Azure OpenAI 的最新 API 形態
- 為需要 Azure Responses 的 GPT-5 或更新模型準備 Python 代碼
- 從
AzureOpenAI/AsyncAzureOpenAI切換到使用標準的OpenAI/AsyncOpenAI客戶端,搭配 v1 端點 - 修正與
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的<strong>最小值為 16</strong>。低於 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(low/medium/high),請保留 — 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 Models 不支援 Responses API
GitHub Models (
models.github.ai,models.inference.ai.azure.com) 不支援 Responses API。
若代碼庫含有 GitHub Models 程式碼路徑(尋找 base_url 指向 models.github.ai 或 models.inference.ai.azure.com),遷移時<strong>必須完全移除</strong>。Responses API 需 Azure OpenAI、OpenAI 或相容本機端點(如支持 Responses 的 Ollama)。
掃描階段行動:
- 標記所有 GitHub Models 程式碼路徑以便移除。
框架遷移
許多應用使用 OpenAI 之上高階框架。遷移這些時,框架的 API 也會改變 — 不僅是底層的 OpenAI 調用。
Microsoft Agent Framework (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 發行版)
1.0.0 以前的 MAF 中,OpenAIChatClient 仍使用 Chat Completions。請升級至 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 是伺服器端功能。 請遷移 Python 後端;前端的 HTTP 合約應保持不變,除非您的後端很薄透 — 此時可考慮直接採用 Responses 請求格式以消除轉換層。若前端直接用客戶端金鑰調用 OpenAI,請先移至後端。
@microsoft/ai-chat-protocol 棄用
@microsoft/ai-chat-protocol npm 套件已棄用,應改用 ndjson-readablestream。前端若遇到:
- 替換 CDN script 標籤:
<!-- 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 | 用於 ManagedIdentityCredential(client_id=...),符合 Azure Identity SDK 慣例 |
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 Models 端點(必須移除 — 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="偵測與重寫原則
- Chat Completions 用戶端:
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": [...]}dict),接著為每個結果附加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>:將 Chatcontent[].type: "text"替換為 Responsescontent[].type: "input_text"(適用於用戶/系統回合)。<strong>圖片內容項目</strong>:將 Chatcontent[].type: "image_url"替換為 Responsescontent[].type: "input_image"。image_url欄位由巢狀物件{"url": "..."}改為平面字串。請參考備忘單了解前後範例。<strong>推理內容</strong>:僅在原始程式碼存在reasoning時才遷移。<strong>內容過濾錯誤處理</strong>:錯誤主體結構變動。Chat Completions 使用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 是文字、工具與串流的統一 API;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 Models 相關程式碼路徑已移除。 - 無
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")。 - 快照 / golden 檔案已更新為 Responses 串流格式(無
choices[0]、function_call、logprobs等)。 - 完成所有測試更新後,
pytest輸出零失敗。
行為門檻(手動或透過測試框架驗證)
<strong>基本完成</strong>:非串流的responses.create回傳非空output_text。<strong>串流一致性</strong>:若原程式使用串流,遷移後仍串流並產生含非空 delta 的response.output_text.delta事件。<strong>結構化輸出</strong>:若使用帶json_schema的text.format,json.loads(resp.output_text)成功且符合 schema。<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.

