feat(models): add Azure OpenAI Responses API support#149
Open
FrigaZzz wants to merge 2 commits into
Open
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Add OpenAI Responses API model adapters for the community package, including Azure OpenAI support through the OpenAI-compatible /openai/v1/responses endpoint. Also add the OpenAI optional dependency extra, model documentation, and unit coverage for request mapping, streaming, tool calls, metadata, and Azure client configuration.
Add community model adapters for the OpenAI Responses API, including Azure OpenAI support through the OpenAI-compatible /openai/v1/responses endpoint. The adapters convert ADK requests, content, tools, tool responses, generation config, streaming events, and response metadata to and from Responses API shapes. Also add the OpenAI optional dependency extra, unit coverage, package documentation, and an Azure OpenAI manual E2E sample under contributing/samples/models.
8cb1f4e to
4cfeb21
Compare
This was referenced May 29, 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.
Link to Issue
Problem:
google-adk-communitydoes not currently provide a model adapter for the OpenAI Responses API. Users who want to use OpenAI or Azure OpenAI Responses API models with ADK need to build their own request conversion, response parsing, streaming handling, tool-call mapping, and usage metadata handling.Solution:
Add support for OpenAI Responses API models through
OpenAIResponsesLlmandAzureOpenAIResponsesLlmundergoogle.adk_community.models.openai_responses.This change adds:
LlmRequestinto OpenAI Responses APIresponses.createparameters.LlmResponse, including text, function calls, reasoning parts, finish reasons, interaction IDs, model versions, and usage metadata./openai/v1/base URL.LlmResponse.custom_metadataviainclude_response_metadata.openaioptional dependency extra for installing the OpenAI SDK with the community package.contributing/samples/models/hello_world_azure_openai_responsesfor manual Azure OpenAI Responses E2E validation.Testing Plan
Unit Tests:
Targeted model tests:
uv run --native-tls --extra test --extra openai pytest tests/unittests/models/openai_responses -qResult:
CI-style unit test run using the
testextra:Result:
Full unit test run with all extras:
Result:
Build validation:
Result:
Formatting:
Sample import validation:
Result:
Manual End-to-End (E2E) Tests:
Manual live Azure OpenAI E2E testing can be run with the included sample:
cd contributing/samples/models/hello_world_azure_openai_responses python main.pyThe sample validates:
AzureOpenAIResponsesLlm.previous_response_idchaining.Manual live Azure OpenAI E2E output is not included here because it requires a live Azure OpenAI deployment. The Azure-specific client behavior is covered by isolated unit tests for client construction, including the
/openai/v1/base URL used by Azure OpenAI Responses API deployments.Checklist
Additional context
This contribution targets
google-adk-community, so the integration is added undergoogle.adk_community.models.openai_responsesinstead of the core ADK package.The targeted unit test suite covers request shape conversion, typed and mapping-based response parsing, function calls, reasoning metadata, usage metadata, streaming aggregation, failed stream handling, Azure base URL construction, and disabling response metadata in
custom_metadata.The
openaioptional extra allows users to install the OpenAI SDK dependency only when they need this model integration:pip install "google-adk-community[openai]"