Spaces:
Sleeping
Sleeping
|
Download README.md from Datamind23/AI_Research_Assis: direct link, hf CLI and curl.
- Browser
- Download file 4.39 kB
-
https://huggingface.co/spaces/Datamind23/AI_Research_Assis/resolve/main/README.md
- Command line
-
hf download hf://spaces/Datamind23/AI_Research_Assis/README.md
-
curl -L -o README.md https://huggingface.co/spaces/Datamind23/AI_Research_Assis/resolve/main/README.md
4.39 kB
| title: AI Research Assistant | |
| emoji: π€ | |
| colorFrom: blue | |
| colorTo: red | |
| sdk: streamlit | |
| sdk_version: "1.28.1" | |
| app_file: rag_streamlit_app.py | |
| pinned: false | |
| # AI Research Assistant | |
| ## π Overview | |
| The **AI Research Assistant** is an agentic RAG (Retrieval-Augmented Generation) pipeline designed to support advanced research tasks. | |
| It combines **retrieval, reasoning, and generation** with modular components for ingestion, query refinement, and output generation. | |
| The system uses **LangChain**, **LangGraph**, and **FAISS**, enhanced with **BM25 hybrid retrieval** and **cross-encoder reranking** for high-precision results. | |
| On top of the pipeline, a **Streamlit web app** (`rag_streamlit_app.py`) provides an intuitive interface for researchers to interact with the assistant, ask questions, and visualize responses. | |
| --- | |
| ## π Key Features | |
| - **Hybrid Retrieval**: Combines dense embeddings with BM25 for balanced semantic + keyword search. | |
| - **Reranking**: Cross-encoder model refines retrieved passages for better relevance. | |
| - **Agentic Reasoning**: Powered by LangGraph with conditional edges and iterative loops. | |
| - **Query Refinement**: Uses Gemini (via `langchain_google_genai`) to re-formulate queries for better coverage. | |
| - **Self-Critique & Improvement**: The pipeline can score and revise its own outputs. | |
| - **Modular Design**: Clean separation of ingestion, retrieval, refinement, generation, and agent flow. | |
| - **Streamlit App**: Modern UI for asking questions, viewing retrieved sources, and getting citation-backed answers. | |
| --- | |
| ## π Project Structure | |
| ```ai_research_assistant/ | |
| βββ agentic_rag/ | |
| β βββ agent_flow.py # Defines LangGraph state machine and agent workflow | |
| β βββ ddg_check.py # DuckDuckGo search helper for external knowledge retrieval | |
| β βββ generation.py # Handles LLM response generation using Gemini | |
| β βββ ingestion.py # Ingests documents and builds FAISS vector store | |
| β βββ init.py # Marks directory as a Python package | |
| β βββ llm_config.py # Centralized config for Gemini and other LLMs | |
| β βββ refinement.py # Query reformulation and refinement logic | |
| β βββ retrieval.py # Hybrid (BM25 + dense) retrieval with reranking | |
| β βββ scoring.py # Implements self-critique and scoring of answers | |
| β βββ state.py # LangGraph state definitions and transitions | |
| β βββ tools_agent.py # Utility tools exposed to the agent (search, calculators, etc.) | |
| β | |
| βββ main.py # CLI entry point for running pipeline | |
| βββ rag_streamlit_app.py # Streamlit web app for interactive research assistant | |
| βββ .gitignore # Git ignore rules | |
| βββ README.md # Project documentation | |
| ``` | |
| --- | |
| ## βοΈ Tech Stack | |
| - **Python 3.10+** | |
| - **LangChain** + **LangGraph** | |
| - **Vector Stores**: FAISS (with BM25 hybrid) | |
| - **LLMs**: Google Gemini via `langchain_google_genai` | |
| - **Rerankers**: Cross-encoders for document relevance | |
| - **Frontend**: Streamlit | |
| --- | |
| ## π οΈ Setup | |
| 1. Clone the repo: | |
| ``` | |
| git clone https://github.com/sourabhd321/AI-Research-Assistant.git | |
| cd ai-research-assistant | |
| ``` | |
| Create and activate virtual environment: | |
| ``` | |
| python -m venv venv | |
| source venv/bin/activate # Linux/Mac | |
| venv\Scripts\activate # Windows | |
| ``` | |
| Install dependencies: | |
| ``` | |
| pip install -r requirements.txt | |
| ``` | |
| Set up environment variables in .env: | |
| ``` | |
| GOOGLE_API_KEY=your_gemini_key | |
| ``` | |
| βΆοΈ Usage | |
| Run the pipeline (CLI mode) | |
| ``` | |
| python main.py | |
| ``` | |
| Run the Streamlit app (UI mode) | |
| ``` | |
| streamlit run rag_streamlit_app.py | |
| ``` | |
| ποΈ Architecture | |
| ```mermaid | |
| flowchart TD | |
| A[Ingestion] -->|Load docs, build FAISS| B[Retrieval] | |
| B -->|Hybrid: BM25 + Dense| C[Reranking] | |
| C --> D[Refinement] | |
| D --> E["Agent Flow (LangGraph)"] | |
| E --> F["Generation (LLM - Gemini)"] | |
| F --> G["Scoring & Self-Critique"] | |
| G --> H["Final Answer"] | |
| %% UI paths | |
| H -->|Display| I["Streamlit App"] | |
| E -->|CLI mode| J["main.py"] | |
| ``` | |
| ## Authors | |
| - [@sourabhd321](https://github.com/sourabhd321) | |
| ## Badges | |
|  | |
|  | |
|  | |