Ashvanth.S commited on
Commit
b03de9a
β€’
1 Parent(s): 97067c0

Update Readme

Browse files
Files changed (1) hide show
  1. README.md +9 -124
README.md CHANGED
@@ -1,124 +1,9 @@
1
- # RAG and Agent-based Q&A System
2
-
3
- ## Table of Contents
4
- - [Introduction](#introduction)
5
- - [Features](#features)
6
- - [System Architecture](#system-architecture)
7
- - [Prerequisites](#prerequisites)
8
- - [Installation](#installation)
9
- - [Usage](#usage)
10
- - [API Endpoints](#api-endpoints)
11
- - [Frontend Interface](#frontend-interface)
12
-
13
- This project implements a sophisticated Question-Answering system that combines Retrieval-Augmented Generation (RAG) with an intelligent agent. The system is designed to answer queries related to NCERT textbooks chapters, specifically focusing on the Sound chapter, while also handling general queries using web search capabilities. Do not: **Don't forget to specify your open-ai key in the .env file**
14
-
15
- The application serves two main functionalities:
16
-
17
- - A RAG system that retrieves relevant information from a vector database containing NCERT textbook content.
18
- - An agent-based system that can perform smart actions based on the user's query, including invoking the RAG system when appropriate and using additional tools like web search.
19
-
20
- ## Introduction
21
-
22
- This project implements a sophisticated Question-Answering system that combines Retrieval-Augmented Generation (RAG) with an intelligent agent. The system is designed to answer queries related to NCERT textbooks, specifically focusing on the Sound chapter, while also handling general queries using web search capabilities.
23
-
24
- The application serves two main functionalities:
25
- 1. A RAG system that retrieves relevant information from a vector database containing NCERT textbook content.
26
- 2. An agent-based system that can perform smart actions based on the user's query, including invoking the RAG system when appropriate and using additional tools like web search.
27
-
28
- ## Features
29
-
30
- - **RAG System**:
31
- - Utilizes a vector database to store and retrieve relevant information from NCERT textbooks.
32
- - Provides accurate and concise answers to questions related to the Sound chapter.
33
-
34
- - **Intelligent Agent**:
35
- - Determines when to use the RAG system based on the query content.
36
- - Incorporates additional tools, including web search for non-textbook related queries.
37
- - Calculates word count of responses when requested.
38
-
39
- - **FastAPI Backend**:
40
- - Serves both RAG and Agent functionalities via separate endpoints.
41
- - Ensures efficient and scalable handling of requests.
42
-
43
- - **Gradio Frontend**:
44
- - Provides an intuitive user interface for interacting with both the RAG and Agent systems.
45
- - Allows easy testing and demonstration of the system's capabilities.
46
-
47
-
48
- ## System Architecture
49
-
50
- The system is built using the following key components:
51
-
52
- 1. **Vector Store**: Stores embeddings of NCERT textbook content for efficient retrieval.
53
- 2. **LangChain**: Facilitates the creation of the RAG chain and the agent.
54
- 3. **OpenAI's ChatGPT**: Powers the language model for generating responses.
55
- 4. **DuckDuckGo Search API**: Enables web search capabilities for the agent.
56
- 5. **FastAPI**: Provides the backend API framework.
57
- 6. **Gradio**: Creates the frontend user interface.
58
-
59
- ## Installation
60
-
61
- 1. Clone the repository and create a virtual env
62
- ```bash
63
- python -m venv venv
64
- source venv/bin/activate
65
- ```
66
-
67
- 2.Install the required packages:
68
- ```bash
69
- pip install -r requirements.txt
70
- ```
71
-
72
- 3. Setup up .env with all the environment variables
73
- ```bash
74
- OPEN_API_KEY=your_openai_api_key
75
- UVICORN_HOST = 127.0.0.1
76
- UVICORN_PORT = 7860
77
- SOURCE_DATA = "../pdf_data"
78
- VECTOR_STORE = "../chroma_langchain_db"
79
- ```
80
-
81
- ## Usage
82
-
83
- To start the application run:
84
- ```python
85
- python3 main_app.py
86
- ```
87
-
88
- This will start the FastAPI server and launch the Gradio interface. You can access the Gradio interface by navigating to `http://localhost:8000` in your web browser.
89
-
90
- ## API Endpoints
91
-
92
- The application exposes two main endpoints:
93
-
94
- 1. `/rag` (POST): For querying the RAG system
95
- - Request body: `{ "question": "Your question here" }`
96
- - Response: `{ "answer": "Generated answer" }`
97
-
98
- 2. `/agent` (POST): For interacting with the intelligent agent
99
- - Request body: `{ "question": "Your question here" }`
100
- - Response: `{ "answer": "Agent's response" }`
101
-
102
-
103
- ## Frontend Interface
104
-
105
- The Gradio interface provides two tabs:
106
-
107
- 1. **RAG System**: For asking questions related to the NCERT Sound chapter.
108
- 2. **Agent**: For general queries, including those that may require web search or other tools.
109
-
110
- Users can type their questions in the input box and receive answers in real-time.
111
-
112
- ### RAG System Interface
113
-
114
- ![RAG System Interface](images/RAG_app.png)
115
-
116
- ### Agent Interface
117
-
118
- ![Agent Interface](images/Agent_app.png)
119
-
120
- ### API Documentation
121
-
122
- The FastAPI automatic interactive API documentation is available at `/docs` endpoint:
123
-
124
- ![API Documentation](images/API_docs.png)
 
1
+ ---
2
+ title: Sarvam Assignment
3
+ emoji: πŸ‘
4
+ colorFrom: green
5
+ colorTo: blue
6
+ sdk: docker
7
+ pinned: false
8
+ short_description: Q&A using Rag and Agent
9
+ ---