Skip to content

Is there a way to pass extra information down the AssistantRuntimeProvider? #1113

Answered by Yonom
osseonews asked this question in Q&A
Discussion options

You must be logged in to vote

Is this information per-message or per-thread?

For per-message metadata, your ChatModelAdapter can pass information by returning { metadata: { custom: { yourKey: yourValue } } next to the content. This can be later retrieved via useMessage(m => m.metadata.custom)

For per-thread metadata, you might want to simply add a new react context provider with your custom data:
https://react.dev/learn/passing-data-deeply-with-context

Next to AssistantRuntimeProvider you have:

const MyDataContext = createContext();

const Providers = () => {
  <AssistantRuntimeProvider>
    <MyDataContext.Provider data={...}

https://react.dev/learn/passing-data-deeply-with-context

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@osseonews
Comment options

@Yonom
Comment options

@Yonom
Comment options

@osseonews
Comment options

@Yonom
Comment options

Answer selected by osseonews
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants