{"id":24794070,"url":"https://github.com/njaffe/llm_rag_app","last_synced_at":"2026-04-19T14:01:25.881Z","repository":{"id":272965925,"uuid":"917435428","full_name":"njaffe/llm_rag_app","owner":"njaffe","description":"Sample LLM RAG app using APIs, Flask and ChromaDB.","archived":false,"fork":false,"pushed_at":"2025-01-17T17:55:30.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T17:53:50.023Z","etag":null,"topics":["api","flask","langchain","llms","python","rag","vector-database"],"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/njaffe.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":"2025-01-16T01:22:42.000Z","updated_at":"2025-01-17T19:24:10.000Z","dependencies_parsed_at":"2025-01-17T18:40:27.058Z","dependency_job_id":"d44ec03e-a3a7-4d8e-a907-d911d2182927","html_url":"https://github.com/njaffe/llm_rag_app","commit_stats":null,"previous_names":["njaffe/llm_rag_app"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/njaffe/llm_rag_app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njaffe%2Fllm_rag_app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njaffe%2Fllm_rag_app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njaffe%2Fllm_rag_app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njaffe%2Fllm_rag_app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/njaffe","download_url":"https://codeload.github.com/njaffe/llm_rag_app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/njaffe%2Fllm_rag_app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32009239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T20:23:30.271Z","status":"online","status_checked_at":"2026-04-19T02:00:07.110Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api","flask","langchain","llms","python","rag","vector-database"],"created_at":"2025-01-29T22:32:48.511Z","updated_at":"2026-04-19T14:01:25.821Z","avatar_url":"https://github.com/njaffe.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM RAG App\n\nThis is a Flask-based web application that leverages a Retrieval-Augmented Generation (RAG) approach to answer questions based on documents stored in a specified directory. The application uses OpenAI’s GPT-3.5 model combined with a Chroma vector store to retrieve relevant information from documents and generate answers.\n\n## Key Features:\n\n- Document Ingestion: Load .txt documents into the Chroma vector store.\n- Retrieval: The model retrieves relevant information from documents based on the query provided.\n- Generation: The LLM (language model) generates an answer based on the context retrieved.\n- Flask API: A simple Flask API endpoint to handle user queries.\n\n## Technologies:\n\n- **Flask**: Lightweight web framework for Python.\n- **Gunicorn**: Python WSGI HTTP server for UNIX that serves the Flask app.\n- **LangChain**: Framework for building applications using LLMs, vector stores, and document retrieval.\n- **Chroma**: Vector database used for storing and retrieving document embeddings.\n- **GPT-3.5**: Our LLM used for question answering based on retrieved documents.\n\n## Setup\n\n### Prerequisites:\n\n1.\tPython 3.8+ installed.\n2.\tA .env file containing your OpenAI API key.\n3.\tA directory (data/) containing .txt documents for the model to process.\n\n### Installation:\n\n1.\tClone this repository:\n\n`git clone https://github.com/your-username/llm_rag_app.git`\n\n`cd llm_rag_app`\n\n2.\tInstall the required dependencies:\n\n`pip install -r requirements.txt`\n\n3.\tCreate a .env file in the root of the project and add your OpenAI API key:\n\n`OPENAI_API_KEY=your-openai-api-key`\n\n`DATA_FOLDER=data/`\n\n4.\tEnsure you have some .txt files in the data/ directory.\n\n## Usage\n\n### Running the Application:\n\nTo start the Flask app, run:\n\n`gunicorn -w 4 -b 0.0.0.0:6000 app:app \u0026`\n\nThen submit a request using:\n\n`curl -X POST http://0.0.0.0:6000/ask -H \"Content-Type: application/json\" -d '{\"query\": \"\u003cYour question\u003e\"}'`\n\n## Notes:\n\n- The data/ directory is where the text documents are stored. The app loads all .txt files in this directory when responding to queries.\n- The RAG model first retrieves the most relevant document based on the query, and then the OpenAI model generates an answer based on the context.\n\n## Troubleshooting:\n\n- If you encounter an error such as OPENAI_API_KEY not found, ensure that your .env file is correctly configured and located in the root of the repository.\n- If there are no documents in the data/ folder, the app will not be able to generate answers. Make sure your data/ folder contains .txt files.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjaffe%2Fllm_rag_app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnjaffe%2Fllm_rag_app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnjaffe%2Fllm_rag_app/lists"}