Skip to content

Commit 67940d2

Browse files
julian-rischgithub-actions[bot]
authored andcommitted
Sync Haystack API reference on Docusaurus
1 parent fd10d51 commit 67940d2

1 file changed

Lines changed: 70 additions & 0 deletions

File tree

docs-website/reference/haystack-api/retrievers_api.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,29 @@ Retrieve documents using multiple queries in parallel.
663663

664664
**Returns:**
665665

666+
- <code>dict\[str, list\[Document\]\]</code> – A dictionary containing:
667+
- `documents`: List of retrieved documents sorted by relevance score.
668+
669+
#### run_async
670+
671+
```python
672+
run_async(
673+
queries: list[str], retriever_kwargs: dict[str, Any] | None = None
674+
) -> dict[str, list[Document]]
675+
```
676+
677+
Retrieve documents using multiple queries concurrently.
678+
679+
Uses each component's `run_async` method if available, otherwise falls back to running `run`
680+
in a thread executor. Queries are processed concurrently using asyncio.gather.
681+
682+
**Parameters:**
683+
684+
- **queries** (<code>list\[str\]</code>) – List of text queries to process.
685+
- **retriever_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional dictionary of arguments to pass to the retriever's run method.
686+
687+
**Returns:**
688+
666689
- <code>dict\[str, list\[Document\]\]</code> – A dictionary containing:
667690
- `documents`: List of retrieved documents sorted by relevance score.
668691

@@ -778,6 +801,29 @@ Retrieve documents using multiple queries in parallel.
778801

779802
**Returns:**
780803

804+
- <code>dict\[str, list\[Document\]\]</code> – A dictionary containing:
805+
`documents`: List of retrieved documents sorted by relevance score.
806+
807+
#### run_async
808+
809+
```python
810+
run_async(
811+
queries: list[str], retriever_kwargs: dict[str, Any] | None = None
812+
) -> dict[str, list[Document]]
813+
```
814+
815+
Retrieve documents using multiple queries concurrently.
816+
817+
Uses the retriever's `run_async` method if available, otherwise falls back to running `run`
818+
in a thread executor. Queries are processed concurrently using asyncio.gather.
819+
820+
**Parameters:**
821+
822+
- **queries** (<code>list\[str\]</code>) – List of text queries to process.
823+
- **retriever_kwargs** (<code>dict\[str, Any\] | None</code>) – Optional dictionary of arguments to pass to the retriever's run method.
824+
825+
**Returns:**
826+
781827
- <code>dict\[str, list\[Document\]\]</code> – A dictionary containing:
782828
`documents`: List of retrieved documents sorted by relevance score.
783829

@@ -1273,6 +1319,30 @@ Retrieve documents using a single query.
12731319

12741320
**Returns:**
12751321

1322+
- <code>dict\[str, list\[Document\]\]</code> – A dictionary containing:
1323+
- `documents`: List of retrieved documents sorted by relevance score.
1324+
1325+
#### run_async
1326+
1327+
```python
1328+
run_async(
1329+
query: str, filters: dict[str, Any] | None = None, top_k: int | None = None
1330+
) -> dict[str, list[Document]]
1331+
```
1332+
1333+
Retrieve documents using a single query asynchronously.
1334+
1335+
Uses `run_async` on the text embedder and retriever if available, otherwise falls back to
1336+
running `run` in a thread executor.
1337+
1338+
**Parameters:**
1339+
1340+
- **query** (<code>str</code>) – The query to retrieve documents for.
1341+
- **filters** (<code>dict\[str, Any\] | None</code>) – A dictionary of filters to apply when retrieving documents.
1342+
- **top_k** (<code>int | None</code>) – The maximum number of documents to return.
1343+
1344+
**Returns:**
1345+
12761346
- <code>dict\[str, list\[Document\]\]</code> – A dictionary containing:
12771347
- `documents`: List of retrieved documents sorted by relevance score.
12781348

0 commit comments

Comments
 (0)