Skip to content

Commit

Permalink
Embedding function should always return a list of a list of vectors (#…
Browse files Browse the repository at this point in the history
…3570)

Co-authored-by: patrickaubin-abbott <[email protected]>
Co-authored-by: Li Jiang <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2024
1 parent 0d5163b commit 94064da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions autogen/agentchat/contrib/vectordb/pgvectordb.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,8 @@ def query(
cursor = self.client.cursor()
results = []
for query_text in query_texts:
vector = self.embedding_function(query_text, convert_to_tensor=False).tolist()
vector = self.embedding_function(query_text)

if distance_type.lower() == "cosine":
index_function = "<=>"
elif distance_type.lower() == "euclidean":
Expand Down Expand Up @@ -619,7 +620,7 @@ def __init__(
if embedding_function:
self.embedding_function = embedding_function
else:
self.embedding_function = SentenceTransformer("all-MiniLM-L6-v2").encode
self.embedding_function = lambda s: SentenceTransformer("all-MiniLM-L6-v2").encode(s).tolist()
self.metadata = metadata
register_vector(self.client)
self.active_collection = None
Expand Down

0 comments on commit 94064da

Please sign in to comment.