Skip to content

docs(examples/openai): add OpenAI model integration sample - #1184

Merged
hanorik merged 1 commit into
openai_supportfrom
wolo/openai-sample
Jul 23, 2026
Merged

hanorik merged 1 commit into
openai_supportfrom
wolo/openai-sample

Conversation

@wolo-lab

Copy link
Copy Markdown
Contributor

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-go
has had no equivalent sample.

Summary

Adds examples/openai/ — a runnable sample (README + code) built on #1178:

  • An llmagent backed by openaimodel.NewModel(...) instead of Gemini. Agents,
    the functiontool, the runner, and the launcher are identical to the Gemini
    quickstart — the model constructor is the only difference, which is the point
    the sample makes.
  • Registers a get_weather function tool to exercise OpenAI tool calling
    end-to-end.
  • Defaults to gpt-4o-mini (override with OPENAI_MODEL), reads
    OPENAI_API_KEY, and supports OpenAI-compatible endpoints (Ollama, LM Studio,
    vLLM, …) via OPENAI_BASE_URL.
  • README follows the examples/workflow sample layout: concept, goal, config
    table, run instructions, example session, and a note on the unsupported
    GenerateContentConfig knobs.

@wolo-lab
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
wolo-lab force-pushed the wolo/openai-sample branch from 04efc5a to 1bbca19 Compare July 22, 2026 07:45
@hanorik
hanorik force-pushed the openai_support branch 2 times, most recently from 8093c15 to fa55691 Compare July 22, 2026 12:51
@wolo-lab
wolo-lab requested a review from hanorik July 22, 2026 22:24
@hanorik
hanorik merged commit 934d052 into openai_support Jul 23, 2026
1 check passed
@wolo-lab
wolo-lab deleted the wolo/openai-sample branch July 23, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants