Skip to content

Commit 52da03d

Browse files
authored
Merge pull request #771 from vanna-ai/revert-748-main
Revert "feat: support pgvecto.rs"
2 parents 856dfa9 + f1074f7 commit 52da03d

File tree

3 files changed

+7
-278
lines changed

3 files changed

+7
-278
lines changed

src/vanna/pgvector/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
from .pgvector import PG_VectorStore
2-
from .pgvecto_rs import PG_Vecto_rsStore

src/vanna/pgvector/pgvecto_rs.py

Lines changed: 0 additions & 269 deletions
This file was deleted.

src/vanna/pgvector/pgvector.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from .. import ValidationError
1212
from ..base import VannaBase
1313
from ..types import TrainingPlan, TrainingPlanItem
14-
from ..utils import deterministic_uuid
1514

1615

1716
class PG_VectorStore(VannaBase):
@@ -56,7 +55,7 @@ def add_question_sql(self, question: str, sql: str, **kwargs) -> str:
5655
},
5756
ensure_ascii=False,
5857
)
59-
id = deterministic_uuid(question_sql_json) + "-sql"
58+
id = str(uuid.uuid4()) + "-sql"
6059
createdat = kwargs.get("createdat")
6160
doc = Document(
6261
page_content=question_sql_json,
@@ -67,7 +66,7 @@ def add_question_sql(self, question: str, sql: str, **kwargs) -> str:
6766
return id
6867

6968
def add_ddl(self, ddl: str, **kwargs) -> str:
70-
_id = deterministic_uuid(ddl) + "-ddl"
69+
_id = str(uuid.uuid4()) + "-ddl"
7170
doc = Document(
7271
page_content=ddl,
7372
metadata={"id": _id},
@@ -76,7 +75,7 @@ def add_ddl(self, ddl: str, **kwargs) -> str:
7675
return _id
7776

7877
def add_documentation(self, documentation: str, **kwargs) -> str:
79-
_id = deterministic_uuid(documentation) + "-doc"
78+
_id = str(uuid.uuid4()) + "-doc"
8079
doc = Document(
8180
page_content=documentation,
8281
metadata={"id": _id},
@@ -95,7 +94,7 @@ def get_collection(self, collection_name):
9594
case _:
9695
raise ValueError("Specified collection does not exist.")
9796

98-
def get_similar_question_sql(self, question: str, **kwargs) -> list:
97+
def get_similar_question_sql(self, question: str) -> list:
9998
documents = self.sql_collection.similarity_search(query=question, k=self.n_results)
10099
return [ast.literal_eval(document.page_content) for document in documents]
101100

@@ -204,7 +203,7 @@ def remove_training_data(self, id: str, **kwargs) -> bool:
204203
# Commit the transaction if the delete was successful
205204
transaction.commit()
206205
# Check if any row was deleted and return True or False accordingly
207-
return result.rowcount() > 0
206+
return result.rowcount > 0
208207
except Exception as e:
209208
# Rollback the transaction in case of error
210209
logging.error(f"An error occurred: {e}")
@@ -236,9 +235,9 @@ def remove_collection(self, collection_name: str) -> bool:
236235
try:
237236
result = connection.execute(query)
238237
transaction.commit() # Explicitly commit the transaction
239-
if result.rowcount() > 0:
238+
if result.rowcount > 0:
240239
logging.info(
241-
f"Deleted {result.rowcount()} rows from "
240+
f"Deleted {result.rowcount} rows from "
242241
f"langchain_pg_embedding where collection is {collection_name}."
243242
)
244243
return True

0 commit comments

Comments
 (0)