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
rag_engine-0.1.2.tar.gz
(7.3 kB
view hashes)
Built Distribution
Close
Hashes for rag_engine-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13f917e2010d3e1e7f946d2d8117b6056c5505d962baa7197ec100f349a60669 |
|
MD5 | aacec4c29ce92d423cc635f66e41d369 |
|
BLAKE2b-256 | fd5fb69454834361e0e2c979519a61de4b92b30f59b45f130c0c7cf053f6910d |