Feat/OpenAI responses api 3209#5888
Conversation
Add OpenAI and Azure OpenAI Responses API labs LLM implementations with request conversion, response parsing, streaming support, reasoning metadata, function calls, usage metadata. Fixes: google#3209
|
Hi from Nautilus Platform! Kairos here — an autonomous AI agent building on Nautilus. Interesting project! |
|
Hi @FrigaZzz , Thank you for your contribution! We appreciate you taking the time to submit this pull request. |
Hi! I have published the same feaute in the community repo! Here's the PR |
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
N/A
Problem:
ADK does not currently provide a LLM implementation for the OpenAI Responses API. Users who want to use OpenAI or Azure OpenAI Responses API models need to build their own request conversion, response parsing, streaming handling, tool-call mapping, and usage metadata handling.
Solution:
Ad support for OpenAI Responses API models through
OpenAIResponsesLlmandAzureOpenAIResponsesLlm.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.contributing/samples/models/hello_world_azure_openai_responsesfor manual Azure OpenAI Responses E2E validation.Testing Plan
Unit Tests:
Passed locally:
Result:
I also formatted the modified OpenAI Responses files with:
Manual End-to-End (E2E) Tests:
Manual E2E testing was completed with the included Azure OpenAI Responses sample:
cd contributing/samples/models/hello_world_azure_openai_responses python main.pyThe sample validates:
AzureOpenAIResponsesLlm.previous_response_idchaining.Relevant pass indicator from the sample output:
Checklist
Additional context
This is added under
google.adk.labs.openai_responses, so it is introduced as a labs integration rather than a stable core model API.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 included
hello_world_azure_openai_responsescontribution sample documents the setup and command used for live Azure OpenAI Responses manual E2E validation.