LangChainStream

LangChainStream has been removed in AI SDK 4.0.

LangChainStream is part of the legacy LangChain integration. It is recommended to use the LangChain Adapter instead.

Helps with the integration of LangChain. It is compatible with useChat and useCompletion.

Import

import { LangChainStream } from "ai"

API Signature

Parameters

callbacks?:

AIStreamCallbacksAndOptions
AIStreamCallbacksAndOptions

onStart:

() => Promise<void>

onCompletion:

(completion: string) => Promise<void>

onFinal:

(completion: string) => Promise<void>

onToken:

(token: string) => Promise<void>

Returns

stream:

ReadableStream

handlers:

LangChainCallbacks