GithubHelp home page GithubHelp logo

sql-agent's Introduction

SQL Agent

This is a simple SQL Agent that can be used to run SQL queries against a database using LLMs. The main advantages of using the SQL Agent are:

  • It can answer questions based on the databases’ schema as well as on the databases’ content (like describing a specific table).
  • It can recover from errors by running a generated query, catching the traceback and regenerating it correctly.
  • It can query the database as many times as needed to answer the user question.
  • It will save tokens by only retrieving the schema from relevant tables.

Setup

Before you start, you need to install poetry.

  1. Clone the repository
  2. Install the dependencies: poetry install
  3. Activate the virtual environment: poetry shell
  4. Configure the environment variables in the .env file (use the .env.example as a template)
  5. Initialize the database: python -m scripts.init_db

Running the Agent

To run the agent in CLI, you can use the following command:

python main.py

To run the agent in Streamlit, you can use the following command:

streamlit run main.py

Additional Information

For more information, please refer to the Agents LangChain documentation.

For more information about using LLMs with Streamlit, please refer to the Streamlit documentation.

sql-agent's People

Contributors

jorgeandrespadilla avatar

Watchers

Kostas Georgiou avatar  avatar

Forkers

alokmaheshwari

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.