-
Notifications
You must be signed in to change notification settings - Fork 312
Closed
Labels
component:js sdkIssue/PR related to JavaScript SDKIssue/PR related to JavaScript SDKp2status: awaiting user responseAwaiting a response from the authorAwaiting a response from the authortype:bugSomething isn't workingSomething isn't working
Description
Description of the bug:
Hi!
I've got quite a basic setup for this error, I'm using Vue.
[400] Unable to submit request because it has an empty text parameter. Add a value to the parameter and try again.Setup is as follows;
const model = getGenerativeModel(vertexAI, {
model: "gemini-1.5-flash",
});
const chat = reactive(
model.startChat({
history: [
{
role: "user",
parts: [{ text: "Hi, What is your current dataset?" }],
},
{
role: "model",
parts: [
{
text: `My product data set is: ${JSON.stringify(products.value)}`,
},
],
},
],
})
);
async function sendMessage() {
const result = await chat.sendMessageStream(question.value);
for await (const chunk of result.stream) {
const chunkText = chunk.text();
generatedText.value += chunkText;
}
}I'm then just calling sendMessage with an updated question.value. When I look at the history, I can see that the model has an empty text part which could be the issue, but I'm not entirely sure!
Actual vs expected behavior:
Error output instead of an updated generatedText
Any other information you'd like to share?
Possible history culprit
[
{
"text": "I"
},
{
"text": "'m sorry, I don't have information about that - but I can"
},
{
"text": " help you with other questions. \n"
},
{
"text": ""
}
]Edit: I noticed that I have ${JSON.stringify(products.value)} in the example, but even without it I'm still getting the same error, let me know if you need a minimal repro.
priyanshuraj24
Metadata
Metadata
Assignees
Labels
component:js sdkIssue/PR related to JavaScript SDKIssue/PR related to JavaScript SDKp2status: awaiting user responseAwaiting a response from the authorAwaiting a response from the authortype:bugSomething isn't workingSomething isn't working