Skip to main content

A Retrieval-Augmented Generation (RAG) framework with MongoDB and Sentence Transformers

Project description

Example usage

if __name__ == "__main__":
    mongo_url = 'your_mongo_url_here'
    db_name = 'chat-service'
    collection_name = 'rag'
    model_name = 'sentence-transformers/all-MiniLM-L6-v2'
    similarity_threshold = 0.3

    rag = RAGFramework(mongo_url, db_name, collection_name, model_name, similarity_threshold)

    # Update embeddings for existing documents
    rag.update_embeddings()

    # Insert new data
    raw_text = "This is a sample document text that needs to be inserted into MongoDB."
    result = rag.insert_data(raw_text)
    print(result)

    # Retrieve data based on a query
    query = "sample document text"
    retrieved_data = rag.retrieve_data(query)
    print(retrieved_data)

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

kolonix-rag-0.1.1.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

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

kolonix_rag-0.1.1-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file kolonix-rag-0.1.1.tar.gz.

File metadata

  • Download URL: kolonix-rag-0.1.1.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.0

File hashes

Hashes for kolonix-rag-0.1.1.tar.gz
Algorithm Hash digest
SHA256 45cef099eae3d2b7bf504b6ebf00b8ef321db37b73c7c44b00003237ce833a42
MD5 db9d3a6a482df41a39ef84c1f3b822cf
BLAKE2b-256 b81fab84e599cccccfc8ae6f1a2a8ecbfcdba98cb3322c4fd67d021975014aa5

See more details on using hashes here.

File details

Details for the file kolonix_rag-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: kolonix_rag-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.0

File hashes

Hashes for kolonix_rag-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 49a09f702f25739a8cad8f2faf5978610bb6ba31936a24150d2ff2c586d12325
MD5 107136f02f078487cb483847cc14e8fb
BLAKE2b-256 ef362602b21d07b6c8b89733627ea9fc68116079ba117597ae7f523f09b4b9d8

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