Skip to content

Commit a43c47b

Browse files
Sync Haystack API reference on Docusaurus (#9891)
Co-authored-by: anakin87 <[email protected]>
1 parent bbaae9e commit a43c47b

30 files changed

+712
-564
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Agents
2+
title: "Agents"
33
id: agents-api
4-
description: Tool-using agents with provider-agnostic chat model support.
4+
description: "Tool-using agents with provider-agnostic chat model support."
5+
slug: "/agents-api"
56
---
67

78
<a id="agent"></a>
@@ -366,3 +367,4 @@ def from_dict(cls, data: dict[str, Any])
366367
```
367368

368369
Convert a dictionary back to a State object.
370+

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Audio
2+
title: "Audio"
33
id: audio-api
4-
description: Transcribes audio files.
4+
description: "Transcribes audio files."
5+
slug: "/audio-api"
56
---
67

78
<a id="whisper_local"></a>
@@ -263,3 +264,4 @@ Transcribes the list of audio files into a list of documents.
263264
A dictionary with the following keys:
264265
- `documents`: A list of documents, one document for each file.
265266
The content of each document is the transcribed text.
267+

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Builders
2+
title: "Builders"
33
id: builders-api
4-
description: Extract the output of a Generator to an Answer format, and build prompts.
4+
description: "Extract the output of a Generator to an Answer format, and build prompts."
5+
slug: "/builders-api"
56
---
67

78
<a id="answer_builder"></a>
@@ -507,3 +508,4 @@ Deserialize this component from a dictionary.
507508
**Returns**:
508509

509510
The deserialized component.
511+

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Caching
2+
title: "Caching"
33
id: caching-api
4-
description: Checks if any document coming from the given URL is already present in the store.
4+
description: "Checks if any document coming from the given URL is already present in the store."
5+
slug: "/caching-api"
56
---
67

78
<a id="cache_checker"></a>
@@ -106,3 +107,4 @@ Checks if any document associated with the specified cache field is already pres
106107
A dictionary with two keys:
107108
- `hits` - Documents that matched with at least one of the items.
108109
- `misses` - Items that were not present in any documents.
110+

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Classifiers
2+
title: "Classifiers"
33
id: classifiers-api
4-
description: Classify documents based on the provided labels.
4+
description: "Classify documents based on the provided labels."
5+
slug: "/classifiers-api"
56
---
67

78
<a id="document_language_classifier"></a>
@@ -258,3 +259,4 @@ the `details` key within the `classification` dictionary.
258259

259260
A dictionary with the following key:
260261
- `documents`: A list of documents with an added metadata field called `classification`.
262+

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Connectors
2+
title: "Connectors"
33
id: connectors-api
4-
description: Various connectors to integrate with external services.
4+
description: "Various connectors to integrate with external services."
5+
slug: "/connectors-api"
56
---
67

78
<a id="openapi_service"></a>
@@ -243,3 +244,4 @@ Invokes a REST endpoint specified in the OpenAPI specification.
243244
**Returns**:
244245

245246
Dictionary containing the service response
247+

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

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Converters
2+
title: "Converters"
33
id: converters-api
4-
description: Various converters to transform data from one format to another.
4+
description: "Various converters to transform data from one format to another."
5+
slug: "/converters-api"
56
---
67

78
<a id="azure"></a>
@@ -144,30 +145,32 @@ The deserialized component.
144145

145146
Converts CSV files to Documents.
146147

147-
By default, it uses UTF-8 encoding when converting files but
148-
you can also set a custom encoding.
149-
It can attach metadata to the resulting documents.
148+
By default, it uses UTF-8 encoding when converting files but
149+
you can also set a custom encoding.
150+
It can attach metadata to the resulting documents.
150151

151-
### Usage example
152+
### Usage example
152153

153-
```python
154-
from haystack.components.converters.csv import CSVToDocument
155-
converter = CSVToDocument()
156-
results = converter.run(sources=["sample.csv"], meta={"date_added": datetime.now().isoformat()})
157-
documents = results["documents"]
158-
print(documents[0].content)
159-
# 'col1,col2
160-
ow1,row1
161-
row2row2
162-
'
163-
```
154+
```python
155+
from haystack.components.converters.csv import CSVToDocument
156+
converter = CSVToDocument()
157+
results = converter.run(sources=["sample.csv"], meta={"date_added": datetime.now().isoformat()})
158+
documents = results["documents"]
159+
print(documents[0].content)
160+
# 'col1,col2\nrow1,row1\nrow2,row2\n'
161+
```
164162

165163
<a id="csv.CSVToDocument.__init__"></a>
166164

167165
#### CSVToDocument.\_\_init\_\_
168166

169167
```python
170-
def __init__(encoding: str = "utf-8", store_full_path: bool = False)
168+
def __init__(encoding: str = "utf-8",
169+
store_full_path: bool = False,
170+
*,
171+
conversion_mode: Literal["file", "row"] = "file",
172+
delimiter: str = ",",
173+
quotechar: str = '"')
171174
```
172175

173176
Creates a CSVToDocument component.
@@ -179,6 +182,10 @@ If the encoding is specified in the metadata of a source ByteStream,
179182
it overrides this value.
180183
- `store_full_path`: If True, the full path of the file is stored in the metadata of the document.
181184
If False, only the file name is stored.
185+
- `conversion_mode`: - "file" (default): one Document per CSV file whose content is the raw CSV text.
186+
- "row": convert each CSV row to its own Document (requires `content_column` in `run()`).
187+
- `delimiter`: CSV delimiter used when parsing in row mode (passed to ``csv.DictReader``).
188+
- `quotechar`: CSV quote character used when parsing in row mode (passed to ``csv.DictReader``).
182189

183190
<a id="csv.CSVToDocument.run"></a>
184191

@@ -187,14 +194,19 @@ If False, only the file name is stored.
187194
```python
188195
@component.output_types(documents=list[Document])
189196
def run(sources: list[Union[str, Path, ByteStream]],
197+
*,
198+
content_column: Optional[str] = None,
190199
meta: Optional[Union[dict[str, Any], list[dict[str, Any]]]] = None)
191200
```
192201

193-
Converts a CSV file to a Document.
202+
Converts CSV files to a Document (file mode) or to one Document per row (row mode).
194203

195204
**Arguments**:
196205

197206
- `sources`: List of file paths or ByteStream objects.
207+
- `content_column`: **Required when** ``conversion_mode="row"``.
208+
The column name whose values become ``Document.content`` for each row.
209+
The column must exist in the CSV header.
198210
- `meta`: Optional metadata to attach to the documents.
199211
This value can be either a list of dictionaries or a single dictionary.
200212
If it's a single dictionary, its content is added to the metadata of all produced documents.
@@ -1618,3 +1630,4 @@ If `sources` contains ByteStream objects, their `meta` will be added to the outp
16181630

16191631
A dictionary with the following keys:
16201632
- `documents`: Created documents
1633+

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Data Classes
2+
title: "Data Classes"
33
id: data-classess-api
4-
description: Core classes that carry data through the system.
4+
description: "Core classes that carry data through the system."
5+
slug: "/data-classess-api"
56
---
67

78
<a id="answer"></a>
@@ -1329,3 +1330,4 @@ The runtime callback takes precedence over the initial callback.
13291330
**Returns**:
13301331

13311332
The selected callback.
1333+

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Document Stores
2+
title: "Document Stores"
33
id: document-stores-api
4-
description: Stores your texts and meta data and provides them to the Retriever at query time.
4+
description: "Stores your texts and meta data and provides them to the Retriever at query time."
5+
slug: "/document-stores-api"
56
---
67

78
<a id="document_store"></a>
@@ -378,3 +379,4 @@ Retrieves documents that are most similar to the query embedding using a vector
378379
**Returns**:
379380

380381
A list of the top_k documents most relevant to the query.
382+

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
2-
title: Document Writers
2+
title: "Document Writers"
33
id: document-writers-api
4-
description: Writes Documents to a DocumentStore.
4+
description: "Writes Documents to a DocumentStore."
5+
slug: "/document-writers-api"
56
---
67

78
<a id="document_writer"></a>
@@ -136,3 +137,4 @@ but can be used with `await` in async code.
136137
**Returns**:
137138

138139
Number of documents written to the document store.
140+

0 commit comments

Comments
 (0)