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

functionResponse: Unable to submit request because it must have a text parameter. #316

Open
LaKing opened this issue Dec 29, 2024 · 1 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

Comments

@LaKing
Copy link

LaKing commented Dec 29, 2024

Description of the bug:

According to the documentation the results to the tool function calls should be submitted with the functionResponse, where response is a json object.

                              const submit = await chat.sendMessage([
                                    {
                                        functionResponse: {
                                            name,
                                            response: { content: "output" },
                                        },
                                    },
                                ]);

Here name is a valid string, and "output" is obviously a valid string. Therefore, I assume, this is a bug.
I have extensively looked up all documentation, examples, and this should work, .... but I'm unable to send back any results to the model.
I have tried this within the response stream, and also by collecting all results and sending them once the stream completed.

Error: [GoogleGenerativeAI Error]: 
Error fetching from https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash-exp:streamGenerateContent?alt=sse: 
[400 Bad Request] Unable to submit request because it must have a text parameter. 
Add a text parameter and try again. 
Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini
@gmKeshari gmKeshari 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 Dec 30, 2024
@randofan
Copy link

randofan commented Jan 7, 2025

I'm encountering the same issue with function calling. Running this as part of an express.js server, it works perfectly on localhost using the Firebase emulator, but this issue arises when deployed with Firebase functions. Once I see this error message, any subsequent messages (including non-function calls) result in the same error.

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

No branches or pull requests

3 participants