Skip to content

Commit 1f58ec2

Browse files
agnieszka-mdfokina
andauthored
Docs: Standardize and improve SentenceTransformersTextEmbedder docstrings (#8060)
* Update docstrings * format * add Daria's comments * Update haystack/components/embedders/sentence_transformers_text_embedder.py Co-authored-by: Daria Fokina <[email protected]> * Update haystack/components/embedders/sentence_transformers_text_embedder.py Co-authored-by: Daria Fokina <[email protected]> --------- Co-authored-by: Daria Fokina <[email protected]>
1 parent de728b4 commit 1f58ec2

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

haystack/components/embedders/sentence_transformers_text_embedder.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
@component
1515
class SentenceTransformersTextEmbedder:
1616
"""
17-
A component for embedding strings using Sentence Transformers models.
17+
Embeds strings using Sentence Transformers models.
18+
19+
You can use it to embed user query and send it to an embedding retriever.
1820
1921
Usage example:
2022
```python
@@ -47,26 +49,28 @@ def __init__(
4749
Create a SentenceTransformersTextEmbedder component.
4850
4951
:param model:
50-
Local path or ID of the model on HuggingFace Hub.
52+
The model to use for calculating embeddings.
53+
Specify the path to a local model or the ID of the model on Hugging Face.
5154
:param device:
5255
Overrides the default device used to load the model.
5356
:param token:
54-
The API token used to download private models from Hugging Face.
57+
An API token to use private models from Hugging Face.
5558
:param prefix:
56-
A string to add at the beginning of each text.
57-
Can be used to prepend the text with an instruction, as required by some embedding models,
59+
A string to add at the beginning of each text to be embedded.
60+
You can use it to prepend the text with an instruction, as required by some embedding models,
5861
such as E5 and bge.
5962
:param suffix:
60-
A string to add at the end of each text.
63+
A string to add at the end of each text to embed.
6164
:param batch_size:
62-
Number of Documents to encode at once.
65+
Number of texts to embed at once.
6366
:param progress_bar:
64-
If True shows a progress bar when running.
67+
If `True`, shows a progress bar for calculating embeddings.
68+
If `False`, disables the progress bar.
6569
:param normalize_embeddings:
66-
If True returned vectors will have length 1.
70+
If `True`, returned vectors have a length of 1.
6771
:param trust_remote_code:
68-
If `False`, only Hugging Face verified model architectures are allowed.
69-
If `True`, custom models and scripts are allowed.
72+
If `False`, permits only Hugging Face verified model architectures.
73+
If `True`, permits custom models and scripts.
7074
"""
7175

7276
self.model = model

0 commit comments

Comments
 (0)