Skip to main content

Raxo is a Python package designed to streamline the process of converting natural language queries

Project description

Raxo

GitHub

🔍 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.1.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

raxo-0.0.4.1-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file raxo-0.0.4.1.tar.gz.

File metadata

  • Download URL: raxo-0.0.4.1.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for raxo-0.0.4.1.tar.gz
Algorithm Hash digest
SHA256 0f3f6c5db64a4f6b365b1956fc3bbc8c50c03a3cea4960b2b20892b6f43eba86
MD5 f09c83bf4c0a6a570f62dcff697b6063
BLAKE2b-256 e13113aaec8f1367a5889d9b58c25aae38c6c09fa7edec92b743aae5d70af120

See more details on using hashes here.

File details

Details for the file raxo-0.0.4.1-py3-none-any.whl.

File metadata

  • Download URL: raxo-0.0.4.1-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

Hashes for raxo-0.0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7a4a721b6da6eb3237dfc07b328cdd5b6370ada71a600a752fbf466f05ffdb9a
MD5 665398c57092dc9e2f34a373f2372be4
BLAKE2b-256 8a4806d63835cf949702863743d4d9d3a237b8010f3c3bc55ef5e99d46aa8041

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page