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

Gemini Code execution doesn't work in Typescript #189

Closed
olasunkanmi-SE opened this issue Jun 30, 2024 · 1 comment · Fixed by #191
Closed

Gemini Code execution doesn't work in Typescript #189

olasunkanmi-SE opened this issue Jun 30, 2024 · 1 comment · Fixed by #191
Assignees
Labels
component:js sdk Issue/PR related to JavaScript SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working

Comments

@olasunkanmi-SE
Copy link

olasunkanmi-SE commented Jun 30, 2024

Description of the bug:

tools: [{codeExecution: {}},
When I checked the package, I saw that the CodeExcutionTool interface is declared, which includes the codeExecution data type.
export declare interface CodeExecutionTool { codeExecution: {}; }
But this CodeExecutionTool is never used. I am using the Generative-ai 0.14.0 package which I believe is the latest one.

Actual vs expected behavior:

The dataType for tools is FunctionDeclarationsTool which doesn't include tools.
Expected behavior: The type declaration for tools should include CodeExecutionTool.

Any other information you'd like to share?

The error message suggests that the objects in the array do not have any properties in common with the type FunctionDeclarationsTool. However, upon inspection, it appears that the objects in the array have a different structure than the expected type. Specifically, the objects in the array have a property codeExecution with an empty object {} as its value, whereas the expected type FunctionDeclarationsTool has a different structure.

@singhniraj08 singhniraj08 added type:bug Something isn't working status:triaged Issue/PR triaged to the corresponding sub-team component:js sdk Issue/PR related to JavaScript SDK labels Jul 1, 2024
@hsubox76
Copy link
Collaborator

hsubox76 commented Jul 1, 2024

It sounds like we forgot to update Tool to add CodeExecutionTool as a union member: https://github.com/google-gemini/generative-ai-js/blob/main/packages/main/types/requests.ts#L196 Will fix.

Note: This is a Typescript issue only. Code execution should still work fine if you @ts-ignore the line, or don't use Typescript.

@hsubox76 hsubox76 changed the title Gemini Code execution doesn't work in NodeJS Gemini Code execution doesn't work in Typescript Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:js sdk Issue/PR related to JavaScript SDK status:triaged Issue/PR triaged to the corresponding sub-team type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants