Replies: 1 comment
-
I would recommend adding a lot more reference SQL queries: https://vanna.ai/docs/training-advice/ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
A clear and concise description of what the bug is.
Python script:
from vanna.ollama import Ollama
from vanna.chromadb import ChromaDB_VectorStore
class MyVanna(ChromaDB_VectorStore, Ollama):
def init(self, config=None):
ChromaDB_VectorStore.init(self, config=config)
Ollama.init(self, config=config)
vn = MyVanna(config={"model": "llama3.1"})
vn.connect_to_sqlite("./data/mydatabase.db")
df_ddl = vn.run_sql("SELECT type, sql FROM sqlite_master WHERE sql is not null")
for ddl in df_ddl["sql"].to_list():
vn.train(ddl=ddl)
The following are methods for adding training data. Make sure you modify the examples to match your database.
DDL statements are powerful because they specify table names, colume names, types, and potentially relationships
vn.train(
ddl="""
CREATE TABLE users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100)
);
"""
)
Sometimes you may want to add documentation about your business terminology or definitions.
vn.train(
documentation="Our business defines OTIF score as the percentage of orders that are delivered on time and in full"
)
You can also add SQL queries to your training data. This is useful if you have some queries already laying around. You can just copy and paste those from your editor to begin generating new SQL.
vn.train(sql="SELECT * FROM users WHERE name = 'John Doe'")
At any time you can inspect what training data the package is able to reference
training_data = vn.get_training_data()
training_data
You can remove training data if there's obsolete/incorrect information.
vn.remove_training_data(id='1-ddl')
vn.ask(question="What is the email from John Doe?")
DB details
Ollama response
Expected behavior
Retrieve the proper data.
Error logs/Screenshots
If applicable, add logs/screenshots to give more information about the issue.
Desktop (please complete the following information where):
Additional context
Beta Was this translation helpful? Give feedback.
All reactions