Skip to content

How to use VercelAIAdapter to persist vercel ai compliant messages? #5

Description

@MichaelHogers

I believe it to be the case that VercelAIAdapter allows to convert the SSE stream to the vercel ai sdk format and this works quite nicely, but how would I best go about storing a history of messages in a way that follows the vercel ai sdk UIMessage interface?

VercelAIAdapter.dispatch_request has the on_complete argument which allows to access result.new_messages_json, but it is not so clear how to process this json object and store it in the DB in a way that allows to easily load it back into the vercel ai sdk.

Would it be possible to add this as an example to this repo? Perhaps using a local json file that acts as a db?

Not sure if it is the best place for this issue, would appreciate some thoughts on ^

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions