Skip to content

Commit 651e17d

Browse files
committed
feat(models): Support OpenAI Responses API labs model
Add OpenAI and Azure OpenAI Responses API labs LLM implementations with request conversion, response parsing, streaming support, reasoning metadata, function calls, usage metadata. Fixes: #3209
1 parent 4366cca commit 651e17d

6 files changed

Lines changed: 2495 additions & 7 deletions

File tree

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ optional-dependencies.extensions = [
145145
"llama-index-embeddings-google-genai>=0.3",
146146
"llama-index-readers-file>=0.4",
147147
"lxml>=5.3",
148+
"openai>=2.20.0,<3.0.0",
148149
"pypika>=0.50",
149150
"toolbox-adk>=1,<2",
150151
]
@@ -207,7 +208,7 @@ optional-dependencies.test = [
207208
"litellm>=1.83.7,<=1.83.14",
208209
"llama-index-readers-file>=0.4",
209210
"mcp>=1.24,<2",
210-
"openai>=1.100.2",
211+
"openai>=2.20.0,<3.0.0",
211212
"opentelemetry-exporter-gcp-logging>=1.9.0a0,<=1.12.0a0",
212213
"opentelemetry-exporter-gcp-monitoring>=1.9.0a0,<2",
213214
"opentelemetry-exporter-gcp-trace>=1.9,<2",

src/google/adk/flows/llm_flows/contents.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,24 @@ async def run_async(
5252
):
5353
preserve_function_call_ids = True
5454
else:
55-
# Anthropic pairs tool_use/tool_result by id, so `adk-*` fallback
56-
# ids must survive replay.
55+
# Some non-Gemini providers pair tool calls/results by id, so `adk-*`
56+
# fallback ids must survive replay.
5757
try:
5858
from ...models.anthropic_llm import AnthropicLlm
5959
except (ImportError, OSError):
6060
AnthropicLlm = None
61+
try:
62+
from ...labs.openai_responses import OpenAIResponsesLlm
63+
except (ImportError, OSError):
64+
OpenAIResponsesLlm = None
6165
if AnthropicLlm is not None and isinstance(
6266
canonical_model, AnthropicLlm
6367
):
6468
preserve_function_call_ids = True
69+
if OpenAIResponsesLlm is not None and isinstance(
70+
canonical_model, OpenAIResponsesLlm
71+
):
72+
preserve_function_call_ids = True
6573

6674
# Preserve all contents that were added by instruction processor
6775
# (since llm_request.contents will be completely reassigned below)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from ._openai_responses_llm import AzureOpenAIResponsesLlm
16+
from ._openai_responses_llm import OpenAIResponsesLlm
17+
18+
__all__ = [
19+
'AzureOpenAIResponsesLlm',
20+
'OpenAIResponsesLlm',
21+
]

0 commit comments

Comments
 (0)