Skip to content

feature/ introduce new model - gemini #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

oryandrive
Copy link

Description

Introduce support for the new Model - Gemini

Related Issues

[Link to related issues using #issue-number format]

Documentation PR

[Link to related associated PR in the agent-docs repo]

Type of Change

  • New feature

Testing

  • add integration tests and unit tests for the model
  • hatch fmt --linter
  • hatch fmt --formatter
  • hatch test --all
  • Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

Checklist

  • I have read the CONTRIBUTING document
  • I have added tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@oryandrive oryandrive requested a review from a team as a code owner May 17, 2025 11:25
Added integration tests and unit tests for the Gemini model.
@oryandrive oryandrive force-pushed the feature/add-support-for-gemini-model branch from 7532e4a to e8dc892 Compare May 17, 2025 11:29
@pgrayy
Copy link
Member

pgrayy commented May 19, 2025

Thank you so much for the contribution. We are going to start some testing on our end.

@oryandrive
Copy link
Author

Hey team, thanks! Please let me know if I can help with anything to push that forward. @pgrayy

@ainayves
Copy link

waiting for this to be merged 🤓🥳

@zastrowm zastrowm mentioned this pull request Jun 10, 2025
6 tasks
@ryanycoleman ryanycoleman moved this to Researching in Strands Agents Roadmap Jun 12, 2025
@ryanycoleman ryanycoleman moved this from Researching to Coming Soon in Strands Agents Roadmap Jun 12, 2025
@Unshure Unshure self-requested a review June 19, 2025 15:12
@Unshure Unshure self-assigned this Jun 19, 2025
Copy link
Member

@Unshure Unshure left a comment

Choose a reason for hiding this comment

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

Sorry for the delayed response here, I've gotten a chance to take a look at this pull request. While testing locally, it looks like the original package https://pypi.org/project/google-generativeai/ is now deprecated in favor of https://pypi.org/project/google-genai/. Can you update the dependency introduced in this PR, and rebase it to the latest SDK changes?

class GeminiModel(Model):
"""Google Gemini model provider implementation."""

EVENT_TYPES = {
Copy link
Member

Choose a reason for hiding this comment

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

These are unused, please remove.

"message_stop",
}

OVERFLOW_MESSAGES = {
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 share where these are documented?


client_args = client_args or {}
genai.client.configure(**client_args)
self.model = genai.GenerativeModel(self.config["model_id"])
Copy link
Member

Choose a reason for hiding this comment

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

Should this genai.GenerativeModel be passed in instead of the model_id? Does it make sense for this to be configurable?

"""
return self.config

def _format_request_message_content(self, content: ContentBlock) -> dict[str, Any]:
Copy link
Member

Choose a reason for hiding this comment

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

ContentBlock has more types like "ToolUse", "ToolResult", "ReasoningContent", and a few other modes. Should this be updated?

}

@override
def format_chunk(self, event: dict[str, Any]) -> StreamEvent:
Copy link
Member

Choose a reason for hiding this comment

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

In case gemini returns a streamed response following OpenAI's response stream, you can extend our OpenAI interface to help simplify the logic in this implementation:

class OpenAIModel(Model, abc.ABC):

@awsarron awsarron assigned JackYPCOnline and unassigned Unshure Jul 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Coming Soon
Development

Successfully merging this pull request may close these issues.

6 participants