Discover and explore top open-source AI tools and projects—updated daily.
vercel-labsStream chat completions from Python to Next.js
Top 76.8% on SourcePulse
This repository provides a template for streaming chat completions from a Python backend (FastAPI) to a Next.js frontend using the Data Stream Protocol. It's designed for developers looking to integrate real-time AI chat experiences into their web applications, offering a practical example of how to leverage Vercel's AI SDK.
How It Works
The project utilizes FastAPI to create a Python backend that streams chat completions. This streaming capability is achieved through the Data Stream Protocol, enabling efficient, real-time data transfer. The Next.js frontend, using the useChat hook from the AI SDK, consumes these streams to display responses as they are generated, creating a dynamic chat interface.
Quick Start & Requirements
npx create-next-app --example https://github.com/vercel-labs/ai-sdk-preview-python-streaming <your-app-name>.virtualenv..env file. Install Node dependencies with pnpm install, Python dependencies with pip install -r requirements.txt within a virtual environment.pnpm dev.Highlighted Details
Maintenance & Community
This is a Vercel Labs project, indicating potential backing and development by Vercel. Further community or maintenance details are not provided in the README.
Licensing & Compatibility
The license is not specified in the provided README. Compatibility for commercial use or closed-source linking would depend on the actual license file.
Limitations & Caveats
The project is presented as a "preview" and a "template," suggesting it may be experimental or subject to change. Specific AI providers require separate accounts and API keys, and environment variable setup is necessary for local execution.
2 months ago
Inactive
steven-tey
openai