How avibansal/chatbot-using-langgraph works
Project type and purpose
• This is a lightweight full-stack Python application delivered via Streamlit.
• Purpose: expose a conversational ChatBot (LangChain-powered) in a web UI, with optional external web search tooling (GROQ & TAVILY APIs).
File structure
• Top-level files only:
• Basic Chatbot.py – core chatbot logic without external tool
• ChatBot with Tool.py – extended chatbot with external web-search tool
• requirements.txt – Python dependencies (e.g., streamlit, langchain)
• .env – runtime configuration for API keys
• No separate “frontend” or “backend” folders; the Streamlit script handles both layers.
README for additional insights
• Key dependencies and runtime steps.
• Two modes: basic conversational agent vs. agent augmented with a “Web Search” tool.
• Uses environment variables (GROQ_API_KEY, TAVILY_API_KEY) to drive external tools.
Main components and their relationships
a. Streamlit UI
• Single-page app that captures user input and displays chatbot responses/visualizations.
b. ChatBot Core (LangChain)
• Orchestrates LLM calls, prompt templates, memory (if any), and tool invocation.
c. External Tool Integration
• GROQ API: fetch domain-specific data
• TAVILY API: perform external web searches
d. Configuration / Environment
• .env loader that injects API keys into the Python runtime.
e. Python Runtime & Dependencies
• Interpreter, LangChain, Streamlit, any HTTP clients.
Interactions:
• User → Streamlit UI → ChatBot Core → (optional) External Tool → LLM API → ChatBot Core → Streamlit UI → User
Architectural patterns & design principles
• Layered pattern: Presentation (Streamlit) → Application Logic (LangChain pipeline) → Infrastructure (External APIs).
• “Adapter” style for tool integration: ChatBot Core calls a unified interface for GROQ or TAVILY.
• Single-process deployment (Streamlit serves both front- and back-end).
2. Inside it or just to the right, place “ChatBot Core (LangChain)” (green).
• UI → Core: “user query”
• Core → LLM Provider: “prompt & context”
• Core → GROQ/TAVILY: “tool call” (annotate as only on Tool-enabled path)
• Core → UI: “response & visualization”
7. Two script entrypoints: “Basic Chatbot.py” directly wires UI→Core→UI; “ChatBot with Tool.py” wires UI→Core→External APIs→Core→UI.
8. Labels for technologies: