Database Assistant Agent

A LangChain ReAct database agent that enables users to chat with a database using multi-hop reasoning and in-context learning to refine knowledge. It then produces the trail of SQL commands it used to extract knowledge.

Github repo🔗

This project implements a ReAct (Yao et al., 2022) database agent in LangChain. The agent engages in a feedback loop with the database, using multi-hop reasoning to iteratively query and refine its understanding. Through this process, it leverages in-context learning to build knowledge about the database schema and contents until it has enough information to answer complex user questions. Finally, it responds with both the natural-language answer and the exact SQL commands it executed to obtain the result. The project was deployed as a hugging Face Space

recording of an example run.

You can try it yourself below. Follow these steps:

  1. enter your open router key below
  2. ask it any question about the database, eg: “what is the database about?”

if the below demo is not accessible, the deployment must have gone to sleep, you can restart and try it directly from the huggingface spaces portal

References

2022

  1. ICLR 2023
    ReAct: Synergizing Reasoning and Acting in Language Models
    Shunyu Yao, Jeffrey Zhao, Dian Yu, and 4 more authors
    arXiv preprint, 2022