Skip to content

feat(genai): Add function calling config sample#5613

Merged
amcolin merged 3 commits into
GoogleCloudPlatform:mainfrom
amcolin:migrate-function-calling-advanced
Jul 17, 2026
Merged

feat(genai): Add function calling config sample#5613
amcolin merged 3 commits into
GoogleCloudPlatform:mainfrom
amcolin:migrate-function-calling-advanced

Conversation

@amcolin

@amcolin amcolin commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Description

implemented a new sample that migrate existing logic to the genai library, ensuring full alignment with the provided other language examples. https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/models/function-calling.md#advanced-use

Fixes Internal b/527541512

Checklist

  • I have followed Contributing Guidelines from CONTRIBUTING.MD
  • Tests pass: go test -v ./.. (see Testing)
  • Code formatted: gofmt (see Formatting)
  • Vetting pass: go vet (see Formatting)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

@product-auto-label product-auto-label Bot added the samples Issues that are directly related to samples. label Jul 2, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@amcolin
amcolin force-pushed the migrate-function-calling-advanced branch from 6059f3d to 117c504 Compare July 2, 2026 19:11
@amcolin

amcolin commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 introduces a new example demonstrating how to configure Gemini function calling using genai.FunctionCallingConfig, along with a corresponding test case. The review feedback suggests adding region tags for documentation, correcting several typos in variable names, descriptions, and error messages, and ensuring all output is written to the provided io.Writer instead of standard output for better testability.

Comment thread genai/tools/tools_func_calling_config.go Outdated
Comment thread genai/tools/tools_func_calling_config.go Outdated
Comment thread genai/tools/tools_func_calling_config.go Outdated
Comment thread genai/tools/tools_func_calling_config.go Outdated
Comment thread genai/tools/tools_func_calling_config.go Outdated
Comment thread genai/tools/tools_func_calling_config.go Outdated
Comment thread genai/tools/tools_func_calling_config.go Outdated
Comment thread genai/tools/tools_func_calling_config.go
@amcolin
amcolin force-pushed the migrate-function-calling-advanced branch 2 times, most recently from e8583aa to cd98356 Compare July 2, 2026 20:10
@amcolin

amcolin commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

/gemini review

@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 introduces a new example demonstrating how to configure function calling with the Gemini model. Specifically, it adds genai/tools/tools_func_calling_config.go containing the generateWithFuncCallConfig function, which sets up a function declaration and restricts the model to only use that function using FunctionCallingConfig. Additionally, a corresponding unit test has been added to genai/tools/tools_examples_test.go to verify the behavior. I have no feedback to provide.

@Kef131 Kef131 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.

Great sample, it is consistent with others samples

@amcolin
amcolin marked this pull request as ready for review July 3, 2026 18:54
@amcolin
amcolin requested review from a team as code owners July 3, 2026 18:54
@snippet-bot

snippet-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Comment thread genai/tools/tools_func_calling_config.go
Comment thread genai/tools/tools_func_calling_config.go Outdated
Comment thread genai/tools/tools_func_calling_config.go Outdated
@amcolin
amcolin force-pushed the migrate-function-calling-advanced branch from 6d23394 to a59985c Compare July 11, 2026 01:32
@amcolin
amcolin force-pushed the migrate-function-calling-advanced branch from a59985c to b0dc66b Compare July 11, 2026 01:33
@amcolin
amcolin requested a review from grayside July 13, 2026 15:58
@anksena
anksena self-requested a review July 17, 2026 18:02
@amcolin
amcolin removed the request for review from grayside July 17, 2026 18:03
@amcolin
amcolin merged commit b7594aa into GoogleCloudPlatform:main Jul 17, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants