Skip to main content

RAG-LLaMA3 AI Project

We utilize Retrieval Augmented Generation on the LLaMA3 model to create an AI agent that can answer questions about bioinformatics software DNALinux. It helps users navigate through a large range of bioinformatics tools. Additionally, you will be able to create a simple RAG AI agent with your own resources.

You can check out our code at our repo.

Quick Start with Pre-installed AI Agent

  1. Install the package:

    pip install rag-llama3
    

    If you are unsure whether you have installed this package, you can use the following command:

    pip show rag_llama3
    
  2. Ask a question to our pre-installed DNALinux AI agent:

    rag-llama3 "your question goes here"
    

How to Construct Your Own RAG AI Agent

Make sure that you have already installed the package. There is a Instruction.ipynb you can use to test the code.

  1. Configuration:

    • Set up the directory paths for storing your data and Chroma database. You do not need to create them manually; just specify where they should be, and they will be automatically created:
      • input_dir: Directory for PDF, HTML files, and URLs.
      • urls_path: Path to a file named urls.txt where you put all the URLs.
      • output_dir: Directory where TextExtractor will store all .txt files (for debugging purposes).
      • chroma_db_dir: Directory where your Chroma database will be stored.
      • chroma_db_name: Collection name for your Chroma database.
    • Note: The embedding model defaults to 'mxbai-embed-large'. Feel free to choose your preferred Ollama embedding model.
    from rag_llama3 import RAG as rag
    from rag_llama3 import TextExtractor as te
    from rag_llama3 import VectorDB as vdb
    
  2. Directory Setup:

    • Open a Jupyter notebook and run the following code to ensure that your directory is created:
      test_vector_db = vdb(input_dir, output_dir, urls_path, chroma_db_dir, chroma_db_name)
      
    • This will create an object that you can use to manipulate your Chroma vector database. It will automatically create all the directories and an empty Chroma database. If everything is already created, it will not overwrite existing files.
  3. Add Files:

    • Place all PDF and HTML files in the input directory. List all URLs in the urls.txt file, each on a new line.
  4. Load Data:

    • Use the test_vector_db object to load files into the vector database:
      test_vector_db.load_data()
      
    • Alternatively, load different types of files individually:
      test_vector_db.load_url()
      test_vector_db.load_pdf()
      test_vector_db.load_html()
      
    • Loading might take some time. After loading, check if the vector database has been populated successfully:
      test_vector_db.peek()
      test_vector_db.show_sources()
      
    • Query data from a specific source:
      test_vector_db.query_sources(source_name)
      
    • To delete data from a source:
      test_vector_db.delete_source(source_name)
      
    • Or to clear the entire database (be cautious as this is destructive):
      test_vector_db.clear_database()
      
  5. Generate Answers:

    • In a Jupyter notebook, use:
      testRAG = rag(input_dir, output_dir, urls_path, chroma_db_dir, chroma_db_name, model)
      print(testRAG.generate_answer("Your question goes here"))
      

Metadata

Release files for rag-llama3 0.1.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rag-llama3 0.1.4.1
File Size Uploaded
rag_llama3-0.1.4.1.tar.gz 27.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rag-llama3 0.1.4.1
File Interpreter ABI Platform
rag_llama3-0.1.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 52.0 kB

Release files / rag_llama3-0.1.4.1.tar.gz

Download URL rag_llama3-0.1.4.1.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
9bdbc6d0c844a45cde0c2fe18d7a01885ecef2141da1babd6085a82e555f0714
BLAKE2b-256 checksum
How to use checksums
09d0ccddf763485d7c0e7ae9857a92059a7604306af85517624ff4157dfd5fa1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / rag_llama3-0.1.4.1-py3-none-any.whl

Download URL rag_llama3-0.1.4.1-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e2285742e52cbc1b067f105b2874a30202313f7d7df2ce666af968ef7c77f77
BLAKE2b-256 checksum
How to use checksums
c69085ad90500f449786909cbd1bbd56a4771f79680cb104bddf97b0d9d67c18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page