From 33f55962c1053abae85169a30f4c8101ba317868 Mon Sep 17 00:00:00 2001 From: Nirant Kasliwal Date: Wed, 7 Feb 2024 22:22:41 +0530 Subject: [PATCH] * fix(text_embedding_base.py): remove unnecessary prefix from texts in embed method * feat(text_embedding_base.py): update query_embed method to updated instruction for the v1.5 model --- fastembed/text/text_embedding_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fastembed/text/text_embedding_base.py b/fastembed/text/text_embedding_base.py index e90fddb8..56cc4c4e 100644 --- a/fastembed/text/text_embedding_base.py +++ b/fastembed/text/text_embedding_base.py @@ -37,7 +37,7 @@ def passage_embed(self, texts: Iterable[str], **kwargs) -> Iterable[np.ndarray]: """ # This is model-specific, so that different models can have specialized implementations - yield from self.embed([f"passage: {text}" for text in texts], **kwargs) + yield from self.embed(texts, **kwargs) def query_embed(self, query: Union[str, Iterable[str]], **kwargs) -> Iterable[np.ndarray]: """ @@ -52,6 +52,6 @@ def query_embed(self, query: Union[str, Iterable[str]], **kwargs) -> Iterable[np # This is model-specific, so that different models can have specialized implementations if isinstance(query, str): - yield from self.embed([f"query: {query}"], **kwargs) + yield from self.embed([f"Represent this sentence for searching relevant passages: {query}"], **kwargs) if isinstance(query, Iterable): - yield from self.embed([f"query: {text}" for text in query], **kwargs) + yield from self.embed([f"Represent this sentence for searching relevant passages:: {text}" for text in query], **kwargs)