{"id":21423150,"url":"https://github.com/chitrakumarsai/rag_app","last_synced_at":"2026-04-09T12:01:05.782Z","repository":{"id":264083811,"uuid":"891081463","full_name":"chitrakumarsai/RAG_APP","owner":"chitrakumarsai","description":"This is a full-stack web application that enables users to upload documents, query an index built from those documents and retrieve responses powered by a Large Language Model (LLM) using Retrieval-Augmented Generation (RAG).","archived":false,"fork":false,"pushed_at":"2024-11-28T18:15:17.000Z","size":20935,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-23T07:11:18.736Z","etag":null,"topics":["docker","flask","generative-ai","llama-index","llm","openai","react","retrival-augmented-generation"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chitrakumarsai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-19T17:35:45.000Z","updated_at":"2024-11-28T18:15:21.000Z","dependencies_parsed_at":"2024-11-22T09:00:26.487Z","dependency_job_id":null,"html_url":"https://github.com/chitrakumarsai/RAG_APP","commit_stats":null,"previous_names":["chitrakumarsai/rag_app"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chitrakumarsai%2FRAG_APP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chitrakumarsai%2FRAG_APP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chitrakumarsai%2FRAG_APP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chitrakumarsai%2FRAG_APP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chitrakumarsai","download_url":"https://codeload.github.com/chitrakumarsai/RAG_APP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243926673,"owners_count":20370021,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["docker","flask","generative-ai","llama-index","llm","openai","react","retrival-augmented-generation"],"created_at":"2024-11-22T21:14:34.563Z","updated_at":"2025-12-31T00:19:53.196Z","avatar_url":"https://github.com/chitrakumarsai.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RAG-Based LLM Full-Stack Application\u003cbr\u003e\n\nThis is a full-stack web application that enables users to upload documents, query an index built from those documents and retrieve responses powered by a Large Language Model (LLM) using **Retrieval-Augmented Generation (RAG)**.\n\u003cbr\u003e\n## The application consists of:\u003cbr\u003e\n\n* **Frontend**: A React-based user interface.\u003cbr\u003e\n* **Backend**: A Flask API server that interacts with the index server.\u003cbr\u003e\n* **Index Server**: A Python-based service managing document indexing and query processing using LlamaIndex.\u003cbr\u003e\n\n## Features\u003cbr\u003e\n\n* Upload files to build an index.\u003cbr\u003e\n* Query the indexed documents using natural language.\u003cbr\u003e\n* Retrieve results with relevant context provided by LlamaIndex.\u003cbr\u003e\n\n## Technologies Used\u003cbr\u003e\n\n### **Backend** \u003cbr\u003e\n* Python 3.11\u003cbr\u003e\n* **Flask:** For serving API requests.\u003cbr\u003e\n* **Flask-CORS:** For cross-origin requests.\u003cbr\u003e\n* **LlamaIndex:** To manage document indexing and querying.\u003cbr\u003e\n### **Frontend**\n* **React:** For building the user interface.\u003cbr\u003e\n* **Bootstrap:** For styling the application.\u003cbr\u003e\n## Deployment\u003cbr\u003e\n**Docker:** For containerizing and deploying the application.\u003cbr\u003e\n## Project Structure\u003cbr\u003e\n```\nRAG_APP/\n├── backend/                   # Backend Flask application\n│   ├── app.py                 # Flask API server\n│   ├── index_server.py        # Index server for LlamaIndex\n│   ├── requirements.txt       # Backend dependencies\n├── frontend/                  # React frontend\n│   ├── src/                   # Source code for the frontend\n│   ├── Dockerfile             # Dockerfile for frontend\n│   ├── package.json           # Frontend dependencies\n├── data/                      # Directory for uploaded files\n├── storage/                   # Directory for storing index files\n├── .env                       # Environment variables\n├── docker-compose.yml         # Docker Compose configuration\n└── README.md                  # This README file\n```\n## Installation and Setup\u003cbr\u003e\n\n## Prerequisites\u003cbr\u003e\n* Docker and Docker Compose installed on your machine.\u003cbr\u003e\n* An OpenAI API Key (required for LlamaIndex).\u003cbr\u003e\n## Environment Variables\u003cbr\u003e\n* Create a `.env` file in the project root and include your OpenAI API key:\u003cbr\u003e\n* `OPENAI_API_KEY=your_openai_api_key`\u003cbr\u003e\n## Steps to Run the Application\u003cbr\u003e\n* Clone the Repository:\u003cbr\u003e\n* `git clone \u003crepository_url\u003e`\u003cbr\u003e\n* `cd RAG_APP`\u003cbr\u003e\n## Build and Start the Containers:\u003cbr\u003e\n* `docker-compose up --build`\u003cbr\u003e\n## Access the Application:\u003cbr\u003e\n* **Frontend:** `http://localhost:3000`\u003cbr\u003e\n* **Backend (API):** `http://localhost:5001`\u003cbr\u003e\n## API Endpoints\u003cbr\u003e\n\n### Query Index\u003cbr\u003e\n* **URL:** `/query`\u003cbr\u003e\n* **Method:** `GET`\u003cbr\u003e\n* **Parameters:** `text` (required): The query string.\u003cbr\u003e\n#### Example:\u003cbr\u003e\n```\ncurl \"http://localhost:5001/query?text=What%20is%20a%20transformer\"\n```\n## Upload File\u003cbr\u003e\n* **URL:** `/uploadFile`\u003cbr\u003e\n* **Method:** `POST`\u003cbr\u003e\n* **Parameters:** `file` (required): The file to upload.\u003cbr\u003e \u003cbr\u003e\n\n## Example:\u003cbr\u003e\n```\ncurl -X POST -F \"file=@example.txt\" http://localhost:5001/uploadFile\n```\n## Frontend Features\u003cbr\u003e\n\n* **Upload Document:** Use the \"Upload File\" button to add documents to the index.\u003cbr\u003e\n* **Query Index:** Enter your query in the text box and press \"Submit Query\" to retrieve results.\u003cbr\u003e\nTroubleshooting\u003cbr\u003e\n\n## Common Issues\u003cbr\u003e\n#### Port Conflicts:\u003cbr\u003e\n* Ensure ports 3000, 5001, and 5602 are not in use.\u003cbr\u003e\n* Update `docker-compose.yml` or application code to use alternative ports if needed.\u003cbr\u003e\n#### Timeout Connecting to index_server:\u003cbr\u003e\n* Verify that the `index_server` is running and accessible on port 5602.\u003cbr\u003e\n#### Check Docker logs for errors:\u003cbr\u003e\n* docker-compose logs index_server\u003cbr\u003e\n#### Empty Replies from Server:\u003cbr\u003e\n* Check if `.env` contains a valid OpenAI API key.\u003cbr\u003e\n* Ensure the `index_server` is initialized with documents in the `/app/data` directory.\u003cbr\u003e\n## Development\u003cbr\u003e\n\n### Backend\u003cbr\u003e\n* Install dependencies:\u003cbr\u003e\n`pip install -r backend/requirements.txt`\u003cbr\u003e\n* Run the Flask API server:\u003cbr\u003e\n`python backend/app.py`\u003cbr\u003e\n### Frontend\u003cbr\u003e\n* Install dependencies:\u003cbr\u003e\n`cd frontend`\u003cbr\u003e\n`npm install`\u003cbr\u003e\n* Start the React development server:\u003cbr\u003e\n`npm start`\u003cbr\u003e\n## Contributing\u003cbr\u003e\n\n### Contributions are welcome! Please follow these steps:\u003cbr\u003e\n\n* Fork the repository.\u003cbr\u003e\n* Create a new branch for your feature or bug fix.\u003cbr\u003e\n* Submit a pull request with a detailed explanation of your changes.\u003cbr\u003e\n### License\u003cbr\u003e\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchitrakumarsai%2Frag_app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchitrakumarsai%2Frag_app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchitrakumarsai%2Frag_app/lists"}