Skip to content

[JS] inconsistent flows output between streaming and non streaming modes #431

@pavelgj

Description

@pavelgj

When invoking in non-streaming mode the output looks like this:

success:

{"result":"3 + 9 = 12 \n"}

error:

{"error":{"status":"INTERNAL","message":"oops","details":"Error: oops\n    at Flow.<anonymous> (/Users/pavelgj/app/node_modules/@genkit-ai/flow/lib/flow.js:492:19)\n    at Generator.next (<anonymous>)\n    at fulfilled (/Users/pavelgj/app/node_modules/@genkit-ai/flow/lib/flow.js:36:24)\n    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)"}}

however when invoked in streaming mode it looks like this:

success:

{"index":0,"content":[{"text":"3"}]}
{"index":0,"content":[{"text":" + 9 = 12 \n"}]}
{"index":0,"content":[{"text":""}]}
{"name":"a777921c-521a-42d3-b8ae-62ef19c67142","done":true,"result":{"response":"3 + 9 = 12 \n"}}

error:

{"name":"4482ddf8-ac19-477b-9684-960617f2c831","done":true,"result":{"error":"oops"}}

Specifically the last line is problematic -- it must be the same format as in non-streaming mode (Firebase Callable Function format).

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingjs

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions