A Retrieval-Augmented Generation (RAG) Engine for managing embeddings and similarity search
Project description
RAG Engine
RAG Engine is a Python package for implementing Retrieval-Augmented Generation (RAG) using OpenAI's embeddings and a SQLite database with vector search capabilities.
Installation
You can install the RAG Engine package using pip:
pip install rag_engine
Usage
Here's a quick example of how to use RAG Engine:
import asyncio
from rag_engine import RAGEngine
async def main():
# Initialize the RAG Engine
rag = RAGEngine("database.sqlite")
# Add some sentences
sentences = ["This is a test sentence.", "Another example sentence."]
rag.add(sentences)
# Search for similar sentences
results = rag.search("test sentence", n=2)
print(results)
# Run the async function
asyncio.run(main())
Features
- Supports multiple OpenAI embedding models: ADA_002, SMALL_3, and LARGE_3
- Asynchronous operations for better performance
- SQLite database with vector similarity search
- Flexible API for adding, searching, and deleting embeddings
Development
To set up the development environment:
- Clone the repository
- Install the package with development dependencies:
pip install -e .[dev]
- Run the tests:
pytest
Note: Tests require a valid OpenAI API key. Set the OPENAI_API_KEY
environment variable before running the tests.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file rag_engine-0.1.2.tar.gz
.
File metadata
- Download URL: rag_engine-0.1.2.tar.gz
- Upload date:
- Size: 7.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3294b9f9998a3a8f69401b42a2253c2dc8305a7f56e63174a7d3af571d30983 |
|
MD5 | 29032abe9c8c50ddfb395e2cadb5d6fc |
|
BLAKE2b-256 | f3404ba303195d695a9aa0579ff7ef2e221a22a011617d737366717533e0f1c2 |
File details
Details for the file rag_engine-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: rag_engine-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13f917e2010d3e1e7f946d2d8117b6056c5505d962baa7197ec100f349a60669 |
|
MD5 | aacec4c29ce92d423cc635f66e41d369 |
|
BLAKE2b-256 | fd5fb69454834361e0e2c979519a61de4b92b30f59b45f130c0c7cf053f6910d |