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

Поділитися
Вставка
  • Опубліковано 3 лип 2024
  • Easy 100% Local RAG Tutorial (Ollama) + Full Code
    GitHub Code:
    github.com/AllAboutAI-YT/easy...
    👊 Become a member and get access to GitHub and Code:
    / allaboutai
    🤖 Great AI Engineer Course:
    scrimba.com/learn/aiengineer?...
    📧 Join the newsletter:
    www.allabtai.com/newsletter/
    🌐 My website:
    www.allabtai.com
    Links:
    huggingface.co/sentence-trans...
    ollama.com/download
    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
  • Наука та технологія

КОМЕНТАРІ • 68

  • @streetroller1000
    @streetroller1000 2 місяці тому +10

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

    • @AllAboutAI
      @AllAboutAI  2 місяці тому +1

      thnx mate:) appriciate it!

  • @crawfordscott3d
    @crawfordscott3d 2 місяці тому +1

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

  • @_TheDudeAbides_
    @_TheDudeAbides_ 28 днів тому

    Thanks for this video!

  • @nic-ori
    @nic-ori 2 місяці тому +3

    👍Thanks! Useful information.👍

    • @AllAboutAI
      @AllAboutAI  2 місяці тому

      no problem:) tnx for tuning in!

  • @davidtindell950
    @davidtindell950 Місяць тому +1

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

  • @SSHVWork-px6ry
    @SSHVWork-px6ry 2 місяці тому +1

    it works after ollama run mistral this thank you

  • @JNET_Reloaded
    @JNET_Reloaded 2 місяці тому

    very good stuff

  • @ddricci12
    @ddricci12 Місяць тому

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

  • @enesgul2970
    @enesgul2970 2 місяці тому +1

    Harikasınız

  • @ia360graus
    @ia360graus 2 місяці тому +1

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

  • @gilzonme
    @gilzonme 2 місяці тому

    Oh Man that worksssssssssss!

  • @joshuapaul8042
    @joshuapaul8042 2 місяці тому +1

    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.

  • @davidtindell950
    @davidtindell950 3 дні тому +1

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

  • @michaelgoralski8028
    @michaelgoralski8028 25 днів тому +2

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

  • @Anzeljaeg
    @Anzeljaeg 16 днів тому

    Hello sir lets get this on!!!

  • @leadnauta
    @leadnauta Місяць тому

    muchas gracias, muy util, funciono el codigo

  • @Thressian
    @Thressian Місяць тому

    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 :)

  • @pm1234
    @pm1234 2 місяці тому

    Great! Thank you! I'd like to have the same for local code (django). One liners won't work, so how to do this?

  • @Dylan-jq7hu
    @Dylan-jq7hu 2 місяці тому

    Will you be doing a video’s on ChatGPT the App version anymore?

  • @VeronicaAngelesEscudero
    @VeronicaAngelesEscudero Місяць тому

    Thanks to share your kwoledge with us! I have some questions because i have a similar code but it is not work as welll when the context is so extensive, how can i do? also, the chatbot lost when the history chat is large, i don't know hot to fix it. Yo have some idea? thanks

  • @gumshoe9496
    @gumshoe9496 2 місяці тому +4

    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?

  • @mrkubajski9528
    @mrkubajski9528 2 місяці тому

    can I add a folder including multiple PDFs and txts?

  • @positivevibe142
    @positivevibe142 2 місяці тому

    What if my pdf has like a 1 million word/token, would this still work?

  • @benafedeyim
    @benafedeyim 10 днів тому

    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

  • @cclementson1986
    @cclementson1986 2 місяці тому

    How would you deploy this in AWS for production? Would you use ollama and download the entire LLM model on an EC2 instance?

    • @ashishkgp
      @ashishkgp 2 місяці тому

      use an inference endpoint for llm and a cpu based ec2 instance. It may be cheaper

  • @rickmarques10
    @rickmarques10 2 місяці тому

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

  • @luisjaimes9849
    @luisjaimes9849 Місяць тому

    Great! How to remove pdf?

  • @sebastianbecerra1034
    @sebastianbecerra1034 2 місяці тому +1

    no working in mac

  • @CharlesOkwuagwu
    @CharlesOkwuagwu 2 місяці тому

    Please how would you advice we run this on JSON files, not PDF.
    I have several Q-A in . JSON format, not PDF.

    • @ClipsofCoolStuff
      @ClipsofCoolStuff 2 місяці тому +3

      I made a pull request to the repo and he accepted it. If you repull the repo you should now have access to uploading PDF, TXT, and JSON files into the context.

  • @fernabot
    @fernabot 2 місяці тому

    Really nice work! .. but is this really fully local? ... OpenAI?

  • @brianclark4639
    @brianclark4639 2 місяці тому

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

  • @frudhammy2371
    @frudhammy2371 2 місяці тому +3

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

    • @ThriftyEngineer
      @ThriftyEngineer 2 місяці тому

      Thank you! I was stuck here.

    • @mikaelroed2107
      @mikaelroed2107 Місяць тому

      neither work for me, do I need to install something?

  • @frosti7
    @frosti7 25 днів тому

    awesome, i dont get it, anything easier that does not require any code ? thank you :)

  • @user---------
    @user--------- 2 місяці тому

    Which video card and how much memory?

  • @TheHistoryCode125
    @TheHistoryCode125 2 місяці тому +15

    This video is a misleading tutorial that oversimplifies the process of creating a local RAG (Retrieval Augmented Generation) system. While the presenter claims to create a "100% local RAG in around 70 lines of code," they fail to address the complexities and limitations of such a system. The tutorial relies heavily on pre-built libraries and models, such as Ollama and sentence-transformers, without providing a deep understanding of how these components work together. Moreover, the presenter does not discuss the potential drawbacks of using a local RAG system, such as the limited amount of data it can handle and the lack of real-time updates. The video may give viewers a false sense of ease in implementing a RAG system, without considering the necessary expertise and resources required for a robust and reliable solution.

    • @sluggy6074
      @sluggy6074 2 місяці тому +24

      Thanks, GPT 4.

    • @pm1234
      @pm1234 2 місяці тому +9

      FYI GPTZero states this comment is 100% AI generated.

    • @userou-ig1ze
      @userou-ig1ze 2 місяці тому +2

      Jeez, it almost academic if it weren't reeking of AI

    • @bolonekoplo2561
      @bolonekoplo2561 Місяць тому

      Hahaha 😂 ​@@userou-ig1ze

    • @ipoop4359
      @ipoop4359 2 дні тому

      Well no shit no one’s gonna write a whole semantic search on parsed documents. Thats like saying “im gonna program my own garbage collector in java”

  • @BalvinderNagi
    @BalvinderNagi 2 місяці тому +3

    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
    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

  • @SSHVWork-px6ry
    @SSHVWork-px6ry 2 місяці тому

    raise self._make_status_error_from_response(err.response) from None
    openai.NotFoundError: Error code: 404 - {'error': {'message': "model 'mistral' not found, try pulling it first", 'type': 'api_error', 'param': None, 'code': None}}

    • @grahaml6072
      @grahaml6072 2 місяці тому

      You have to download the model. ollama pull mistral

  • @kumarrohit557
    @kumarrohit557 2 місяці тому +2

    i found an error when i run localrag.py
    File "D:\easy-local-rag-main\localrag.py", line 134, in
    response = ollama.embeddings(model='mxbai-embed-large', prompt=content)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\site-packages\ollama\_client.py", line 198, in embeddings
    return self._request(
    ^^^^^^^^^^^^^^
    File "C:\Users\HP\AppData\Local\Programs\Python\Python312\Lib\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

    • @kumarrohit557
      @kumarrohit557 2 місяці тому

      please guide

    • @EduardoJGaido
      @EduardoJGaido 2 місяці тому

      @@kumarrohit557 have you tried before doing that ollama pull mxbai-embed-large ?

    • @Mike-dl7gt
      @Mike-dl7gt 3 дні тому

      ollama pull mxbai-embed-large

    • @Mike-dl7gt
      @Mike-dl7gt 3 дні тому

      @@EduardoJGaido .

    • @Mike-dl7gt
      @Mike-dl7gt 3 дні тому

      @@kumarrohit557 .

  • @pojomcbooty
    @pojomcbooty 2 місяці тому

    This is pretty epic !! I wonder if pdfplumber might be a better fit than pypdf2 ?
    I have been working with plain text and that works great, but a simple text-only PDF downloaded from google docs gets quite garbled. maybe pdfplumber might not be much better tbh but I've generally heard it's very solid.
    I also wonder how difficult would it be to add re-ranking / recursive retrieval / corrective RAG ? are any of those even necessary given the way sentence transformers work ?
    Either way - big kudos for all your awesome work and sharing it with the commuity !!

    • @pojomcbooty
      @pojomcbooty 2 місяці тому

      would also love a comparison with a RAG based on knowledge graph (high level) - if anybody can graph this out and explain this well, it's you !! I've watched pretty much every youtube video there is that promises the earth from PrivateGPT etc. but you are dispensing actual knowledge !!!