Skip to content

feat: support Gemini models#127

Open
sonleoracle wants to merge 5 commits intomainfrom
feat-gemini-support
Open

feat: support Gemini models#127
sonleoracle wants to merge 5 commits intomainfrom
feat-gemini-support

Conversation

@sonleoracle
Copy link
Member

@sonleoracle sonleoracle commented Mar 10, 2026

Add Agent Spec definitions for Gemini LLMs. We support Gemini models on Google AI Studio and Google Cloud Vertex AI as providers.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 10, 2026
@dhilloulinoracle
Copy link
Contributor

Internal regression succeeded 🍏: Build ID #370

@sonleoracle sonleoracle force-pushed the feat-gemini-support branch from 71c2a66 to dba744d Compare March 11, 2026 09:23
@dhilloulinoracle
Copy link
Contributor

Internal regression succeeded 🍏: Build ID #371

@sonleoracle sonleoracle force-pushed the feat-gemini-support branch 2 times, most recently from b8301b2 to 8972673 Compare March 11, 2026 15:05
@sonleoracle sonleoracle marked this pull request as ready for review March 11, 2026 15:15
@sonleoracle sonleoracle requested review from a team, cesarebernardis, dhilloulinoracle, jschweiz and paul-cayet and removed request for jschweiz March 11, 2026 15:15
@sonleoracle sonleoracle force-pushed the feat-gemini-support branch 3 times, most recently from 366b14b to 0159d0c Compare March 23, 2026 16:29
@dhilloulinoracle
Copy link
Contributor

Internal regression succeeded 🍏: Build ID #385

Copy link
Member

@paul-cayet paul-cayet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval conditional to using only leaf sensitive fields, not setting the entire component as sensitive

@sonleoracle sonleoracle force-pushed the feat-gemini-support branch from 0159d0c to a865490 Compare March 24, 2026 08:24
@sonleoracle
Copy link
Member Author

Approval conditional to using only leaf sensitive fields, not setting the entire component as sensitive

auth field is not sensitive anymore, and GeminiAuthConfig and its two child classes are now Agent Spec components with leaf sensitive fields

@dhilloulinoracle
Copy link
Contributor

Internal regression succeeded 🍏: Build ID #387


See `Google Cloud authentication docs <https://cloud.google.com/docs/authentication/application-default-credentials>`_
and `GeminiCLI <https://geminicli.com/docs/get-started/authentication/#b-vertex-ai---service-account-json-key>`_ docs for more details.
When ``credentials`` is omitted and ADC is used instead, the auth component may remain
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be updated. The auth component is used in GeminiConfig.auth, and it is not sensitive, so it will not be omitted. GeminiVertexAIAuthConfig.credentials instead is marked as sensitive, so it will always be omitted. I think that conditional omission is not an option at the moment.

| StreamableHTTPmTLSTransport | ca_file |
+----------------------------------+--------------------+

For Gemini auth components, only the sensitive leaf field is externalized.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to specify this, it's the same behavior as all the others.

llm = GeminiConfig(
name="gemini-aistudio-flash",
model_id="gemini-2.5-flash",
# Optional: if omitted, runtimes may load GEMINI_API_KEY from the environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this makes it look like auth is optional, while I guess you are referring to the GeminiAIStudioAuthConfig.api_key. Make it explicit in the comment, or change the indentation so that this comment ends up inside the GeminiAIStudioAuthConfig definition.

llm = GeminiConfig(
name="gemini-aistudio-flash",
model_id="gemini-2.5-flash",
# Optional: if omitted, runtimes may load GEMINI_API_KEY from the environment.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Name of the model to use, for example ``gemini-2.5-flash`` or
``gemini-2.0-flash-lite``.

.. option:: auth: GeminiAIStudioAuthConfig | GeminiVertexAIAuthConfig
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the right parent class


Default parameters for text generation with this model.

AI Studio authentication
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Gemini AI Studio authentication or Google ...

the Gemini service to use.

Meanwhile, the Vertex AI service can be authenticated with Google Cloud credentials. These credentials can be provided with a `service account JSON key <https://docs.cloud.google.com/iam/docs/keys-create-delete/>`_
either inline or through a local file path. When omitted, runtimes may rely on Google Application Default Credentials (ADC), such as
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you be more precise? I guess that if credentials is a string, then it is supposed to be a file path, and when it is a dictionary, then it's the JSON, but I am not fully sure from this description. Please make it a bit clearer.

"model_id": "gemini-2.0-flash-lite",
"auth": {
"component_type": "GeminiVertexAIAuthConfig",
"id": "gemini-vertex-auth-id",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reuse the constants

"vertex_ai/gemini-2.0-flash-lite",
],
)
def test_geminiconfig_preserves_prefixed_model_id(model_id: str) -> None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_geminiconfig_preserves_prefixed_model_id(model_id: str) -> None:
def test_gemini_config_preserves_prefixed_model_id(model_id: str) -> None:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants