A programming framework for agentic AI
Embedding function should always return a list of a list of vectors (#3570)
paubins294064da472c4
diff --git a/autogen/agentchat/contrib/vectordb/pgvectordb.py b/autogen/agentchat/contrib/vectordb/pgvectordb.pyindex ac86802b6..6fce4a6db 100644--- a/autogen/agentchat/contrib/vectordb/pgvectordb.py+++ b/autogen/agentchat/contrib/vectordb/pgvectordb.py@@ -415,7 +415,8 @@ class Collection: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":@@ -619,7 +620,7 @@ class PGVectorDB(VectorDB):if embedding_function:self.embedding_function = embedding_functionelse:- self.embedding_function = SentenceTransformer("all-MiniLM-L6-v2").encode+ self.embedding_function = lambda s: SentenceTransformer("all-MiniLM-L6-v2").encode(s).tolist()self.metadata = metadataregister_vector(self.client)self.active_collection = None