docs(examples/openai): add OpenAI model integration sample - #1184
Merged
Merged
Conversation
wolo-lab
marked this pull request as ready for review
July 21, 2026 22:11
Adds a runnable example showing an ADK llmagent backed by the OpenAI model from #1178 (openaimodel.NewModel) instead of Gemini. The only difference from the Gemini quickstart is the model constructor; agents, the functiontool, the runner, and the launcher are unchanged. The sample registers a get_weather function tool to exercise OpenAI tool calling, defaults to gpt-4o-mini, and supports OpenAI-compatible endpoints via OPENAI_BASE_URL. A README follows the examples/workflow sample layout.
wolo-lab
force-pushed
the
wolo/openai-sample
branch
from
July 22, 2026 07:45
04efc5a to
1bbca19
Compare
hanorik
force-pushed
the
openai_support
branch
2 times, most recently
from
July 22, 2026 12:51
8093c15 to
fa55691
Compare
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.
Problem
adk-go gains native OpenAI model support in #1178, but there's no runnable
example showing how to use it. Every existing example (quickstart, tools,
multiagent, workflow) is wired to Gemini, so a newcomer has no reference for
plugging a non-Gemini model into an agent. adk-python documents this path via
the LiteLLM wrapper (
LlmAgent(model=LiteLlm(model="openai/gpt-4o"))); adk-gohas had no equivalent sample.
Summary
Adds
examples/openai/— a runnable sample (README + code) built on #1178:llmagentbacked byopenaimodel.NewModel(...)instead of Gemini. Agents,the
functiontool, the runner, and the launcher are identical to the Geminiquickstart — the model constructor is the only difference, which is the point
the sample makes.
get_weatherfunction tool to exercise OpenAI tool callingend-to-end.
gpt-4o-mini(override withOPENAI_MODEL), readsOPENAI_API_KEY, and supports OpenAI-compatible endpoints (Ollama, LM Studio,vLLM, …) via
OPENAI_BASE_URL.examples/workflowsample layout: concept, goal, configtable, run instructions, example session, and a note on the unsupported
GenerateContentConfigknobs.