Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tooling] Tools fail if defined without arguments #814

Closed
Yorkemartin opened this issue Aug 22, 2024 · 1 comment
Closed

[Tooling] Tools fail if defined without arguments #814

Yorkemartin opened this issue Aug 22, 2024 · 1 comment
Labels
bug Something isn't working tooling

Comments

@Yorkemartin
Copy link

Yorkemartin commented Aug 22, 2024

Describe the bug

I have a simple tool that returns some data from a database. It does not need an argument. As a result of not having an argument, it fails in ways that are hard to debug.

When invoking the tool directly in the dev ui, it works appropriately.

However, when used in a flow. the tool (with no input schema) errors with:

INVALID_ARGUMENT: Schema validation failed. Parse Errors: - tools.2.inputSchema: must be object

with z.object({}), it errors in the flow and direct invocation with:

  • flow:
    [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent: [400 Bad Request] * GenerateContentRequest.tools[0].function_declarations[2].parameters.properties: should be non-empty for OBJECT type

  • tool:
    `TRPCClientError: INVALID_ARGUMENT: Schema validation failed. Parse Errors:

  • (root): must be object`

with z.any() the tool works, and returns a populated object, but the flow errors with

Cannot read properties of undefined (reading 'toUpperCase') TypeError: Cannot read properties of undefined (reading 'toUpperCase') at convertSchemaProperty (/Users/connor/fora-echo/node_modules/@genkit-ai/googleai/lib/gemini.js:234:78)

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • mac OS: 14.4 (23E214)
@Yorkemartin Yorkemartin added bug Something isn't working tooling labels Aug 22, 2024
@Yorkemartin Yorkemartin changed the title [Tooling] Tools fail with input schemas undefined, defined as empty objects, or as z.any(). [Tooling] Tools fail if defined without arguments Aug 22, 2024
@mbleigh
Copy link
Collaborator

mbleigh commented Aug 27, 2024

This has been fixed in #822, but it's currently in our branch for the next major release of Genkit so it may be a little time before it hits a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tooling
Projects
Status: Done
Development

No branches or pull requests

2 participants