How samnageub/genai works
Main Components
• User Interface (UI): The Streamlit front end is defined by the files app.py and rag_deep.py. The UI receives user input (queries) and displays model responses.
• Document Store: The “document_store” directory (with PDFs inside) acts as the repository of documents that the system uses for question answering.
• Model Integration: The local installation of Ollama (running deepseek-r1 with a chosen model size, such as 1.5b) interfaces with the application to perform the core deep learning tasks.
• PDF Parsing & Preprocessing: Libraries like pdfplumber are used to extract text data from PDFs. This is part of the backend processing.
• LangChain Components: The inclusion of libraries such as langchain_core, langchain_community, and langchain_ollama suggests that the project uses LangChain to manage workflows, query chaining, and integration with the language model.
• RAG Flow (for rag_deep.py): An additional flow that uses Retrieval Augmented Generation to incorporate document retrieval with language model outputs, enhancing the Q&A functionality.
Relationships and Interactions
• The UI (Streamlit app) serves as the entry point. Users submit queries via the browser.
• The UI triggers back-end processes that may include:
– Parsing documents from the document store (using pdfplumber).
– Passing queries and possibly document excerpts to the local language model via Ollama.
– Running LangChain pipelines to facilitate the RAG process (if using rag_deep.py).
• Data flows from the document store and through the preprocessing layer (PDF parsing) to build a context, which is then provided as input to the language model.
• The language model’s response is sent back through the LangChain flow to the UI for display.
Architectural Patterns or Design Principles
• Separation of Concerns: Clearly divide the UI (app.py and rag_deep.py) from the backend processing (PDF parsing, document storage, and language model communication).
• Modular Architecture: Each major task (e.g., document preprocessing, language model interfacing, and presentation layer) is handled by distinct modules or libraries.
• Pipeline/Chaining Pattern: The integration with LangChain indicates that there’s a staged processing flow — starting with input, then document retrieval/processing, and finally generating the response.
Relevant Technologies, Frameworks, and Libraries
• Streamlit for the web interface.
• pdfplumber for PDF text extraction.
• LangChain libraries (core, community, and ollama) for workflow management.
• Ollama for running the deep learning model locally.
• Python as the programming language (evidenced by the .py files).