Skip to content

Latest commit

 

History

History
23 lines (20 loc) · 738 Bytes

File metadata and controls

23 lines (20 loc) · 738 Bytes
@tanstack/ai-client minor
@tanstack/ai-react minor
@tanstack/ai-preact patch
@tanstack/ai-solid patch
@tanstack/ai-svelte patch
@tanstack/ai-vue patch

Add a fetcher option to ChatClient and the framework chat hooks (useChat / createChat), mirroring the fetcher option on the generation hooks. Pass either connection or fetcher — the XOR is enforced at the type level via ChatTransport.

useChat({
  fetcher: ({ messages }, { signal }) => chatFn({ data: { messages }, signal }),
})

The fetcher may return either a Response (parsed as SSE) or an AsyncIterable<StreamChunk> (yielded directly). stream(), fetchServerSentEvents, fetchHttpStream, and rpcStream are unchanged.