Upgrade to OpenAI Responses API and remove GitHub Models support#17
Merged
Upgrade to OpenAI Responses API and remove GitHub Models support#17
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates the repository’s Python demos from the Chat Completions API to the OpenAI Responses API, and removes GitHub Models as an LLM provider (since it doesn’t support the Responses API).
Changes:
- Switched all example scripts to
client.responses.create(...)/client.responses.parse(...), updating streaming, tool-calling, and structured outputs usage. - Removed GitHub Models provider selection and related docs/devcontainer assets; default host is now Azure.
- Updated infra/env tooling so
AZURE_OPENAI_ENDPOINTis no longer expected to include/openai/v1.
Show a summary per file
| File | Description |
|---|---|
| structured_outputs_nested.py | Migrate structured output parsing + Azure base_url normalization |
| structured_outputs_function_calling.py | Migrate tool calling example to Responses API |
| structured_outputs_enum.py | Migrate structured output parsing to Responses API |
| structured_outputs_description.py | Migrate structured output parsing to Responses API |
| structured_outputs_basic.py | Migrate structured output parsing to Responses API |
| spanish/structured_outputs_nested.py | Spanish structured output parsing migration |
| spanish/structured_outputs_function_calling.py | Spanish tool calling + Responses API migration |
| spanish/structured_outputs_enum.py | Spanish structured output parsing migration |
| spanish/structured_outputs_description.py | Spanish structured output parsing migration |
| spanish/structured_outputs_basic.py | Spanish structured output parsing migration |
| retrieval_augmented_generation.py | RAG script migrated to Responses API |
| spanish/retrieval_augmented_generation.py | Spanish RAG script migrated to Responses API |
| rag_queryrewrite.py | Query rewrite flow migrated to Responses API |
| spanish/rag_queryrewrite.py | Spanish query rewrite flow migrated to Responses API |
| rag_multiturn.py | Multi-turn RAG migrated to Responses API |
| spanish/rag_multiturn.py | Spanish multi-turn RAG migrated to Responses API |
| rag_documents_ingestion.py | Removed GitHub provider option from ingestion script |
| spanish/rag_documents_ingestion.py | Removed GitHub provider option from ingestion script |
| rag_documents_hybrid.py | Hybrid RAG generation migrated to Responses API |
| spanish/rag_documents_hybrid.py | Spanish hybrid RAG generation migrated to Responses API |
| rag_documents_flow.py | RAG flow generation migrated to Responses API |
| spanish/rag_documents_flow.py | Spanish RAG flow generation migrated to Responses API |
| rag_csv.py | CSV RAG generation migrated to Responses API |
| spanish/rag_csv.py | Spanish CSV RAG generation migrated to Responses API |
| prompt_engineering.py | Prompting demo migrated to Responses API |
| spanish/prompt_engineering.py | Spanish prompting demo migrated to Responses API |
| function_calling_basic.py | Basic tool-calling demo migrated to Responses API |
| spanish/function_calling_basic.py | Spanish basic tool-calling demo migrated to Responses API |
| function_calling_call.py | Tool execution demo migrated to Responses API |
| spanish/function_calling_call.py | Spanish tool execution demo migrated to Responses API |
| function_calling_extended.py | Full tool round-trip migrated to Responses API |
| spanish/function_calling_extended.py | Spanish full tool round-trip migrated to Responses API |
| function_calling_errors.py | Tool error-handling demo migrated to Responses API |
| spanish/function_calling_errors.py | Spanish tool error-handling demo migrated to Responses API |
| function_calling_fewshots.py | Few-shot tool-calling format updated for Responses API |
| spanish/function_calling_fewshots.py | Spanish few-shot tool-calling format updated for Responses API |
| function_calling_parallel.py | Parallel tool calls demo migrated to Responses API |
| spanish/function_calling_parallel.py | Spanish parallel tool calls demo migrated to Responses API |
| function_calling_while_loop.py | Looping tool-calling demo migrated to Responses API |
| spanish/function_calling_while_loop.py | Spanish looping tool-calling demo migrated to Responses API |
| few_shot_examples.py | Few-shot chat demo migrated to Responses API |
| spanish/few_shot_examples.py | Spanish few-shot chat demo migrated to Responses API |
| chat.py | Basic chat demo migrated to Responses API |
| spanish/chat.py | Spanish basic chat demo migrated to Responses API |
| chat_stream.py | Streaming demo migrated to Responses API streaming events |
| spanish/chat_stream.py | Spanish streaming demo migrated to Responses API streaming events |
| chat_safety.py | Safety demo migrated to Responses API output access |
| spanish/chat_safety.py | Spanish safety demo migrated to Responses API output access |
| chat_history.py | History demo migrated to Responses API output access |
| spanish/chat_history.py | Spanish history demo migrated to Responses API output access |
| chat_history_stream.py | History streaming demo migrated to Responses API streaming events |
| spanish/chat_history_stream.py | Spanish history streaming demo migrated to Responses API streaming events |
| chat_async.py | Async demo migrated to Responses API |
| spanish/chat_async.py | Spanish async demo migrated to Responses API |
| chained_calls.py | Multi-call chaining migrated to Responses API |
| spanish/chained_calls.py | Spanish multi-call chaining migrated to Responses API |
| reasoning.py | Reasoning example migrated to Responses API + reasoning config update |
| README.md | Removed GitHub Models documentation; updated provider framing |
| spanish/README.md | Removed GitHub Models documentation; updated Azure endpoint guidance |
| AGENTS.md | Updated agent guidance for provider removal/defaults |
| infra/main.bicep | Updated model defaults (name/version/deployment) |
| infra/write_dot_env.sh | Stop appending /openai/v1 / removing version var from .env generation |
| infra/write_dot_env.ps1 | Stop appending /openai/v1 / removing version var from .env generation |
| .env.sample | Updated supported hosts + Azure endpoint format; removed GitHub vars |
| .env.sample.github | Removed GitHub-only sample env file |
| .devcontainer/github/devcontainer.json | Removed GitHub Models devcontainer variant |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comments suppressed due to low confidence (2)
AGENTS.md:11
- Documentation is now out of sync with the codebase: this section still describes the repo as demonstrating “chat completions” and lists “Chat Completion Scripts”, but the scripts were migrated to the Responses API. Update the terminology/examples so new contributors aren’t guided toward deprecated APIs.
This repository contains a collection of Python scripts that demonstrate how to use the OpenAI API (and compatible APIs like Azure OpenAI and Ollama) to generate chat completions. The repository includes examples of:
- Basic chat completions (streaming, async, history)
- Function calling (basic to advanced multi-function scenarios)
- Structured outputs using Pydantic models
AGENTS.md:176
- This section instructs users to set/check
OPENAI_API_KEY, but the scripts and.env.sampleuseOPENAI_KEYfor OpenAI.com. Align the documentation with the actual env var name (or update the scripts to readOPENAI_API_KEY) to avoid misconfiguration.
#### Option 2: OpenAI.com (requires API key and costs)
**For agents:** Check if OpenAI.com API key is available:
```bash
if [ -n "$OPENAI_API_KEY" ]; then
- Files reviewed: 66/66 changed files
- Comments generated: 10
madebygps
approved these changes
Apr 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates all scripts from the Chat Completions API to the OpenAI Responses API, and removes GitHub Models as an LLM provider (it doesn't support the Responses API).
66 files changed, 884 insertions, 1244 deletions.
Responses API migration
All 55+ Python scripts (English + Spanish) updated:
AzureOpenAI()OpenAI(base_url=f"{endpoint}/openai/v1/")client.chat.completions.create(messages=...)client.responses.create(input=..., store=False)response.choices[0].message.contentresponse.output_textevent.choices[0].delta.contentevent.type == "response.output_text.delta"/event.delta{"type": "function", "function": {"name": ...}}{"type": "function", "name": ...}(flat format){"role": "tool", "tool_call_id": ...}{"type": "function_call_output", "call_id": ...}client.beta.chat.completions.parse(response_format=...)client.responses.parse(text_format=...)reasoning_effort="low"reasoning={"effort": "low"}Function calling specifics
name/parametersat top level)response.outputitems +function_call_outputfunction_call/function_call_outputitems withfc_ID prefixstrict: trueschemas includerequiredandadditionalProperties: falseGitHub Models removal
elif API_HOST == "github"block from all 58 Python scriptsAPI_HOSTfrom"github"to"azure".env.sample.githuband.devcontainer/github/Infrastructure
infra/main.bicepmodel defaults togpt-5.4(version2026-03-05)AZURE_OPENAI_VERSIONfrom.env,write_dot_env.sh,write_dot_env.ps1/openai/v1into the endpoint (scripts already append it)Verification
ruff check .— all passedblack . --check— all passed