Skip to content

Commit

Permalink
change sentence transformer model
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Aug 10, 2023
1 parent ed55b46 commit 3fb716b
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions agentmemory/postgres.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import psycopg2
from sentence_transformers import SentenceTransformer


class PostgresCollection:
Expand Down Expand Up @@ -157,7 +156,10 @@ def __init__(self, connection_string):
from pgvector.psycopg2 import register_vector

register_vector(self.cur) # Register PGVector functions
self.model = SentenceTransformer("BAAI/bge-large-en")

from sentence_transformers import SentenceTransformer

self.model = SentenceTransformer("all-MiniLM-L6-v2")

def _table_name(self, category):
return f"memory_{category}"
Expand Down Expand Up @@ -264,7 +266,7 @@ def query(self, category, query_texts, n_results=5):
"documents": [],
"metadatas": [],
"embeddings": [],
"distances": []
"distances": [],
}
self.ensure_table_exists(category)
table_name = self._table_name(category)
Expand All @@ -288,7 +290,6 @@ def query(self, category, query_texts, n_results=5):
results["distances"].append(row[4])
return results


def update(self, category, id_, document=None, metadata=None, embedding=None):
self.ensure_table_exists(category)
table_name = self._table_name(category)
Expand Down

0 comments on commit 3fb716b

Please sign in to comment.