LLM-based tools for dbt projects
dbt-llm-tools, also known as ragstar, provides a suite of tools powered by Large Language Models (LLMs) to enhance your dbt project workflow. It allows you to ask questions about your data and generate documentation for your models.
Here is a quick demo of how the Chatbot works:
https://www.loom.com/share/abb0612c4e884d4cb8fabc22af964e7e?sid=f5f8c0e6-51f5-4afc-a7bf-51e9e182c2e7
To install dbt-llm-tools
with the UI:
gh repo clone pragunbhutani/dbt-llm-tools
cd dbt-llm-tools
make poetry
make install
make fetch_example_project
make run_client
This will launch the client in your browser at http://localhost:8501/app
.
Note: An OpenAI API key is required to use the tools.
For detailed instructions and API reference, refer to the official documentation: https://dbt-llm-tools.readthedocs.io/en/latest/
from dbt_llm_tools import Chatbot
# Instantiate a chatbot object
chatbot = Chatbot(
dbt_project_root='/path/to/dbt/project',
openai_api_key='YOUR_OPENAI_API_KEY',
)
# Step 1. Load models information from your dbt ymls into a local vector store
chatbot.load_models()
# Step 2. Ask the chatbot a question
response = chatbot.ask_question(
'How can I obtain the number of customers who upgraded to a paid plan in the last 3 months?'
)
print(response)
from dbt_llm_tools import DocumentationGenerator
# Instantiate a Documentation Generator object
doc_gen = DocumentationGenerator(
dbt_project_root="YOUR_DBT_PROJECT_PATH",
openai_api_key="YOUR_OPENAI_API_KEY",
)
# Generate documentation for a model and all its upstream models
doc_gen.generate_documentation(
model_name='dbt_model_name',
write_documentation_to_yaml=False
)
The Chatbot is based on the concept of Retrieval Augmented Generation and basically works as follows:
chatbot.load_models()
method, the bot scans all the folders in the locations specified by you for dbt YML files.