Easy 100% Local RAG Tutorial (Ollama) + Full Code

preview_player
Показать описание
Easy 100% Local RAG Tutorial (Ollama) + Full Code

GitHub Code:

👊 Become a member and get access to GitHub and Code:

🤖 Great AI Engineer Course:

📧 Join the newsletter:

🌐 My website:

Links:

In this video I create a 100% local RAG in around 70 lines of code. Feel free to share and rate on GitHub :)

00:00 Local RAG Intro
02:01 Local RAG Full Tutorial
Рекомендации по теме
Комментарии
Автор

Just want to say that you're probably one of the easiest to follow and most intuitive persons I've seen on YouTube doing guides for LLMs!
Thanks!

streetroller
Автор

So far, some of my "key findings" regarding "different Ollama-supported models" include: 1/5. Use OpenAI's "text-embedding-3-large" for high-quality embeddings -- but it is somewhat expensive. 2/5. Use "text-embedding-3-small" for a balance between performance and cost. 3/5. In addition to "llama3.1:8b", the "mistral:latest" model has good performance across various tasks. 4/5. For PDF's, use text extraction tools like PyPDF2 or pdfminer, but we must remove or skip encoding errors. Finding the ideal chunk size and overlap is difficult! 5/5: We must set up good benchmark datasets of relevant PDFs to compare results. ALSO: Unfortunately, "faiss-gpu" appears to be deprecated but an older conda version can be run under MS Win 10/11; however, the latest version appears to run only under Linux and, perhaps, Mac OS !?!?!

davidtindell
Автор

Really appreciate all your content and how much energy you put into learning all this and sharing it. Thanks buddy

crawfordscottd
Автор

pdf.py has been replaced with upload.py (which handles pdf, txt and json)

frudhammy
Автор

Again, Thank You! As you suggest this local RAG program works fairly well and is certainly 'good enough' for my personal use cases.

davidtindell
Автор

Hey! There's any solution to make a good RAG like this using ollama on Openwebui?

rickmarques
Автор

very interesting. issues: 1. it uses tkinter! 2. it strips the text from the pdf so it doesn't preserve page numbers - so you can't ask questions about where the text was found.

joshuapaul
Автор

The discord link is still not working for me. Says it’s expired. Did you update the link or is this something on my end?

gumshoe
Автор

So if I want to teach my AI my uni lessons, should I make all my pptx pdf docx files in to a single pdf . I am new to AI training and I am kinda struggling

benafedeyim
Автор

didnt work for me, despite what the video said the code is using from openai import OpenAI

ronaldreck
Автор

can I add a folder including multiple PDFs and txts?

mrkubajski
Автор

Does anyone else's script get stuck on generating the embeddings when you run it?

michaelgoralski
Автор

it works after ollama run mistral this thank you

SSHVWork-pxry
Автор

I get the following error:

python localrag.py
Traceback (most recent call last):
File "/Users/eil-its/Documents/experiments/workspace-python/llama3rag/localrag.py", line 130, in <module>
response = ollama.embeddings(model='mxbai-embed-large', prompt=content)
File "/Users/eil-its/Documents/experiments/workspace-python/llama3rag/llama/lib/python3.9/site-packages/ollama/_client.py", line 198, in embeddings
return self._request(
File "/Users/eil-its/Documents/experiments/workspace-python/llama3rag/llama/lib/python3.9/site-packages/ollama/_client.py", line 73, in _request
raise ResponseError(e.response.text, e.response.status_code) from None
ollama._types.ResponseError: failed to generate embedding

BalvinderNagi
Автор

Thank you so much for this tutorial, Could you make a video with some use cases with RAG in your daily life?

iagraus
Автор

I am experimenting with different Ollama-supported models and embedding models to see what current works 'best' for PDF's. Any Recommendations ? Thank You.

davidtindell
Автор

Cool Beans! Thanks so very much you have helped me enormously.
Thanks again

ddricci
Автор

Hi, thank you for the brilliant video and tutorial! I was wondering if you had any experience with implementing this process with LlaMA3 rather than Mistral, or if there was any difference in the implementation? Thank you :)

Thressian
Автор

Please how would you advice we run this on JSON files, not PDF.

I have several Q-A in . JSON format, not PDF.

CharlesOkwuagwu
Автор

Getting this error: import PyPDF2
File "C:\Anaconda\lib\site-packages\PyPDF2\__init__.py", line 12, in <module>
from ._encryption import PasswordType
File "C:\Anaconda\lib\site-packages\PyPDF2\_encryption.py", line 34, in <module>
from ._utils import logger_warning
File "C:\Anaconda\lib\site-packages\PyPDF2\_utils.py", line 55, in <module>
from typing_extensions import TypeAlias
ModuleNotFoundError: No module named 'typing_extensions'

brianclark