Skip to main content

A Quick Llama Text2SQL Evaluation Library

Project description

A Quick Library for Llama Text2SQL Accuracy Evaluation

This library provides a simple interface for evaluating the accuracy of Llama models on the Text2SQL task. It uses the BIRD DEV dataset and provides a simple API for running the evaluation pipeline using the Llama API.

Quick Start

  1. Run pip install llama-text2sql-eval to install the library.

  2. Download the BIRD DEV dataset by running the following commands:

mkdir -p llama-text2sql-eval/data
cd llama-text2sql-eval/data
with-proxy wget https://bird-bench.oss-cn-beijing.aliyuncs.com/dev.zip
unzip dev.zip
rm dev.zip
rm -rf __MACOSX
cd dev_20240627
unzip dev_databases.zip
rm dev_databases.zip
rm -rf __MACOSX
cd ../..
  1. Get your Llama API key here and set up an environment variable:
export LLAMA_API_KEY="your_key_here"
  1. Create a Python script and run it:
import os
from llama_text2sql_eval import LlamaText2SQLEval

evaluator = LlamaText2SQLEval()

results = evaluator.run(
    model="Llama-3.3-70B-Instruct", # or any other Llama models supported by the Llama API
    api_key=os.getenv("LLAMA_API_KEY")
)

if results:
    print(f"Overall Accuracy: {results['overall_accuracy']:.2f}%")
    print(f"Simple: {results['simple_accuracy']:.2f}%")
    print(f"Moderate: {results['moderate_accuracy']:.2f}%")
    print(f"Challenging: {results['challenging_accuracy']:.2f}%")

You should see something like:

Overall Accuracy: 57.95%
Simple: 65.30%
Moderate: 47.63%
Challenging: 44.14%

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

llama_text2sql_eval-0.0.2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llama_text2sql_eval-0.0.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file llama_text2sql_eval-0.0.2.tar.gz.

File metadata

  • Download URL: llama_text2sql_eval-0.0.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.18

File hashes

Hashes for llama_text2sql_eval-0.0.2.tar.gz
Algorithm Hash digest
SHA256 a78ea915fba0f3854d3f2371df59afb69820fac295df24c9bcf9ae2476b7d80e
MD5 796dbce6428c4669b0c35d1a9b4c034a
BLAKE2b-256 ffd7c444625ba247febf93e37b3cc06b8bcf05ce8be0b4f794c96355c9786da3

See more details on using hashes here.

File details

Details for the file llama_text2sql_eval-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for llama_text2sql_eval-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 514701002fdc1ccc1518d6951443e047d45bb6b5bae730f98e9d8f7d8ec9d10c
MD5 3e939db1140c4a849f6628683b231815
BLAKE2b-256 e58351a8559026444262b703d746e5774ddacbc5c17be53176d45709cb765cac

See more details on using hashes here.

Supported by

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