How sudarshan-koirala/chat-with-website works
This project is a lightweight full-stack application designed to allow users to interact with a website’s content using chat interfaces. It leverages Large Language Models (LLMs) via two different UIs – Streamlit and Chainlit – and integrates with LangChain for LLM management. The codebase supports two types of LLM providers (OpenAI and Ollama/mistral), and also includes a document ingestion component.
Main Components
• Environment/Configuration: Represent the configuration files (example.env renamed to .env), requirements.txt, and licensing files.
• UI Layer:
◦ Streamlit-based interface (chat_with_website_openai.py & chat_with_website_ollama.py)
◦ Chainlit interface (main.py alongside ingest.py for ingestion)
• Ingestion Module:
◦ ingest.py – this component is responsible for preprocessing or loading the website’s documents.
• LLM Integrations:
◦ OpenAI model integration (referenced in chat_with_website_openai.py)
◦ Ollama/mistral integration (referenced in chat_with_website_ollama.py)
• Framework Integration:
◦ LangChain – the integration acts as the backbone to interface with various LLMs and manage conversational context.
Relationships & Interactions
• The LangChain framework is central and interacts with both the UI components and the LLM integrations, managing requests and relaying responses.
Architectural Patterns
• Separation of Concerns: Different Python scripts handle distinct responsibilities (e.g., separate UIs, ingestion logic, LLM integration).
• Multi-Interface Support: Highlight how both Streamlit and Chainlit serve as different front ends interfacing with the same underlying logic.
• Config-driven Behavior: Environment variables (from .env) control API keys and runtime settings.
Relevant Technologies & Libraries
• Python 3.9+ is the runtime.
• Streamlit and Chainlit for UI deployments.
• LangChain for LLM integration.
• External LLMs (OpenAI and Ollama/mistral) which provide natural language processing capabilities.
• Git, licensing, and configuration management files for project governance.