{"id":14959598,"url":"https://github.com/amscotti/local-llm-with-rag","last_synced_at":"2025-04-04T09:06:58.136Z","repository":{"id":205714728,"uuid":"714808642","full_name":"amscotti/local-LLM-with-RAG","owner":"amscotti","description":"Running local Language Language Models (LLM) to perform Retrieval-Augmented Generation (RAG)","archived":false,"fork":false,"pushed_at":"2025-02-12T23:09:39.000Z","size":19057,"stargazers_count":220,"open_issues_count":0,"forks_count":41,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-04-04T09:06:43.508Z","etag":null,"topics":["chatbot","embeddings","langchain","llm","mistral","ollama","python","rag","retrieval-augmented-generation","streamlit"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amscotti.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-11-05T21:35:34.000Z","updated_at":"2025-04-02T16:46:11.000Z","dependencies_parsed_at":"2023-11-09T02:34:43.508Z","dependency_job_id":"b245db94-4034-4785-b698-c441c30ccaa2","html_url":"https://github.com/amscotti/local-LLM-with-RAG","commit_stats":{"total_commits":7,"total_committers":1,"mean_commits":7.0,"dds":0.0,"last_synced_commit":"616df4b402350f676dace31338d9bb34421ee780"},"previous_names":["amscotti/local-llm-with-rag"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amscotti%2Flocal-LLM-with-RAG","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amscotti%2Flocal-LLM-with-RAG/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amscotti%2Flocal-LLM-with-RAG/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amscotti%2Flocal-LLM-with-RAG/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amscotti","download_url":"https://codeload.github.com/amscotti/local-LLM-with-RAG/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149500,"owners_count":20891954,"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":["chatbot","embeddings","langchain","llm","mistral","ollama","python","rag","retrieval-augmented-generation","streamlit"],"created_at":"2024-09-24T13:20:11.564Z","updated_at":"2025-04-04T09:06:58.117Z","avatar_url":"https://github.com/amscotti.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Local LLM with RAG\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"images/wizard_experimenting.jpg\" alt=\"A wizard experimenting - Leonardo AI\" width=\"600\"\u003e\n\u003c/p\u003e\n\nThis project is an experimental sandbox for testing out ideas related to running local Large Language Models (LLMs) with [Ollama](https://ollama.ai/) to perform Retrieval-Augmented Generation (RAG) for answering questions based on sample PDFs. In this project, we are also using Ollama to create embeddings with the [nomic-embed-text](https://ollama.com/library/nomic-embed-text) to use with [Chroma](https://docs.trychroma.com/). Please note that the embeddings are reloaded each time the application runs, which is not efficient and is only done here for testing purposes.\n\n[![asciicast](https://asciinema.org/a/fepTvXf1UiDpRUhhNiswL8isu.svg)](https://asciinema.org/a/fepTvXf1UiDpRUhhNiswL8isu)\n\nThere is also a web UI created using [Streamlit](https://streamlit.io/) to provide a different way to interact with Ollama.\n\n\u003cp align=\"center\"\u003e\n    \u003cimg src=\"images/streamlit_ui.png\" alt=\"Screenshot of Streamlit web UI\" width=\"600\"\u003e\n\u003c/p\u003e\n\n## Requirements\n\n- [Ollama](https://ollama.ai/) verson 0.5.7 or higher.\n\n## Setup\n\n1. Clone this repository to your local machine.\n2. Install UV using instructions from the Astral site, [Installation](https://docs.astral.sh/uv/#installation)\n3. Create a virtual environment and install the required Python packages by running `uv sync`\n\n## Running the Project\n\n**Note:** The first time you run the project, it will download the necessary models from Ollama for the LLM and embeddings. This is a one-time setup process and may take some time depending on your internet connection.\n\n1. Run the main script with `uv app.py -m \u003cmodel_name\u003e -p \u003cpath_to_documents\u003e` to specify a model and the path to documents. If no model is specified, it defaults to [mistral](https://ollama.com/library/mistral). If no path is specified, it defaults to `Research` located in the repository for example purposes.\n2. Optionally, you can specify the embedding model to use with `-e \u003cembedding_model_name\u003e`. If not specified, it defaults to [nomic-embed-text](https://ollama.com/library/nomic-embed-text).\n\nThis will load the PDFs and Markdown files, generate embeddings, query the collection, and answer the question defined in `app.py`.\n\n## Running the Streamlit UI\n\nRun the Streamlit application by executing `uv streamlit run ui.py` in your terminal.\n\nThis will start a local web server and open a new tab in your default web browser where you can interact with the application. The Streamlit UI allows you to select models, select a folder, providing an easier and more intuitive way to interact with the RAG chatbot system compared to the command-line interface. The application will handle the loading of documents, generating embeddings, querying the collection, and displaying the results interactively.\n\n## Technologies Used\n\n- [Langchain](https://github.com/langchain/langchain): A Python library for working with Large Language Model\n- [Ollama](https://ollama.ai/): A platform for running Large Language models locally.\n- [Chroma](https://docs.trychroma.com/): A vector database for storing and retrieving embeddings.\n- [PyPDF](https://pypi.org/project/PyPDF2/): A Python library for reading and manipulating PDF files.\n- [Streamlit](https://streamlit.io/): A web framework for creating interactive applications for machine learning and data science projects.\n- [UV](https://astral.sh/uv): A fast and efficient Python package installer and resolver.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famscotti%2Flocal-llm-with-rag","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famscotti%2Flocal-llm-with-rag","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famscotti%2Flocal-llm-with-rag/lists"}