GithubHelp home page GithubHelp logo

njirubryance / vanna Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vanna-ai/vanna

1.0 0.0 0.0 6.95 MB

Personalized AI SQL Agent

Home Page: https://vanna.ai/

License: MIT License

Python 9.53% CSS 0.01% Jupyter Notebook 89.84% Jinja 0.62%

vanna's Introduction

GitHub PyPI Documentation
GitHub PyPI Documentation

Vanna.AI - Personalized AI SQL Agent

0802.mp4

How Vanna works

Vanna works in two easy steps - train a model on your data, and then ask questions.

  1. Train a model on your data.
  2. Ask questions.

When you ask a question, we utilize a custom model for your dataset to generate SQL, as seen below. Your model performance and accuracy depends on the quality and quantity of training data you use to train your model. how-vanna-works

Getting started

You can start by automatically training Vanna (currently works for Snowflake) or add manual training data.

Install Vanna

pip install vanna

Depending on the database you're using, you can also install the associated database drivers

pip install 'vanna[snowflake]'

Import Vanna

import vanna as vn

Train with DDL Statements

If you prefer to manually train, you do not need to connect to a database. You can use the train function with other parmaeters like ddl

vn.train(ddl="""
    CREATE TABLE IF NOT EXISTS my-table (
        id INT PRIMARY KEY,
        name VARCHAR(100),
        age INT
    )
""")

Train with Documentation

Sometimes you may want to add documentation about your business terminology or definitions.

vn.train(documentation="Our business defines OTIF score as the percentage of orders that are delivered on time and in full")

Train with SQL

You can also add SQL queries to your training data. This is useful if you have some queries already laying around. You can just copy and paste those from your editor to begin generating new SQL.

vn.train(sql="SELECT * FROM my-table WHERE name = 'John Doe'")

Asking questions

vn.ask("What are the top 10 customers by sales?")
SELECT c.c_name as customer_name,
       sum(l.l_extendedprice * (1 - l.l_discount)) as total_sales
FROM   snowflake_sample_data.tpch_sf1.lineitem l join snowflake_sample_data.tpch_sf1.orders o
        ON l.l_orderkey = o.o_orderkey join snowflake_sample_data.tpch_sf1.customer c
        ON o.o_custkey = c.c_custkey
GROUP BY customer_name
ORDER BY total_sales desc limit 10;
CUSTOMER_NAME TOTAL_SALES
0 Customer#000143500 6757566.0218
1 Customer#000095257 6294115.3340
2 Customer#000087115 6184649.5176
3 Customer#000131113 6080943.8305
4 Customer#000134380 6075141.9635
5 Customer#000103834 6059770.3232
6 Customer#000069682 6057779.0348
7 Customer#000102022 6039653.6335
8 Customer#000098587 6027021.5855
9 Customer#000064660 5905659.6159

Why Vanna?

  1. High accuracy on complex datasets.
    • Vanna’s capabilities are tied to the training data you give it
    • More training data means better accuracy for large and complex datasets
  2. Secure and private.
    • Your database contents are never sent to Vanna’s servers
    • We only see the bare minimum - schemas & queries.
  3. Isolated, custom model.
    • You train a custom model specific to your database and your schema.
    • Nobody else can use your model or view your model’s training data unless you choose to add members to your model or make it public
    • We use a combination of third-party foundational models (OpenAI, Google) and our own LLM.
  4. Self learning.
    • As you use Vanna more, your model continuously improves as we augment your training data
  5. Supports many databases.
    • We have out-of-the-box support Snowflake, BigQuery, Postgres
    • You can easily make a connector for any database
  6. Pretrained models.
    • If you’re a data provider you can publish your models for anyone to use
    • As part of our roadmap, we are in the process of pre-training models for common datasets (Google Ads, Facebook ads, etc)
  7. Choose your front end.
    • Start in a Jupyter Notebook.
    • Expose to business users via Slackbot, web app, Streamlit app, or Excel plugin.
    • Even integrate in your web app for customers.

More resources

vanna's People

Contributors

zainhoda avatar arslanhashmi avatar ashishsingal1 avatar

Stargazers

Bryance avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.