Skip to content

feat(genai): add ToolFunctionCallingConfigWithText sample and standarize ToolFunctionDescriptionWithText sample - #10314

Open
Kef131 wants to merge 2 commits into
mainfrom
feat(genai)_add_function_calling_get_weather
Open

feat(genai): add ToolFunctionCallingConfigWithText sample and standarize ToolFunctionDescriptionWithText sample#10314
Kef131 wants to merge 2 commits into
mainfrom
feat(genai)_add_function_calling_get_weather

Conversation

@Kef131

@Kef131 Kef131 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #
b/530303154

  • Standardized ToolFunctionDescriptionWithText.java to use the get_current_weather function declaration for consistency across SDK samples.
  • Created ToolFunctionCallingConfigWithText.java to demonstrate using FunctionCallingConfig (mode ANY with allowedFunctionNames) for forced function calling with the Google Gen AI SDK (google-genai).
  • Updated ToolsIT.java to include unit test coverage for the new and updated samples.

Checklist

  • I have followed Sample Format Guide
  • pom.xml parent set to latest shared-configuration
  • Appropriate changes to README are included in PR
  • 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)
  • Tests pass: mvn clean verify required
  • Lint passes: mvn -P lint checkstyle:check required
  • Static Analysis: mvn -P lint clean compile pmd:cpd-check spotbugs:check advisory only
  • 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 24, 2026

@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 code sample, ToolFunctionCallingConfigWithText.java, to demonstrate forcing a specific function call using ToolConfig. It also updates ToolFunctionDescriptionWithText.java to use a simpler weather-based function calling example instead of the album sales example, and updates the integration tests accordingly. The feedback suggests improving the schema definition in the new sample by explicitly marking fields as required to ensure consistent structured output from the model.

@Kef131 Kef131 changed the title feat: add ToolFunctionCallingConfigWithText sample and update ToolFun… feat(genai): add ToolFunctionCallingConfigWithText sample and standarize ToolFunctionDescriptionWithText sample Jul 24, 2026
@Kef131 Kef131 self-assigned this Jul 27, 2026
@Kef131 Kef131 added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 27, 2026
@kokoro-team kokoro-team removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 27, 2026

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

LGTM!

@Kef131
Kef131 marked this pull request as ready for review July 27, 2026 21:46
@Kef131
Kef131 requested review from a team and yoshi-approver as code owners July 27, 2026 21:46
@snippet-bot

snippet-bot Bot commented Jul 27, 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

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.

3 participants