Skip to main content

Interface: UseChatReturn<TResponse>

Defined in: react/src/hooks/useChat.ts:98

Return type for useChat hook

Type Parameters

TResponse

TResponse = string

Properties

clearHistory

clearHistory: () => Promise<void>

Defined in: react/src/hooks/useChat.ts:122

Clear conversation history

Returns

Promise<void>


error

error: Error | null

Defined in: react/src/hooks/useChat.ts:106

Last error, if any


isLoading

isLoading: boolean

Defined in: react/src/hooks/useChat.ts:102

Whether a request is in progress


isStreaming

isStreaming: boolean

Defined in: react/src/hooks/useChat.ts:104

Whether response is currently streaming


pendingApprovals

pendingApprovals: PendingApproval[]

Defined in: react/src/hooks/useChat.ts:112

Tool calls currently awaiting user approval (derived from segments). Empty when none. Submit decisions for every entry via respondToToolApprovals in one batch.


process

process: (content) => Promise<TResponse>

Defined in: react/src/hooks/useChat.ts:116

Alias for send

Parameters

content

string

Returns

Promise<TResponse>


processStreaming

processStreaming: (content) => Promise<TResponse>

Defined in: react/src/hooks/useChat.ts:120

Alias for sendStreaming

Parameters

content

string

Returns

Promise<TResponse>


respondToToolApprovals

respondToToolApprovals: (responses) => void

Defined in: react/src/hooks/useChat.ts:129

Resume a paused approval turn. responses must contain exactly one decision for each currently pending approval id (order does not matter).

Parameters

responses

ToolApprovalResponse[]

Returns

void


retryLast

retryLast: () => Promise<void>

Defined in: react/src/hooks/useChat.ts:124

Retry last failed message

Returns

Promise<void>


segments

segments: StreamSegment[]

Defined in: react/src/hooks/useChat.ts:100

All segments in the conversation (canonical UI representation, includes UserSegments)


send

send: (content) => Promise<TResponse>

Defined in: react/src/hooks/useChat.ts:114

Send message and wait for complete response (no streaming)

Parameters

content

string

Returns

Promise<TResponse>


sendStreaming

sendStreaming: (content) => Promise<TResponse>

Defined in: react/src/hooks/useChat.ts:118

Send message with streaming updates

Parameters

content

string

Returns

Promise<TResponse>


stopStreaming

stopStreaming: () => void

Defined in: react/src/hooks/useChat.ts:131

Stop the current streaming response

Returns

void