Skip to main content

What is LangChat?

LangChat is a Python library that turns the complex task of building a production-ready RAG chatbot into a few lines of code.
from langchat import LangChat
from langchat.providers import OpenAI, Pinecone, Supabase

lc = LangChat(
    llm=OpenAI("gpt-4o-mini"),
    vector_db=Pinecone("my-index"),
    db=Supabase(),
)

response = await lc.chat(query="What's our refund policy?", user_id="alice")
print(response)  # prints the AI's answer
That’s it. LangChat handles the RAG pipeline, session management, conversation history, document indexing, and persistence — all out of the box.

What’s included

6 LLM providers

OpenAI, Anthropic, Gemini, Mistral, Cohere, and local Ollama — all with automatic credential loading from environment variables

RAG pipeline

Pinecone vector search + Flashrank reranking + contextual conversation prompts, pre-configured and ready to use

Session management

Per-user, per-platform conversation history stored in Supabase — survives server restarts

Document indexing

Index PDFs, Markdown, CSV, and more with one call: lc.index("docs/")

REST API

One-line FastAPI server with a built-in chat UI: create_app(llm=..., vector_db=..., db=...)

Typed responses

ChatResponse dataclass — response.text, if response:, print(response). No more dict key guessing.

Get started

1

Install

pip install langchat
2

Set environment variables

OPENAI_API_KEY=sk-...
PINECONE_API_KEY=pcsk-...
SUPABASE_URL=https://xxxx.supabase.co
SUPABASE_KEY=eyJhbGc...
3

Build your chatbot

See the Quick Start guide.