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.
Release files for rag-engine 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rag_engine-0.1.2.tar.gz | 7.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rag_engine-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / rag_engine-0.1.2.tar.gz
| Download URL | rag_engine-0.1.2.tar.gz |
|---|---|
| Size | 7.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a3294b9f9998a3a8f69401b42a2253c2dc8305a7f56e63174a7d3af571d30983
|
|
BLAKE2b-256 checksum How to use checksums |
f3404ba303195d695a9aa0579ff7ef2e221a22a011617d737366717533e0f1c2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|
Release files / rag_engine-0.1.2-py3-none-any.whl
| Download URL | rag_engine-0.1.2-py3-none-any.whl |
|---|---|
| Size | 7.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13f917e2010d3e1e7f946d2d8117b6056c5505d962baa7197ec100f349a60669
|
|
BLAKE2b-256 checksum How to use checksums |
fd5fb69454834361e0e2c979519a61de4b92b30f59b45f130c0c7cf053f6910d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.2
|