Skip to main content

MetaRAG: A multi-LLM ensemble Retrieval-Augmented Generation framework with cosine similarity ranking.

Project description

MetaRAG is a Python framework for multi-model Retrieval-Augmented Generation. It queries multiple LLMs in parallel, scores the responses based on cosine similarity with the context, and aggregates the top responses for a more accurate and comprehensive answer.

Features

  • 🔍 Multi-LLM querying using Groq's LLMs (LLaMA3, Gemma, etc.)
  • 🤝 Cosine similarity scoring of responses
  • 🧠 Top-k response aggregation
  • 📄 Works with PDFs and plain text
  • ⚡ Fast execution with thread pooling

Installation

pip install metarag

Pre-requisites

Load your GROQ_API_KEY to the project from https://console.groq.com/keys and follow the sample example shown below.

Example Usage (Local PC)

import metarag
from dotenv import load_dotenv
load_dotenv()  
def test_metarag_functionality():
    
    document_paths = ["VectorDB_Paper.pdf"]  

    rag_instance = metarag.MetaRAG(document_paths=document_paths)

    query = "What is the methodology in 5 lines like a professor and extract 5 keywords?"

    result = rag_instance.run(query)

    print(f"Aggregated Response: {result}")

if __name__ == "__main__":
    test_metarag_functionality()

On Google Colab

import metarag
import os

os.environ["GROQ_API_KEY"]="groq_api_key"

    
document_paths = ["/content/VectorDB_Paper.pdf"]  

rag_instance = metarag.MetaRAG(document_paths=document_paths)

query = "What is the methodology in 5 lines like a professor and extract 5 keywords?"

result = rag_instance.run(query)

print(f"Aggregated Response: {result}")


Requirements

Python 3.8+

License

MIT License - see LICENSE file for details.

Author

Nisharg Nargund
Founder @OpenRAG

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metarag-0.1.6.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

metarag-0.1.6-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file metarag-0.1.6.tar.gz.

File metadata

  • Download URL: metarag-0.1.6.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.7

File hashes

Hashes for metarag-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e7ce568e0cbe21ed4582991afc0ad3156c42624b7263777d3f077b78ecdc66c2
MD5 6a71f265b472c7558b7649a3e4aec153
BLAKE2b-256 b748f5cb2066970a00e1183830aea372bfc0fe6e8632846125ea0d36a00177ad

See more details on using hashes here.

File details

Details for the file metarag-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: metarag-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.7

File hashes

Hashes for metarag-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 b532b1df130ca4cce7877a1ef125f857e2efa146afa86375867fa53f7dab5022
MD5 d35de965f35c5184bafeed92a95ca4ab
BLAKE2b-256 e4ae561df6b9cc5fd832adf881bf190256100580f2a15b0c1c2aea21546d939b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page