Commit 3d70b80
committed
feat(models): add OCI Generative AI provider for Google Gemini on OCI
Adds first-class support for Google Gemini models hosted on Oracle Cloud
Infrastructure (OCI) Generative AI service — a native Google × OCI model
partnership that makes Gemini available directly through OCI's inference
endpoints.
Key design points:
- Subclasses BaseLlm following the anthropic_llm.py pattern
- Uses the OCI Python SDK directly (no LangChain dependency)
- Optional dependency: pip install google-adk[oci]
- Supports API_KEY, INSTANCE_PRINCIPAL, and RESOURCE_PRINCIPAL auth
- Both non-streaming (_call_oci) and streaming (_call_oci_stream) paths
share setup code via _build_chat_details(); streaming collects OCI's
OpenAI-compatible SSE events in a thread pool (asyncio.to_thread) and
yields partial then final LlmResponse
- Registers google.gemini-* (and other OCI-hosted) model patterns in
LLMRegistry via optional try/except in models/__init__.py
- 37 unit tests (fully mocked, no OCI account needed)
- 10 integration tests (skipped when OCI_COMPARTMENT_ID is unset)
Supported models: google.gemini-*, google.gemma-*, meta.llama-*,
mistralai.*, xai.grok-*, nvidia.*1 parent abcf14c commit 3d70b80
File tree
5 files changed
+1597
-0
lines changed- src/google/adk/models
- tests
- integration/models
- unittests/models
5 files changed
+1597
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
| 179 | + | |
| 180 | + | |
179 | 181 | | |
180 | 182 | | |
181 | 183 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
0 commit comments