Raxo is a Python package designed to streamline the process of converting natural language queries
Project description
Raxo
🔍 Raxo: Transform Natural Language into SQL Queries with RAG
Raxo is an MIT-licensed open-source Python framework for text-to-SQL generation using Retrieval-Augmented Generation (RAG). It simplifies the process of generating SQL queries from natural language input, making it easier to interact with databases using plain English.
Key Features:
- 🚀 Seamlessly convert natural language queries into SQL statements
- 🔧 Customize query generation to suit your specific database schema and query requirements
- 📊 Access and analyze user data efficiently with generated SQL queries
- 💻 Simple integration into existing Python projects and data pipelines
- 📚 Comprehensive documentation and examples for easy adoption and implementation
Get started with Raxo today and unlock the power of transforming text into actionable SQL queries for your data needs.
Installation
# PyPI
pip install raxo
Getting started
Refer to documentation to know more options
# Importing necessary modules
from raxo.models import OpenAIChat
from raxo.embeddings import OpenAiEmbeddings
from raxo.vector import ChromaStore
from raxo import Raxo
open_ai = OpenAIChat(api_key="<API_KEY>", model="<MODEL_NAME>")
embed = OpenAiEmbeddings(api_key="<API_KEY>",
model="<MODEL_NAME>")
chroma = ChromaStore(em_function=embed)
# passing the required functions to create a raxo object
raxo = Raxo(llm=open_ai, vector_db=chroma, em_function=embed)
Training Raxo
If you want to train the raxo [optional]
raxo.train(ddl="""
CREATE TABLE Customer (
CustomerID INT,
FirstName VARCHAR(100),
LastName VARCHAR(100),
Email VARCHAR(255),
Phone VARCHAR(20),
PRIMARY KEY (CustomerID)
)""")
You can add raxo by adding relevant documentation.
raxo.train(documentation="The table contains records of customers of a store")
Train by adding valid SQL's
raxo.train(sql="SELECT DISTINCT FirstName FROM Customer")
Generating SQL
sql = raxo.ask("what are my region sales")
print(sql)
You will get the output
SELECT SUM(Sales), Region FROM sales_data GROUP BY Region ORDER BY SUM(sales);
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
raxo-0.0.4.tar.gz
(15.6 kB
view details)
Built Distribution
raxo-0.0.4-py3-none-any.whl
(21.3 kB
view details)
File details
Details for the file raxo-0.0.4.tar.gz
.
File metadata
- Download URL: raxo-0.0.4.tar.gz
- Upload date:
- Size: 15.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6454c4033ddecbaaef9e9b43b09734ab0be1759e116c5f2642bb2d548dd69892 |
|
MD5 | 938e3d13389a1eabd096e91a40e68a58 |
|
BLAKE2b-256 | 8103bc9b2ead9bb7fa9b5da460924718291755d328bbd90b92cd7fe69015b079 |
File details
Details for the file raxo-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: raxo-0.0.4-py3-none-any.whl
- Upload date:
- Size: 21.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9ee218092968716a53ae07d907c1fce60ce8c17f11498f611c20e8f1cf18e5cb |
|
MD5 | 19a9e7dea191dfe073e8b6172294aa9f |
|
BLAKE2b-256 | 6694ca62c7bae41464b6144f35a7e4f91aaf1dd84a301691e8bbf1f1e9ac0b5f |