Skip to main content

RAG based LLM chatbot for dbt projects.

Project description

Ragstar

Ragstar (inspired by RAG & select *) is a tool that enables you to ask ChatGPT questions about your dbt project.

Get Started

Installation

Ragstar can be installed via pip.

pip install ragstar

Basic Usage

How to multiply one number by another with this lib:

from ragstar import Chatbot

# Instantiate a chatbot object
chatbot = Chatbot(
	dbt_project_root='/path/to/dbt/project',
	openai_api_key='YOUR_OPENAI_API_KEY',
	# Optional:
	# embedding_model="text-embedding-3-large",
	# chatbot_model="gpt-4-turbo-preview",
	# db_persist_path"./chroma.db",
)

# Step 1. Load models information from your dbt ymls into a local vector store
chatbot.load_models(
    # Optional:
	# models=['list', 'of', 'models', 'to', 'select'],
	# included_folders=[
	# 	'folder/to/scan/for/ymls',
	#	'another/folder/here'
	# ],
	#excluded_folders=['ignore/any/yamls/found/here']
)

# 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)

# Step 3. Clear your local database (Optional).
# You only need to do this if you would like to load a different project into your db
# or restart from scratch for whatever reason.
# If you make any changes to your existing models and load them again, they get upserted into the database.
chatbot.reset_model_db()

Note: Ragstar currently only supports OpenAI ChatGPT models for generating embeddings and responses to queries.

How it works

Ragstar is based on the concept of Retrieval Augmented Generation and basically works as follows:

  • When you call the chatbot.load_models() method, Ragstar scans all the folders in the locations specified by you for dbt YML files.
  • It then converts all the models into a text description, which are stored as embeddings in a vector database. Ragstar currently only supports ChromaDB as a vector db, which is persisted in a file on your local machine.
  • When you ask a query, it fetches 3 models whose description is found to be the most relevant for your query.
  • These models are then fed into ChatGPT as a prompt, along with some basic instructions and your question.
  • The response is returned to you as a string.

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

ragstar-0.1.2.tar.gz (11.3 kB view hashes)

Uploaded Source

Built Distribution

ragstar-0.1.2-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

Supported by

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