Zod Stream
Type-safe structured extraction from LLM streams with progressive validation
zod-stream
adds structured output validation and streaming capabilities to LLM responses. Built on top of schema-stream
, it enables type-safe extraction with progressive validation.
Key Features
- 🔄 Stream structured LLM outputs with validation
- 🎯 Multiple response modes (TOOLS, FUNCTIONS, JSON, etc.)
- 📝 OpenAI client integration
- 🌳 Progressive validation with partial results
- ⚡ Built on schema-stream
- 🔍 Full TypeScript support
Why zod-stream?
zod-stream
solves key challenges in handling streaming LLM responses:
-
Dependency Management: Process data as soon as dependencies are met, rather than waiting for complete responses
-
Type-Safe LLM Integration: Full TypeScript support for structured outputs from OpenAI and other providers
-
Progressive Processing: Built on
schema-stream
for immediate access to partial results -
Provider Flexibility: Consistent interface across different LLM response formats
Think of it as a type-safe pipeline for handling streaming LLM data where you need to:
- Start processing before the full response arrives
- Ensure type safety throughout the stream
- Handle complex data dependencies
- Work with multiple LLM response formats