Skip to content

Commit

Permalink
* fix(text_embedding_base.py): remove unnecessary prefix from texts i…
Browse files Browse the repository at this point in the history
…n embed method

* feat(text_embedding_base.py): update query_embed method to updated instruction for the v1.5 model
  • Loading branch information
NirantK committed Feb 7, 2024
1 parent 5fe16d0 commit 33f5596
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fastembed/text/text_embedding_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
"""
Expand All @@ -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)

0 comments on commit 33f5596

Please sign in to comment.