|
14 | 14 | @component
|
15 | 15 | class SentenceTransformersTextEmbedder:
|
16 | 16 | """
|
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. |
18 | 20 |
|
19 | 21 | Usage example:
|
20 | 22 | ```python
|
@@ -47,26 +49,28 @@ def __init__(
|
47 | 49 | Create a SentenceTransformersTextEmbedder component.
|
48 | 50 |
|
49 | 51 | :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. |
51 | 54 | :param device:
|
52 | 55 | Overrides the default device used to load the model.
|
53 | 56 | :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. |
55 | 58 | :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, |
58 | 61 | such as E5 and bge.
|
59 | 62 | :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. |
61 | 64 | :param batch_size:
|
62 |
| - Number of Documents to encode at once. |
| 65 | + Number of texts to embed at once. |
63 | 66 | :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. |
65 | 69 | :param normalize_embeddings:
|
66 |
| - If True returned vectors will have length 1. |
| 70 | + If `True`, returned vectors have a length of 1. |
67 | 71 | :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. |
70 | 74 | """
|
71 | 75 |
|
72 | 76 | self.model = model
|
|
0 commit comments