Langchain Chat Websocket
FreeAbout LangChain LLM chat with streaming response over websockets 
FreeFree tier
Inputs: textOutputs: text
About Langchain Chat Websocket
LangChain Chat Websockets is an open-source project that implements a LangChain-based LLM chat application with streaming responses delivered over WebSockets using FastAPI. The repository provides a complete backend setup including FastAPI server, WebSocket handling, and callback management for streaming. It supports deployment via pip or Docker Compose, and requires an OpenAI API key. The application is designed for real-time conversational AI and serves as a reference implementation for integrating LangChain with async WebSocket streaming.
Key Features
Streaming response over WebSockets using FastAPI
LangChain integration for LLM chat
OpenAI API support (configurable via .env)
Async WebSocket communication for real-time output
Docker Compose deployment for easy setup
Callback-based streaming (callback.py)
Includes schemas and query data modules
Apache-2.0 licensed open-source code
Pros & Cons
Pros
- Streaming reduces perceived latency for users
- Fully open-source under Apache-2.0 license
- Easy deployment with Docker Compose
- Utilizes FastAPI for high-performance async handling
- Clear example of WebSocket streaming with LangChain
Cons
- Requires an OpenAI API key (not a standalone free LLM)
- Limited to OpenAI models by default (though extendable)
- No built-in user authentication or session management
- Frontend is basic HTML templates, not a polished UI
Best For
Building real-time AI chat applications with streaming responsesPrototyping LangChain-based conversational agentsEducational reference for integrating LangChain with FastAPI WebSocketsServer-side LLM chat backend for web or mobile clients
FAQ
How do I install and run LangChain Chat Websockets?
Install dependencies with 'pip install -r requirements.txt', copy the dotenv-example to .env and add your OpenAI API key, then run with 'uvicorn main:app --reload'.
Can I run it with Docker?
Yes, you can use Docker Compose: create a .env file with your OpenAI API key, then run 'docker-compose up --build'. The application will be accessible at http://localhost:8000.
What LLM does it use?
It uses OpenAI's language models via the LangChain library. The API key should be placed in the .env file as OPENAI_API_KEY.
Is this project maintained?
The GitHub repository has 97 stars and recent commits, but there are no official releases. It is a community project by pors.