Provides a useStream return value to all descendant components via
Svelte's context API. Must be called during component initialisation
(i.e. at the top level of a <script> block).
setStreamContext<T extends __type>(stream: T): T| Name | Type | Description |
|---|---|---|
stream* | T |
<script lang="ts">
import { useStream, setStreamContext } from "@langchain/svelte";
const stream = useStream({ assistantId: "agent", apiUrl: "..." });
setStreamContext(stream);
</script>
<ChildComponent />