Stream Hooks
React hooks for processing streaming JSON data from LLMs with progressive validation
Hooks for consuming streams in react - specifically json streams coming from LLMS - given a Zod Schema that represents the final output, you can start the stream and start to read the structured result immediately.
stream-hooks
provides React hooks for consuming streams - specifically JSON streams coming from LLMs. Given a Zod Schema that represents the final output, you can start processing structured results immediately as they stream in.
Key Features
- 🔄 React hooks for streaming LLM responses
- 🎯 Progressive validation and partial results
- 📝 Built-in TypeScript support
- ⚡ Seamless integration with zod-stream
- 🌳 Path completion tracking
- 🔍 Error handling and loading states
Integration with zod-stream
stream-hooks
was designed to work with zod-stream
response modes:
TypeScript Support
The hook provides full type inference: