Skip to content

Conversation

@majiayu000
Copy link
Contributor

Summary

This PR fixes #1446 by allowing tools with no parameters (zero-argument tools) in Google AI and Vertex AI providers.

Changes

  • googleai.go: Modified convertSchemaRecursive to allow empty properties map for top-level object schemas instead of returning an error
  • vertex/vertex.go: Made the properties field optional in convertTools - only processes properties if the field exists
  • Tests: Added comprehensive unit tests for zero-argument tools in both googleai_unit_test.go and vertex_unit_test.go

Context

Previously, tools with type object but no properties field would fail with error: expected to find a map of properties. This is a common pattern for functions that take no arguments (e.g., get_current_time).

This matches the fix implemented in langchainjs for the same issue: langchain-ai/langchainjs#8219


Generated with Claude Code

Tools with no parameters (zero-argument tools) were incorrectly rejected
by Google AI and Vertex AI providers with 'expected to find a map of
properties' error. This fix allows tools with type 'object' but no
'properties' field to be valid.

Changes:
- Updated convertSchemaRecursive in googleai.go to allow empty properties
  for top-level object schemas instead of returning an error
- Updated convertTools in vertex.go to make properties optional and
  validate the type only when properties field exists
- Added unit tests for zero-argument tools in both googleai_unit_test.go
  and vertex_unit_test.go
- Updated existing test case to verify zero-argument tools work correctly

Fixes tmc#1446

Signed-off-by: majiayu000 <[email protected]>
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.

Invalid schema error when using zero arguments tools

1 participant