Converts plain message objects within each history state's values to proper BaseMessage class instances. Returns a new array with shallow-copied states whose messages have been coerced.
ensureHistoryMessageInstances<
StateType extends Record<string, unknown>
>(history: ThreadState<StateType>[], messagesKey: string = "messages"): ThreadState<StateType>[]| Name | Type | Description |
|---|---|---|
history* | ThreadState<StateType>[] | |
messagesKey | string | Default: "messages" |