vanna-ai / vanna

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

AttributeError: 'MyVanna' object has no attribute 'ddl_collection' #657

Open HanJu-Chen opened 1 month ago

HanJu-Chen commented 1 month ago

A strange questions, when I run the code on vn.train(dll). This error was returned.

It happended on chromadb_vector.py def add_ddl(self, ddl: str, **kwargs) -> str: id = deterministic_uuid(ddl) + "-ddl" self.ddl_collection.add( documents=ddl, embeddings=self.generate_embedding(ddl), ids=id, ) return id

Snipaste_2024-09-27_20-20-01

Snipaste_2024-09-27_20-19-49

Does this problem have anything to do with the value of my ddl?

zainhoda commented 1 month ago

Do you have more of the stack trace?

self.ddl_collection is initialized here:

https://github.com/vanna-ai/vanna/blob/8263d0dbb52d578337937fd395aa4da684d17edc/src/vanna/chromadb/chromadb_vector.py#L48-L52

Are you possibly not calling the constructor? What does your MyVanna object setup look like?

HanJu-Chen commented 1 month ago

Do you have more of the stack trace?

self.ddl_collection is initialized here:

https://github.com/vanna-ai/vanna/blob/8263d0dbb52d578337937fd395aa4da684d17edc/src/vanna/chromadb/chromadb_vector.py#L48-L52

Are you possibly not calling the constructor? What does your MyVanna object setup look like?

That's correcectly, I made a mistake on MyVanna setup. It's not a problem. Thanks for the heads-up.