Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the codebase from Azure-specific OpenAI clients to the generic OpenAI client for better consistency and simplicity, while adding comprehensive infrastructure provisioning capabilities.
- Replaces
AzureOpenAI/AsyncAzureOpenAIwith genericopenai.OpenAI/openai.AsyncOpenAIclients across all scripts - Standardizes environment variable naming from
AZURE_OPENAI_DEPLOYMENTtoAZURE_OPENAI_CHAT_DEPLOYMENT - Adds Infrastructure as Code (Bicep templates) with Azure Developer CLI integration for automated resource provisioning
- Removes higher-level framework dependencies (Langchain, LlamaIndex, PydanticAI) to focus on core OpenAI package usage
- Enhances documentation with detailed setup instructions for all supported platforms
Reviewed Changes
Copilot reviewed 66 out of 68 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
Multiple .py files |
Updated Azure OpenAI client initialization to use generic OpenAI client with base_url and api_key parameters |
spanish/chat_async.py |
Enhanced async resource management with proper credential cleanup |
chat_async.py |
Enhanced async resource management with proper credential cleanup |
| Infrastructure files | Added Bicep templates and deployment scripts for Azure resource provisioning |
README.md |
Significantly expanded documentation with platform-specific setup instructions |
| Framework files | Removed Langchain, LlamaIndex, and PydanticAI example scripts |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| import os | ||
|
|
||
| import azure.identity | ||
| import azure.identity.aio |
There was a problem hiding this comment.
The import has been changed from azure.identity to azure.identity.aio, but this change is inconsistent with other files in the PR that still use the synchronous azure.identity module. This could cause import errors if azure.identity.aio is not available in the installed version of the azure-identity package.
| import azure.identity.aio | |
| import azure.identity |
There was a problem hiding this comment.
This one uses async as its the async example specifically
| import os | ||
|
|
||
| import azure.identity | ||
| import azure.identity.aio |
There was a problem hiding this comment.
The import has been changed from azure.identity to azure.identity.aio, but this change is inconsistent with other files in the PR that still use the synchronous azure.identity module. This could cause import errors if azure.identity.aio is not available in the installed version of the azure-identity package.
There was a problem hiding this comment.
This one uses async as its the async example specifically
|
|
||
| response = client.chat.completions.create( | ||
| model=MODEL_NAME, | ||
| model=MODEL_NAME, # Must be a reasoning model like gpt-5 or gpt-oss |
There was a problem hiding this comment.
The comment mentions 'gpt-oss' which appears to be a typo. It should likely be 'o1' or another valid reasoning model name, as 'gpt-oss' is not a known OpenAI model.
| model=MODEL_NAME, # Must be a reasoning model like gpt-5 or gpt-oss | |
| model=MODEL_NAME, # Must be a reasoning model like gpt-5 or o1 |
There was a problem hiding this comment.
Lol, gpt-oss is a new open source model
madebygps
left a comment
There was a problem hiding this comment.
I pushed some changes, rest lgtm
Purpose
Breakdown from Copilot:
Azure OpenAI integration and environment variable standardization:
openai.OpenAI/openai.AsyncOpenAIclients for Azure, replacingAzureOpenAI/AsyncAzureOpenAI, and updated the environment variable fromAZURE_OPENAI_DEPLOYMENTtoAZURE_OPENAI_CHAT_DEPLOYMENTfor clarity and consistency. Also updated endpoint variables to include/openai/v1in the URL. (chained_calls.py,chat.py,chat_async.py,chat_history.py,chat_history_stream.py,.env.sample,.env.sample.azure) [1] [2] [3] [4] [5] [6] [7] [8] [9]Async resource management improvements:
chat_async.pyto properly manage and close async clients and credentials, preventing resource leaks and ensuring clean shutdowns. [1] [2]Documentation and onboarding enhancements:
README.mdto provide detailed, step-by-step instructions for configuring and running scripts with GitHub Models, Azure OpenAI, OpenAI.com, and Ollama. Clarified environment variable usage and added sections for function calling, RAG, structured outputs, and infrastructure setup. [1] [2] [3] [4] [5]Infrastructure as Code (IaC) support:
azure.yamlto define Azure Developer CLI hooks for provisioning and environment variable setup via scripts, enabling one-command resource provisioning for Azure OpenAI demos.Code cleanup:
chat_langchain.pyscript, which previously handled Azure integration differently, to streamline and unify model usage patterns.Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test