fix(docs): update go quickstart tests and container version - #3860
fix(docs): update go quickstart tests and container version#3860camposperez-hub wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates Go integration tests to use Go 1.25.8, bumps default models to Gemini 3.6-flash, and temporarily disables LangChain Go tests due to incompatibility with Gemini 3+ models. Review feedback identifies a bug in the Genkit quickstart where passing nil to ai.NewMessage and changing the role to ai.RoleUser causes issues, and recommends reverting the LangChain model bump to Gemini 3.6-flash because the library lacks support for the thought_signature required by Gemini 3+.
| if len(parts) > 0 { | ||
| resp, err := genkit.Generate(ctx, g, | ||
| ai.WithMessages(append(response.History(), ai.NewMessage(ai.RoleTool, nil, parts...))...), | ||
| ai.WithMessages(append(response.History(), ai.NewMessage(ai.RoleUser, nil, parts...))...), |
There was a problem hiding this comment.
The inclusion of nil as an argument in ai.NewMessage is a bug. In the Genkit Go SDK, ai.NewMessage takes (role Role, parts ...*Part). Passing nil as the second argument inserts a nil part at the beginning of the message's parts slice, which can cause a nil pointer dereference or lead to API validation errors (such as the 400 error encountered).
Additionally, the correct role for tool/function responses in Genkit is ai.RoleTool, not ai.RoleUser. The underlying adapter/plugin handles mapping this to the correct API-specific role. Removing the nil argument and reverting the role to ai.RoleTool resolves the issue cleanly.
| ai.WithMessages(append(response.History(), ai.NewMessage(ai.RoleUser, nil, parts...))...), | |
| ai.WithMessages(append(response.History(), ai.NewMessage(ai.RoleTool, parts...))...), |
|
|
||
| // Initialize the Google AI client (LLM). | ||
| llm, err := googleai.New(ctx, googleai.WithAPIKey(genaiKey), googleai.WithDefaultModel("gemini-2.0-flash")) | ||
| llm, err := googleai.New(ctx, googleai.WithAPIKey(genaiKey), googleai.WithDefaultModel("gemini-3.6-flash")) |
There was a problem hiding this comment.
Upgrading the LangChain quickstart to gemini-3.6-flash breaks the sample code for users because tmc/langchaingo does not yet support the thought_signature returned by Gemini 3+ models. Since gemini-2.0-flash is fully active, supported, and compatible with langchaingo, keeping the model as gemini-2.0-flash ensures that the quickstart remains functional for local developers without requiring warnings or skipping tests.
| llm, err := googleai.New(ctx, googleai.WithAPIKey(genaiKey), googleai.WithDefaultModel("gemini-3.6-flash")) | |
| llm, err := googleai.New(ctx, googleai.WithAPIKey(genaiKey), googleai.WithDefaultModel("gemini-2.0-flash")) |
Description
golang:1.25.7togolang:1.25.8in integration Cloud Build configs to match rootgo.mod.genAIandgenkitGo quickstart samples to usegemini-3.6-flashandRoleUser(resolving 404 model deprecation and 400 role validation errors).langchainGo quickstart test in.ci/sample_tests/run_tests.shdue to upstreamtmc/langchaingomissing support forthought_signatureon Gemini 3+ (How to write mysql-sql statement with optional parameters (required: false)? #1464).local_quickstart_go.mdnoting that the sample code is currently untested with active Google AI models.