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

fix: gemini empty content #1425

Merged
merged 3 commits into from
Feb 27, 2025
Merged

fix: gemini empty content #1425

merged 3 commits into from
Feb 27, 2025

Conversation

yingjiehe-xyz
Copy link
Collaborator

fix #1359
In our tool call, the response may be empty, like running command touch xxx, in such case, gemini will return the error about empty content part. Fix it by setting default content.
Also gemini requires the number of function response parts should be equal to number of function call parts of the function call turn, sometime the tool response can have multiple content part, we need to combine them into one content

Before:

( O)> create a test.txt file under the dir

─── shell | developer ──────────────────────────
command: touch test.txt


◇  Goose would like to call the above tool, do you approve?
│  Yes 
│

◐  Enchanting electrons...                                                                                                            2025-02-27T18:24:55.244805Z ERROR goose::agents::truncate: Error: Request failed: Request failed with status: 400 Bad Request. Message: * GenerateContentRequest.contents[6].parts: contents.parts must not be empty.

    at crates/goose/src/agents/truncate.rs:375

Ran into this error: Request failed: Request failed with status: 400 Bad Request. Message: * GenerateContentRequest.contents[6].part
s: contents.parts must not be empty.
.

Please retry if you think this is a transient or recoverable error.

After:

( O)> create a test.txt file under the dir

─── shell | developer ──────────────────────────
command: touch test.txt


◇  Goose would like to call the above tool, do you approve?
│  Yes 
│

I have created an empty file named `test.txt` in the current directory.

Copy link
Collaborator

@wendytang wendytang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@yingjiehe-xyz yingjiehe-xyz merged commit 6d28f44 into main Feb 27, 2025
6 checks passed
@yingjiehe-xyz yingjiehe-xyz deleted the yingjiehe/gemini branch February 27, 2025 23:58
@haydenth
Copy link

haydenth commented Mar 2, 2025

Thank you for fixing this! Much appreciated by this user!!

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.

ERROR goose::agents::truncate: Error: Request failed: Request failed with status: 400 Bad Request
3 participants