Skip to content

Pass requestMetadata to prepareSendMessagesRequest()#1023

Merged
VaguelySerious merged 4 commits into
vercel:mainfrom
rovo89:fix/request-metadata
Feb 23, 2026
Merged

Pass requestMetadata to prepareSendMessagesRequest()#1023
VaguelySerious merged 4 commits into
vercel:mainfrom
rovo89:fix/request-metadata

Conversation

@rovo89
Copy link
Copy Markdown
Contributor

@rovo89 rovo89 commented Feb 12, 2026

See HttpChatTransport.

This is helpful to pass reactive data (e.g. a selected model) from the click handler to the API.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: ae0db5f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@workflow/ai Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Feb 12, 2026

@rovo89 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Copy Markdown
Contributor

@vercel vercel Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional Suggestion:

TypeScript type error: sendMessagesIterator parameter is missing ChatRequestOptions in its type, causing options.metadata access to be invalid.

Fix on Vercel

See [HttpChatTransport](https://github.com/vercel/ai/blob/main/packages/ai/src/ui/http-chat-transport.ts).

This is helpful to pass reactive data (e.g. a selected model) from the
click handler to the API.

Signed-off-by: Robert Vollmer <rovo89@users.noreply.github.com>
Signed-off-by: Robert Vollmer <rovo89@users.noreply.github.com>
Signed-off-by: Robert Vollmer <rovo89@users.noreply.github.com>
@rovo89 rovo89 force-pushed the fix/request-metadata branch from ff9bcb7 to 9d08c8f Compare February 21, 2026 17:00
@rovo89
Copy link
Copy Markdown
Contributor Author

rovo89 commented Feb 21, 2026

Rebased.

messages,
requestMetadata: undefined,
requestMetadata: options.metadata,
body: undefined,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also populate body and headers in the same way?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell (from the fetch a few lines below), the default for body is { messages } (which is already passed) and the default for headers and credentials is undefined. The requestMetadata was the only thing that couldn't be accessed.

Comment thread .changeset/lazy-hairs-grin.md Outdated
Co-authored-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Robert Vollmer <rovo89@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants