Skip to content

Multiple messages with different message ID on vercel stream with toolcalls #774

@apm-tobias-duesterhus

Description

@apm-tobias-duesterhus

Hey there,

I am unsing Prism (v 0.95.0) in combination with the Vercel SDK 5 for frontend. Since I added tool calls, I found that in case of a tool call, I get multiple text-messages per request with different message IDs. This seems to force Vercel SDK to show multiple messages with the same content. This seems to be a known issue in Vercel that was solved in their backend.

Here is a short excerpt from the stream response (the first message seems to be empty):

data: {"type":"start","messageId":"evt_01KB1XH56DBFTBR3WRPD2TR3C7"}

data: {"type":"tool-input-available","toolCallId":"fc_0633e23d579e07a2006927e586cc0c81949d56bb001d29de09","toolName":"google_web_search","input":{"query_string":"..."}}

data: {"type":"finish","messageMetadata":{"finishReason":"tool-calls","usage":{"promptTokens":348,"completionTokens":18}}}

data: {"type":"tool-output-available","toolCallId":"fc_0633e23d579e07a2006927e586cc0c81949d56bb001d29de09","output":"{...}"}

data: {"type":"start","messageId":"evt_01KB1XH7YKJRMYBT91XRAC8HMV"}

data: {"type":"text-start","id":"evt_01KB1XH7YE6ZHYA5CVC2VXET56"}

Is there a fix for Prism that I did not found yet?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions