Skip to main content

Install

Requires Python 3.9 or higher.

Set environment variables

All providers read credentials from the environment automatically. Create a .env file:

Your first chatbot

Sync alternative

Don’t want async? Use the sync wrapper:

What LangChat does automatically

When you call chat():
  1. Reformulates the question as a standalone query (resolves “it”, “that”, etc.)
  2. Searches your Pinecone index for relevant context
  3. Reranks results with Flashrank for better precision
  4. Calls the LLM with context + conversation history
  5. Saves the exchange to Supabase
  6. Returns a typed ChatResponse object
No configuration needed for any of this — it all works out of the box.

What you get back

chat() returns a ChatResponse dataclass:

Launch as an API server

One line to expose a full REST API with a built-in chat UI:
Open http://localhost:8000/frontend to use the built-in chat interface.

Next steps

Installation

Virtual environments, uv, and dependency setup

Configuration

All providers and configuration options

Document Indexing

Load PDFs, CSVs, and other documents into Pinecone

API Reference

Complete method and parameter reference