mirror of
https://github.com/langchain-ai/docs.git
synced 2026-08-27 21:00:00 -04:00
17 lines
370 B
Plaintext
17 lines
370 B
Plaintext
```ts
|
|
const question = "Which genre on average has the longest tracks?";
|
|
|
|
const stream = await agent.streamEvents(
|
|
{ messages: [{ role: "user", content: question }] },
|
|
{ version: "v3" },
|
|
);
|
|
|
|
for await (const message of stream.messages) {
|
|
for await (const token of message.text) {
|
|
process.stdout.write(token);
|
|
}
|
|
}
|
|
|
|
const finalState = await stream.output;
|
|
```
|