diff --git a/docs-website/reference/integrations-api/jina.md b/docs-website/reference/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference/integrations-api/jina.md +++ b/docs-website/reference/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.18/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.18/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.18/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.18/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.19/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.19/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.19/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.19/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.20/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.20/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.20/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.20/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.21/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.21/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.21/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.21/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.22/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.22/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.22/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.22/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.23/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.23/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.23/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.23/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.24/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.24/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.24/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.24/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.25/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.25/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.25/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.25/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.26/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.26/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.26/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.26/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0. diff --git a/docs-website/reference_versioned_docs/version-2.27/integrations-api/jina.md b/docs-website/reference_versioned_docs/version-2.27/integrations-api/jina.md index e344c91278..51f63eae27 100644 --- a/docs-website/reference_versioned_docs/version-2.27/integrations-api/jina.md +++ b/docs-website/reference_versioned_docs/version-2.27/integrations-api/jina.md @@ -99,6 +99,30 @@ Process the query/URL using the Jina AI reader service. **Returns:** +- dict\[str, list\[Document\]\] – A dictionary with the following keys: + - `documents`: A list of `Document` objects. + +#### run_async + +```python +run_async( + query: str, headers: dict[str, str] | None = None +) -> dict[str, list[Document]] +``` + +Asynchronously process the query/URL using the Jina AI reader service. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – The query string or URL to process. +- **headers** (dict\[str, str\] | None) – Optional headers to include in the request for customization. Refer to the + [Jina Reader documentation](https://jina.ai/reader/) for more information. + +**Returns:** + - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: A list of `Document` objects. @@ -224,6 +248,31 @@ Compute the embeddings for a list of Documents. - TypeError – If the input is not a list of Documents. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, Any] +``` + +Asynchronously compute the embeddings for a list of Documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – A list of Documents to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `documents`: List of Documents, each with an `embedding` field containing the computed embedding. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a list of Documents. + ## haystack_integrations.components.embedders.jina.document_image_embedder ### JinaDocumentImageEmbedder @@ -341,6 +390,26 @@ Embed a list of image documents. - dict\[str, list\[Document\]\] – A dictionary with the following keys: - `documents`: Documents with embeddings. +#### run_async + +```python +run_async(documents: list[Document]) -> dict[str, list[Document]] +``` + +Asynchronously embed a list of image documents. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **documents** (list\[Document\]) – Documents to embed. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: Documents with embeddings. + ## haystack_integrations.components.embedders.jina.text_embedder ### JinaTextEmbedder @@ -453,6 +522,31 @@ Embed a string. - TypeError – If the input is not a string. +#### run_async + +```python +run_async(text: str) -> dict[str, Any] +``` + +Asynchronously embed a string. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **text** (str) – The string to embed. + +**Returns:** + +- dict\[str, Any\] – A dictionary with following keys: +- `embedding`: The embedding of the input string. +- `meta`: A dictionary with metadata including the model name and usage statistics. + +**Raises:** + +- TypeError – If the input is not a string. + ## haystack_integrations.components.rankers.jina.ranker ### JinaRanker @@ -557,3 +651,35 @@ Returns a list of Documents ranked by their similarity to the given query. **Raises:** - ValueError – If `top_k` is not > 0. + +#### run_async + +```python +run_async( + query: str, + documents: list[Document], + top_k: int | None = None, + score_threshold: float | None = None, +) -> dict[str, list[Document]] +``` + +Asynchronously returns a list of Documents ranked by their similarity to the given query. + +This is the asynchronous version of the `run` method. It has the same parameters and return values +but can be used with `await` in async code. + +**Parameters:** + +- **query** (str) – Query string. +- **documents** (list\[Document\]) – List of Documents. +- **top_k** (int | None) – The maximum number of Documents you want the Ranker to return. +- **score_threshold** (float | None) – If provided only returns documents with a score above this threshold. + +**Returns:** + +- dict\[str, list\[Document\]\] – A dictionary with the following keys: +- `documents`: List of Documents most similar to the given query in descending order of similarity. + +**Raises:** + +- ValueError – If `top_k` is not > 0.