assistant-ui-streaming

Featured

Guide for assistant-stream package and streaming protocols. Use when implementing streaming backends, custom protocols, or debugging stream issues.

AI & Automation 2,894 stars 189 forks Updated today MIT

Install

View on GitHub

Quality Score: 96/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# assistant-ui Streaming **Always consult [assistant-ui.com/llms.txt](https://assistant-ui.com/llms.txt) for latest API.** The `assistant-stream` package handles streaming from AI backends. ## References - [./references/data-stream.md](./references/data-stream.md) -- AI SDK data stream format - [./references/assistant-transport.md](./references/assistant-transport.md) -- Native assistant-ui format - [./references/encoders.md](./references/encoders.md) -- Encoders and decoders ## When to Use ``` Using Vercel AI SDK? ├─ Yes → toUIMessageStreamResponse() (no assistant-stream needed) └─ No → assistant-stream for custom backends ``` ## Installation ```bash npm install assistant-stream ``` ## Custom Streaming Response ```ts import { createAssistantStreamResponse } from "assistant-stream"; export async function POST(req: Request) { return createAssistantStreamResponse(async (stream) => { stream.appendText("Hello "); stream.appendText("world!"); // Tool call example const tool = stream.addToolCallPart({ toolCallId: "1", toolName: "get_weather" }); tool.argsText.append('{"city":"NYC"}'); tool.argsText.close(); tool.setResponse({ result: { temperature: 22 } }); stream.close(); }); } ``` ## With useLocalRuntime `useLocalRuntime` expects `ChatModelRunResult` chunks. Yield content parts for streaming: ```tsx import { useLocalRuntime } from "@assistant-ui/react"; const runtime = useLocalRuntime({ model: { async *run({ messages, abo...

Details

Author
compozy
Repository
compozy/compozy
Created
7 months ago
Last Updated
today
Language
Go
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category