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.7.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.7-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: metarag-0.1.7.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.7.tar.gz
Algorithm Hash digest
SHA256 ad0a69a754b97861ff7eb6a097f7b87781bc9155204807a2eeb3ca463335f2c3
MD5 f215d29499830ee2f5d742e7e1e60051
BLAKE2b-256 866a5776c0efbbf8e7986f9c6ebf14ed1c3d45dd3390ce6c9bee5b59bf92fcc8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: metarag-0.1.7-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.7-py3-none-any.whl
Algorithm Hash digest
SHA256 61c116f75eebe4727e3a92105b5b39da0ad01c259a80abd71af4a4024dbc3844
MD5 51af0b5f165d0e17a080467c65a386dc
BLAKE2b-256 ec14d8453f070b2fce9854fa2fd973f0e98dae0e62e7145a41d07f1757d984a4

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