Skip to main content

Architecture

LangChat uses a hexagonal architecture (Ports and Adapters). This separates the core chatbot logic from the specific tools it uses:
You always interact with langchat.providers. The adapters are implementation details.

Available providers


Import patterns


Environment variable convention

Every provider follows the same pattern:
  1. Check for explicit api_key parameter
  2. Fall back to a named environment variable
  3. Raise ValueError with the exact variable name if neither is set

Detailed reference

OpenAI

LLM provider with multi-key rotation

Pinecone

Vector database with OpenAI embeddings

Supabase

Postgres history and metrics storage

Flashrank

Cross-encoder reranker for better search results