Commit 1bd8b7f
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 c87ee1e commit 1bd8b7f
5 files changed
Lines changed: 1600 additions & 0 deletions
File tree
- src/google/adk/models
- tests
- integration/models
- unittests/models
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
| 133 | + | |
133 | 134 | | |
134 | 135 | | |
135 | 136 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
44 | 46 | | |
45 | 47 | | |
46 | 48 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
81 | 95 | | |
82 | 96 | | |
83 | 97 | | |
| |||
0 commit comments