GenkitG
Genkit12mo ago
8 replies
military-pink

Undefined tool response

I have deployed a flow to Firebase Cloud Functions using the onFlow wrapper. It supports streaming. I call this function from a NextJS web app using the Firebase SDK. Everything works fine except when the model tries to call one of the tools defined in the prompt (attached to the flow as a tool); in those cases, the model's response is “undefined\n.

If I attach this tool directly to the flow, everything works correctly. It also works when the prompt is not intended to call any of its tools.

The last two messages from the generateStream method are as follows:

{
"role": "tool",
"content": [
{
"toolResponse": {
"name": "competitorAnalysisAgent",
"output": "transferred to competitorAnalysisAgent"
}
}
]
},
// Here there should be a tool request and its response but the model answers with “undefined
{
"role": "model",
"content": [
{
"text": "undefined\n"
}
]
}

Any idea what might be wrong?
Was this page helpful?