{"id":25076251,"url":"https://github.com/v-ade-r/llm-with-rag-full-opensource","last_synced_at":"2025-05-12T14:09:20.369Z","repository":{"id":239201561,"uuid":"798854204","full_name":"v-ade-r/LLM-with-RAG-full-opensource","owner":"v-ade-r","description":"LLM with RAG example for querying URLs or PDFs with Ollama and Gradio/Flask","archived":false,"fork":false,"pushed_at":"2024-05-12T23:48:35.000Z","size":1678,"stargazers_count":3,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-14T01:48:29.542Z","etag":null,"topics":["flask","gradio","llm","ollama","rag"],"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/v-ade-r.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-05-10T16:00:58.000Z","updated_at":"2025-01-17T11:43:57.000Z","dependencies_parsed_at":"2024-05-13T00:27:12.029Z","dependency_job_id":null,"html_url":"https://github.com/v-ade-r/LLM-with-RAG-full-opensource","commit_stats":null,"previous_names":["v-ade-r/llm-with-rag-full-opensource"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-ade-r%2FLLM-with-RAG-full-opensource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-ade-r%2FLLM-with-RAG-full-opensource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-ade-r%2FLLM-with-RAG-full-opensource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/v-ade-r%2FLLM-with-RAG-full-opensource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/v-ade-r","download_url":"https://codeload.github.com/v-ade-r/LLM-with-RAG-full-opensource/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246552893,"owners_count":20795836,"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":["flask","gradio","llm","ollama","rag"],"created_at":"2025-02-07T01:35:10.512Z","updated_at":"2025-03-31T22:43:20.635Z","avatar_url":"https://github.com/v-ade-r.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LLM-with-RAG-full-opensource\n\nThis code enables you to utilize opensource LLMs locally with the RAG function. You can feed the LLM model with the data from a URL or PDF, resulting in improved answers as the LLM's inference is mostly based on the supplied data.\n\nIt wasn't easy to find a free reliable tutorial on this topic, especially when I wanted to use only opensource and run it locally, so that's why I decided to share this code. Finally, I found a super effective sollution here: https://www.youtube.com/watch?v=jENqvjpkwmw\u0026list=LL\u0026index=3. My code is essentially the same at its core. However, I made some small tweaks here and there, modified the Gradio part a bit, and added the Flask part. \n\u003cbr\u003e\u003cbr\u003e\n\n**General step by step tutorial:**\n1. Download Ollama (Ollama allows you to run open-source large language models locally) from https://ollama.com/, and install it.\n2. Go to https://ollama.com/models, and find the name of a model you want to try, and which your hardware will be able to handle. \"mistral\" 7b or \"llama3\" are always a good deafault bets. \"mwiewior/bielik\" for polish language only.\n3. Download a model by openning command line and typing: Ollama pull mistral. Or swap mistral for a model name of your choice.\n4. Install needed packages.\n\u003cbr\u003e\u003cbr\u003e\n\n**Querying URL with/without RAG:**\\\n\u0026emsp;5. Just follow the code.\n\n**Querying PDF:**\\\n\u0026emsp;5. Just follow the code. Put pdf file in your project folder, or supply adequate path to it for PyPDFLoader.\n\n**Using Gradio:**\\\n\u0026emsp;5. Just follow the code. Run the code, and put http://127.0.0.1:7860 in browser to test it locally, or add in .launch(share=True) to share the generated link with others.\n\n**Using Flask:**\\\n\u0026emsp;5. Create in your project folder, a folder for temporarily storing PDFs.\\\n\u0026emsp;6. Create in your project folder, a folder named templates.\\\n\u0026emsp;7. In templates folder create a file named index3.html and setup everything there or just download mine. A few hints about customizations are even there.\\\n\u0026emsp;8. Just follow the code.\\\n\u0026emsp;9. Run the code, go to http://127.0.0.1:5000, and test it.\\\n\n**Problems to solve in the future:**\n - It's very slow for big PDF files (around few minutes)\n - It doesn't handle well PDFs with a lot of tables, pictures and strange objects.\n - After few questions usually the restart is needed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv-ade-r%2Fllm-with-rag-full-opensource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fv-ade-r%2Fllm-with-rag-full-opensource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fv-ade-r%2Fllm-with-rag-full-opensource/lists"}