Interface: UseChatReturn<TResponse>
Defined in: react/src/hooks/useChat.ts:101
Type Parameters
TResponse
TResponse = string
Properties
clearHistory
clearHistory: () =>
Promise<void>
Defined in: react/src/hooks/useChat.ts:119
Clear the conversation here and where it is kept (local storage, or the route's session).
Returns
Promise<void>
error
error:
Error|null
Defined in: react/src/hooks/useChat.ts:109
isLoading
isLoading:
boolean
Defined in: react/src/hooks/useChat.ts:106
A turn is in flight: sent and not yet finished.
isStreaming
isStreaming:
boolean
Defined in: react/src/hooks/useChat.ts:108
The turn's reply is streaming in.
messages
messages:
UIMessage<unknown,UIDataTypes,UITools>[]
Defined in: react/src/hooks/useChat.ts:103
The conversation as AI SDK UIMessages.
pendingApprovals
pendingApprovals:
PendingApproval[]
Defined in: react/src/hooks/useChat.ts:111
Tool calls waiting for the user. Answer all of them in one respondToToolApprovals call.
respondToToolApprovals
respondToToolApprovals: (
responses) =>void
Defined in: react/src/hooks/useChat.ts:123
Resume a paused turn with exactly one decision for each pending approval.
Parameters
responses
Returns
void
retryLast
retryLast: () =>
Promise<void>
Defined in: react/src/hooks/useChat.ts:121
Run the last user message again, in place of its turn.
Returns
Promise<void>
send
send: (
content) =>Promise<TResponse|undefined>
Defined in: react/src/hooks/useChat.ts:117
Send a message; resolves with the turn's result (its text, or its structured output) once it ends or pauses, and rejects with the error of a failed turn. A message sent while a turn is in flight waits for it.
Parameters
content
string
Returns
Promise<TResponse | undefined>
status
status:
ChatStatus
Defined in: react/src/hooks/useChat.ts:104
stopStreaming
stopStreaming: () =>
void
Defined in: react/src/hooks/useChat.ts:124
Returns
void