Skip to content

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

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

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

1 participant