vercel / ai

Build AI-powered applications with React, Svelte, Vue, and Solid
https://sdk.vercel.ai/docs
Other
10.24k stars 1.55k forks source link

Metadata with assistants #999

Open nkeat12 opened 9 months ago

nkeat12 commented 9 months ago

Description

is there a way to send metadata when using experimental_AssistantResponse? I saw it was added with sendExtraMessageFields..

Code example

No response

Additional context

No response

lgrammel commented 8 months ago

You can use sendDataMessage to send any data from the assistant response to the client.

justkahdri commented 7 months ago

Hey, I have the same question, and I don't quite understand how I could append the metadata to the sendDataMessage function based on the documentation example. It creates a new message, where what I was looking for is the message object to include the metadata that comes from the openai response.

Should I fetch the message again from openai?

justkahdri commented 7 months ago

Did a small PR to solve this, LMK if it's useful :pray:

justkahdri commented 7 months ago

@lgrammel did you have the chance to review this? It's blocking our team, and it'd be awesome to know if you'll add this