Creates a shared useStream instance and provides it to all descendant
components via Vue's provide/inject.
Call this in a parent component's <script setup> to make the stream
available to children via useStreamContext().
provideStream<
T = Record<string, unknown>,
Bag extends BagTemplate = BagTemplate
>(
options: ResolveStreamOptions<T, InferBag<T, Bag>> | UseStreamCustomOptions<InferStateType<T>, InferBag<T, Bag>>
): WithClassMessages<ResolveStreamInterface<T, InferBag<T, Bag>>>| Name | Type | Description |
|---|---|---|
options* | ResolveStreamOptions<T, InferBag<T, Bag>> | UseStreamCustomOptions<InferStateType<T>, InferBag<T, Bag>> |
<!-- ChatContainer.vue -->
<script setup lang="ts">
import { provideStream } from "@langchain/vue";
provideStream({ assistantId: "agent", apiUrl: "http://localhost:2024" });
</script>
<template>
<ChatHeader />
<MessageList />
<MessageInput />
</template>