Skip to content

feat(go/plugins/googlegenai)!: use go-genai SDK configuration #2958

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 9 commits into
base: main
Choose a base branch
from

Conversation

hugoaguirre
Copy link
Contributor

@hugoaguirre hugoaguirre commented May 22, 2025

Remove the usage of googlegenai.GeminiConfig and use genai.GenerateContentConfig instead

Checklist (if applicable):

@github-actions github-actions bot added the go label May 22, 2025
@hugoaguirre hugoaguirre changed the title feat(go/plugins/googlegenai): use go-genai sdk configuration feat(go/plugins/googlegenai)!: use go-genai SDK configuration May 22, 2025
@hugoaguirre hugoaguirre marked this pull request as ready for review May 26, 2025 18:52
@hugoaguirre hugoaguirre requested a review from apascal07 May 26, 2025 18:52
Copy link
Collaborator

@apascal07 apascal07 left a comment

Choose a reason for hiding this comment

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

We were also going to add errors if certain config fields were set that are native Genkit features, no?

@@ -39,6 +40,9 @@ import (
"google.golang.org/genai"
)

// Plugin configuration alias
type GeminiConfig = genai.GenerateContentConfig
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think let's omit this for now because we would probably want aliases for all the types, not just the top level... at which point I'm not sure it's worth it.


// Genkit primitive fields must be used instead of go-genai fields
// i.e.: system prompt, tools, cached content, response schema, etc
if gcc.SystemInstruction != nil {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@apascal07, here's where we validate the user request message do not set Genkit native features. I've added:

  • System prompts
  • Tools (just for function declaration tools, but kept the ability to support Code Execution, Google Search and so on)
  • Cached contents
  • Response schema
  • Response mime type

@hugoaguirre hugoaguirre requested a review from apascal07 May 27, 2025 20:55
@hugoaguirre hugoaguirre force-pushed the haguirre/generic-config branch from f34a722 to 2202be9 Compare May 27, 2025 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants