How pcastiglione99/ragify-search works
Main Components
• User Interface: Streamlit-based front end (app.py) where the user interacts with the chatbot-like interface.
• Configuration Module: Configuration settings stored in config.py which determine parameters such as chunk sizes, model names, and directories.
• Web Scraping Module: Handled by web_scraper.py, responsible for fetching real-time web content and managing temporary files.
• Query Extraction Module: Managed by extract_queries.py; this module generates optimized queries based on user inputs.
• Document Processing & Indexing: Managed by db_operations.py. This component embeds document chunks and builds an index for similarity-based searches.
• Prompt Generation: Managed by prompt_generator.py that prepares structured prompts for interaction with the local LLM.
• Local LLM Integration: The system utilizes Ollama (with a specified model via langchain ollama) to process text and generate responses.
• Optional: A storage or caching layer may be implicitly present as part of temporary file management and document embedding.
Component Relationships and Data Flow
• The user inputs a query in the Streamlit interface.
• The query is sent from the frontend (app.py) to the Query Extraction Module which optimizes the query for search.
• The optimized query triggers the Web Scraping Module (web_scraper.py) to fetch relevant pages.
• Once the content is fetched, the Document Processing module (db_operations.py) processes, splits, embeds, and indexes the content.
• The Prompt Generation module (prompt_generator.py) then takes the processed content along with the user input to generate a structured prompt.
• Finally, the prompt is fed into the Local LLM (via Ollama) to obtain a response which is then displayed in the Streamlit UI.
• Configuration values from config.py guide parameters across all modules.
Architectural Patterns and Design Principles
• Separation of Concerns: Each module (UI, web scraping, query extraction, document processing, prompt generation) has a distinct responsibility.
• Modular Design: The code is split into separate files for each functionality which suggests an extensible and maintainable design.
• Real-Time Interaction: Integration with a local LLM for privacy and performance indicates an emphasis on quick, local inference.