Migrate from Chat Completions to Responses API#358
Open
Conversation
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
This PR migrates the OpenAI API usage from the legacy Chat Completions API to the unified Responses API.
Changes
Client Migration
AsyncAzureOpenAI→AsyncOpenAIbase_urlwith/openai/v1path instead of deprecatedazure_endpointazure_ad_token_provider→api_key(token provider still works)api_versionparameter (no longer needed for Responses API)API Call Migration
chat.completions.create()→responses.create()messages→inputwith structured content itemstype: "input_text"type: "output_text"store=Falseto avoid server-side state retentionStreaming Events
ChatCompletionChunkwithchoices[0].delta.contentresponse.output_text.deltaandresponse.completedeventsInfrastructure Cleanup
Removed
AZURE_OPENAI_API_VERSIONfrom:infra/aca.bicepinfra/main.bicepinfra/main.parameters.json.github/workflows/azure-dev.yamlDependencies
openai>=1.108.1inpyproject.tomlrequirements.txt(now uses openai 2.16.0)Tests
Files Changed (11)
src/quartapp/chat.pysrc/pyproject.tomlsrc/requirements.txttests/conftest.pytests/test_app.pytests/snapshots/*infra/aca.bicepinfra/main.bicepinfra/main.parameters.json.github/workflows/azure-dev.yamlTesting