Skip to content

fix(docs): update go quickstart tests and container version - #3860

Draft
camposperez-hub wants to merge 2 commits into
mainfrom
fix/go-quickstart-tests
Draft

fix(docs): update go quickstart tests and container version#3860
camposperez-hub wants to merge 2 commits into
mainfrom
fix/go-quickstart-tests

Conversation

@camposperez-hub

Copy link
Copy Markdown
Collaborator

Description

  • Updates the Go CI test container image from golang:1.25.7 to golang:1.25.8 in integration Cloud Build configs to match root go.mod.
  • Updates genAI and genkit Go quickstart samples to use gemini-3.6-flash and RoleUser (resolving 404 model deprecation and 400 role validation errors).
  • Temporarily skips the langchain Go quickstart test in .ci/sample_tests/run_tests.sh due to upstream tmc/langchaingo missing support for thought_signature on Gemini 3+ (How to write mysql-sql statement with optional parameters (required: false)? #1464).
  • Adds a warning notice to the LangChain Go tab in local_quickstart_go.md noting that the sample code is currently untested with active Google AI models.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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...))...),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

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.

Suggested change
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"))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

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.

Suggested change
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"))

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant