How utkarsh-chauhannn/saari-news-walah works
Main Components
• AI Agent Module (ai_agent.py): This module implements the core AI functionality using LangChain and LangGraph. It leverages a ReAct (Reasoning + Acting) framework to interact with models (like Groq’s LLaMA) and external search tools (e.g., Tavily Search).
• Backend API (backend.py): Developed with FastAPI and using Pydantic for data validation, this layer handles API requests, integrates the AI agent, and provides interactive documentation (Swagger UI).
• Frontend Interface (frontend.py): Built with Streamlit, this component provides an interactive chat UI, which connects to the backend to display real-time, AI-powered responses.
• External Services & Tools: Although not explicitly in the file tree, mention the integration with external APIs/services for Groq, OpenAI, and Tavily Search as documented in the README.
Relationships and Interactions
• The Frontend sends chat input requests to the Backend API.
• The Backend API receives requests, validates them with Pydantic models, and routes them to the AI Agent module.
• The AI Agent processes the request using the LangChain and LangGraph frameworks. It communicates with external services (for instance, real-time news fetching and model inference).
• The Backend then sends the AI agent’s response back to the Frontend for display.
• Data flow from the user (via the Frontend) to the Backend.
• Internal communication from the Backend to the AI Agent.
• Outbound interactions from the AI Agent to external APIs/services.
Architectural Patterns & Technologies
• Separation of concerns: the clear split between the UI (Streamlit), API layer (FastAPI), and business logic (AI agent with LangChain/LangGraph).
• Modularity and scalability gates (easily extensible with additional tools or models).
• Detailed dependencies: FastAPI for RESTful endpoints, Pydantic for validation, LangChain & LangGraph for AI workflows, and Streamlit for an interactive, lightweight web interface.
• Mention design principles such as the ReAct pattern for reasoning and acting, which is central to the AI Agent’s operation.