Skip to main content

Installation issues

pip install langchat fails

Python version error

LangChat requires Python 3.9+. Check your version:
If below 3.9, install a newer Python from python.org or via pyenv.

API key errors

ValueError: OpenAI API key is required. Set OPENAI_API_KEY...

Your API key is not set. Fix with one of:

Same error for Pinecone / Supabase

Check these environment variables:

Pinecone issues

Index not found or connection error

  1. Verify the index name matches exactly (case-sensitive)
  2. Confirm the index exists in app.pinecone.io
  3. Check PINECONE_API_KEY is set and valid

Dimension mismatch error

Your index dimensions don’t match the embedding model. Common cases: Create a new index with the correct dimensions or switch embedding models.

No relevant results / poor answers

  1. Verify documents are indexed: check chunk count in your indexing script output
  2. Try a more specific query
  3. Check verbose=True to see what context is being retrieved
  4. Increase top_n in the reranker (default: 3)

Supabase issues

Tables not created

Tables are created on first use. If they’re missing, run a test chat() call or check that SUPABASE_KEY has write permissions (use service_role key for server-side).

Row Level Security policy violation

Use the service_role key instead of the anon key:

Chat issues

Empty or very short responses

The LLM returned a minimal response. Try:
  1. More specific query
  2. Verify documents are indexed and relevant
  3. Check verbose=True to see the full prompt being sent
  4. Try a different model (e.g., gpt-4o instead of gpt-4o-mini)

Responses ignore context

The prompt template may be misconfigured. Ensure {context} appears in your template:

Conversation history not working

History is per user_id + platform. If you’re using different values between calls, each call starts fresh:

Performance issues

Slow response times

  1. Reduce max_chat_history — fewer messages = smaller prompt = faster LLM call
  2. Use a faster modelgpt-4o-mini is ~5× faster than gpt-4o
  3. Reduce top_n in reranker — default is 3; try 2
  4. Use text-embedding-3-small instead of text-embedding-3-large for Pinecone

High token costs

  1. Use gpt-4o-mini instead of gpt-4o
  2. Reduce max_chat_history (each extra exchange costs tokens)
  3. Reduce chunk_size to keep context chunks shorter
  4. Reduce reranker top_n to pass fewer chunks to the LLM

Import errors

ModuleNotFoundError: No module named 'langchat'

ImportError when importing a provider

Some providers have optional dependencies. Install the extras:

Still stuck?

  1. Enable verbose logging: LangChat(..., verbose=True)
  2. Check the GitHub Issues
  3. Open a new issue with your error message, Python version, and minimal reproduction