Skip to content
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

feat: add custom params to VertexAIGeminiGenerator and VertexAIGeminiChatGenerator #1100

Merged
merged 7 commits into from
Sep 26, 2024

Conversation

Amnah199
Copy link
Contributor

@Amnah199 Amnah199 commented Sep 24, 2024

Related Issues

Proposed Changes:

  • Adds tool_config and system_instruction parameters to be passed to the model.
  • Revised the way, all parameters are passed to the the GenerativeModel (marked in comments).

How did you test it?

  • Updated the unit tests
  • Did manual testing

Notes for the reviewer

Checklist

@github-actions github-actions bot added integration:google-vertex type:documentation Improvements or additions to documentation labels Sep 24, 2024
Comment on lines +106 to +112
self._model = GenerativeModel(
self._model_name,
generation_config=self._generation_config,
safety_settings=self._safety_settings,
tools=self._tools,
tool_config=self._tool_config,
system_instruction=self._system_instruction,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially, we were passing tools and other parameters directly in the generate_content method. However, these can be passed during model initialization instead, which simplifies parameter handling. See the reference here. This approach simplifies the API's requirement that system_instruction can only be passed during model initialization.

@Amnah199 Amnah199 marked this pull request as ready for review September 26, 2024 10:43
@Amnah199 Amnah199 requested a review from a team as a code owner September 26, 2024 10:43
@Amnah199 Amnah199 requested review from julian-risch and removed request for a team September 26, 2024 10:43
Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

Looks quite good to me already. There is one if/else that we can simplify in Generator and ChatGenerator.

Copy link
Member

@julian-risch julian-risch left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

@Amnah199 Amnah199 merged commit 46bc945 into main Sep 26, 2024
16 checks passed
@Amnah199 Amnah199 deleted the vertexai-custom-params branch September 26, 2024 14:46
Amnah199 added a commit that referenced this pull request Oct 2, 2024
…ChatGenerator (#1100)

* Added "tool_config" and "system_instruction" params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration:google-vertex type:documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VertexAI Generator: Custom Parameters
2 participants