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 結構 - 為 GPT-5 或更新版本需要在 Azure 上使用 Responses 的模型準備 Python 程式碼 - 從 AzureOpenAI/AsyncAzureOpenAI 切換至使用標準的 OpenAI/AsyncOpenAI 客戶端及 v1 端點 - 修正與 AzureOpenAI 建構函式或 api_version 相關的棄用警告 遷移前,請確認您的 Azure OpenAI 部署支援 Responses API。 <strong>注意</strong>:Azure OpenAI 上的 max_output_tokens 最小值為 16。小於 16 將返回 400 錯誤。簡易測試請使用…
- Reads credentials
- Commits and pushes
2 other projects use a version of this, 2 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-beginnersedited, 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 · 2
- microsoft/generative-ai-for-beginners★ 121k10% same
- Azure-Samples/azure-openai-to-responses★ 615% same
Wrote their own version · 0
None found.
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 結構
- 為 GPT-5 或更新版本需要在 Azure 上使用 Responses 的模型準備 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最小值為 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參數:許多非推理模型不支援。只有原本代碼使用過才遷移此參數。seed參數:Responses API 完全不支援,務必移除。- 透過
text.format的結構化輸出:舊版模型可能無法穩定強制strict: true的 JSON 架構。<strong>工具編排</strong>:GPT-5+ 在推理中整合工具呼叫。舊版模型仍運作,但缺乏此深入整合。<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。由於推理會消耗 Token,設定較高值(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-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 的高階框架。遷移這些框架時,不僅底層 OpenAI 呼叫改變,框架自身的 API 也會變更。
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)
在 MAF 1.0.0 之前版本中,OpenAIChatClient 使用 Chat Completions。請升級到 agent-framework-openai>=1.0.0,它會預設使用 Responses API 的 OpenAIChatClient。
其他 API(如 Agent 和工具)不變。
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 腳本標籤:
<!-- 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 輸出結構;不使用任何向後相容包裝。
- 執行測試與靜態檢查;修正遷移導致的小錯誤。
- 準備小且可審核的變更集,並提供最終摘要及差異 (不執行 commit)。
防護措施
- 僅修改 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/基礎架構及測試 fixture 中的AZURE_OPENAI_CLIENT_ID改名為AZURE_CLIENT_ID(符合 Azure 身分識別 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 身分識別 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="偵測與重寫的啟發式
- 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": [...]}字典),然後為每個結果追加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>:以 Responses 取代 Chat 的頂層response_format,改為使用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 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。
考量測試基礎設施遷移(mocks、快照、斷言),請見 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。
測試基礎設施門檻(全部通過)
- 在
tests/中搜尋rg "ChatCompletionChunk|AsyncCompletions\.create|chat\.completions",應為零結果。 - 在
tests/中搜尋rg "_azure_ad_token_provider",斷言更新為檢查isinstance(client, AsyncOpenAI)或base_url。 - 在
tests/中搜尋rg "prompt_filter_results|content_filter_results",移除 Azure 特有過濾器 mocks。 - mock fixtures 使用
kwargs.get("input"),而非kwargs.get("messages")。 - 快照與 golden 檔案更新為 Responses 串流格式(無
choices[0]、function_call、logprobs等)。 - 所有測試更新後
pytest通過且無失敗。
行為門檻(手動或透過測試套件驗證)
<strong>基本完成測試</strong>:非串流responses.create返回非空字串output_text。<strong>串流一致性</strong>:原程式有使用串流,則遷移後程式也串流並產生包含非空增量的response.output_text.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 認證) |
參考資源
- 速查表 — 所有程式碼片段
- 測試遷移 — mocks、快照、斷言
- 故障排除 — 錯誤、風險表、注意事項
- 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.

