Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JSON serialization issue in ChromaDB_VectorStore #230

Merged
merged 3 commits into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/vanna/chromadb/chromadb_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def add_question_sql(self, question: str, sql: str, **kwargs) -> str:
{
"question": question,
"sql": sql,
}
},
ensure_ascii=False,
)
id = str(uuid.uuid4()) + "-sql"
self.sql_collection.add(
Expand Down Expand Up @@ -154,10 +155,10 @@ def remove_training_data(self, id: str, **kwargs) -> bool:
return True
else:
return False

def remove_collection(self, collection_name: str) -> bool:
"""
This function can reset the collection to empty state.
This function can reset the collection to empty state.

Args:
collection_name (str): sql or ddl or documentation
Expand Down Expand Up @@ -185,15 +186,15 @@ def remove_collection(self, collection_name: str) -> bool:
return True
else:
return False

@staticmethod
def _extract_documents(query_results) -> list:
"""
Static method to extract the documents from the results of a query.

Args:
query_results (pd.DataFrame): The dataframe to use.

Returns:
List[str] or None: The extracted documents, or an empty list or single document if an error occurred.
"""
Expand Down