vanna-ai / vanna

🤖 Chat with your SQL database 📊. Accurate Text-to-SQL Generation via LLMs using RAG 🔄.
https://vanna.ai/docs/
MIT License
9.39k stars 691 forks source link

Two optimizations: log and allow_llm_to_see_data #454

Closed peilongchencc closed 1 month ago

peilongchencc commented 1 month ago

Optimize the usage of title in the log function within base.py:

I noticed that the title variable in the log function is not actually used. For example:

    def log(self, message: str, title: str = "Info"):
        print(message)
self.log(title="LLM Response", message=llm_response)

Add the parameter allow_llm_to_see_data=False to the ask function:

When I ran my code, the terminal displayed the following message:

The LLM is not allowed to see the data in your database. Your question requires database introspection to generate the necessary SQL. Please set allow_llm_to_see_data=True to enable this.

I checked the parameters of the ask function to add this parameter but found that the ask function does not have this parameter.

Instead, this parameter is used in the ask function's sql = self.generate_sql(question=question) section. Therefore, I made this modification.

zyclove commented 1 month ago

relation: https://github.com/vanna-ai/vanna/pull/435