hashbrown

UseChatResult

The result object-type returned by the useChat hook that provides functions and state for interacting with the chat.

API

UseChatResult
@typeTools
Chat.AnyTool
error
Error | undefined

The error encountered during chat operations, if any.

exhaustedRetries
boolean

Whether the current request has exhausted retries.

isReceiving
boolean

Whether the chat is receiving a response.

isRunningToolCalls
boolean

Whether the chat is running tool calls.

isSending
boolean

Whether the chat is sending a response.

lastAssistantMessage
Chat.AssistantMessage<string, Tools> | undefined

The last assistant message.

messages
Chat.Message<string, Tools>[]

An array of chat messages.

reload
() => void

Reload the chat, useful for retrying when an error occurs.

sendMessage
(message: Chat.Message<string, Tools>) => void

Function to send a new chat message.

setMessages
(messages: Chat.Message<string, Tools>[]) => void

Function to update the chat messages.

stop
(clearStreamingMessage?: boolean) => void

Function to stop the chat.