Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs-website/reference/haystack-api/connectors_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ Sends an HTTP request as described by this path.
- **data** (<code>Any | None</code>) – The request body to send.
- **parameters** (<code>dict\[str, Any\] | None</code>) – The parameters used to create the path.
- **raw_response** (<code>bool</code>) – If true, return the raw response instead of validating
and exterpolating it.
and extrapolating it.
- **security** (<code>dict\[str, str\] | None</code>) – The security scheme to use, and the values it needs to
process successfully.
- **session** (<code>Any | None</code>) – A persistent request session.
- **verify** (<code>bool | str</code>) – If we should do an ssl verification on the request or not.
- **verify** (<code>bool | str</code>) – If we should do an SSL verification on the request or not.
In case str was provided, will use that as the CA.

**Returns:**
Expand Down
12 changes: 4 additions & 8 deletions docs-website/reference/haystack-api/converters_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ It can attach metadata to the resulting documents.

```python
from haystack.components.converters.csv import CSVToDocument
from datetime import datetime
converter = CSVToDocument()
results = converter.run(sources=["sample.csv"], meta={"date_added": datetime.now().isoformat()})
documents = results["documents"]
Expand Down Expand Up @@ -1836,7 +1837,6 @@ Converts text files to documents.

### XLSXToDocument

````
Converts XLSX (Excel) files into Documents.

Supports reading data from specific sheets or all sheets in the Excel file. If all sheets are read, a Document is
Expand All @@ -1846,18 +1846,14 @@ created for each sheet. The content of the Document is the table which can be sa

```python
from haystack.components.converters.xlsx import XLSXToDocument
from datetime import datetime

converter = XLSXToDocument()
results = converter.run(sources=["sample.xlsx"], meta={"date_added": datetime.now().isoformat()})
documents = results["documents"]
print(documents[0].content)
# ",A,B
````

1,col_a,col_b
2,1.5,test
"
\`\`\`
# ",A,B\n1,col_a,col_b\n2,1.5,test\n"
```

#### __init__

Expand Down
51 changes: 51 additions & 0 deletions docs-website/reference/haystack-api/document_stores_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,57 @@ Returns the number of unique values for each specified metadata field from docum
- <code>dict\[str, int\]</code> – A dictionary mapping each metadata field name (without "meta." prefix)
to the count of its unique values among the filtered documents.

#### get_metadata_fields_info_async

```python
get_metadata_fields_info_async() -> dict[str, dict[str, str]]
```

Returns information about the metadata fields present in the stored documents.

Types are inferred from the stored values (keyword, int, float, boolean).

**Returns:**

- <code>dict\[str, dict\[str, str\]\]</code> – A dictionary mapping each metadata field name to a dict with a "type" key.

#### get_metadata_field_min_max_async

```python
get_metadata_field_min_max_async(metadata_field: str) -> dict[str, Any]
```

Returns the minimum and maximum values for the given metadata field across all documents.

**Parameters:**

- **metadata_field** (<code>str</code>) – The metadata field name. Can include or omit the "meta." prefix.

**Returns:**

- <code>dict\[str, Any\]</code> – A dictionary with "min" and "max" keys. Returns `{"min": None, "max": None}`
if the field is missing or has no values.

#### get_metadata_field_unique_values_async

```python
get_metadata_field_unique_values_async(
metadata_field: str, search_term: str | None = None
) -> tuple[list[str], int]
```

Returns unique values for a metadata field, optionally filtered by a search term in content.

**Parameters:**

- **metadata_field** (<code>str</code>) – The metadata field name. Can include or omit the "meta." prefix.
- **search_term** (<code>str | None</code>) – If set, only documents whose content contains this term (case-insensitive)
are considered.

**Returns:**

- <code>tuple\[list\[str\], int\]</code> – A tuple of (list of unique values, total count of unique values).

#### delete_all_documents_async

```python
Expand Down
2 changes: 1 addition & 1 deletion docs-website/reference/haystack-api/evaluators_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ print(result["score"])
# 0.5
print(result["results"])
# [{'statements': ['Python is a high-level general-purpose programming language.',
'Python was created by George Lucas.'], 'statement_scores': [1, 0], 'score': 0.5}]
# 'Python was created by George Lucas.'], 'statement_scores': [1, 0], 'score': 0.5}]
```

#### __init__
Expand Down
15 changes: 8 additions & 7 deletions docs-website/reference/haystack-api/generators_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ print(result)

#### With paid inference endpoints

````python
```python
from haystack.components.generators.chat import HuggingFaceAPIChatGenerator
from haystack.dataclasses import ChatMessage
from haystack.utils import Secret
Expand All @@ -760,6 +760,7 @@ generator = HuggingFaceAPIChatGenerator(api_type="inference_endpoints",

result = generator.run(messages)
print(result)
```

#### With self-hosted text generation inference

Expand All @@ -775,7 +776,7 @@ generator = HuggingFaceAPIChatGenerator(api_type="text_generation_inference",

result = generator.run(messages)
print(result)
````
```

#### __init__

Expand Down Expand Up @@ -2140,11 +2141,11 @@ client = OpenAIGenerator()
response = client.run("What's Natural Language Processing? Be brief.")
print(response)

>> {'replies': ['Natural Language Processing (NLP) is a branch of artificial intelligence that focuses on
>> the interaction between computers and human language. It involves enabling computers to understand, interpret,
>> and respond to natural human language in a way that is both meaningful and useful.'], 'meta': [{'model':
>> 'gpt-5-mini', 'index': 0, 'finish_reason': 'stop', 'usage': {'prompt_tokens': 16,
>> 'completion_tokens': 49, 'total_tokens': 65}}]}
# >> {'replies': ['Natural Language Processing (NLP) is a branch of artificial intelligence that focuses on
# >> the interaction between computers and human language. It involves enabling computers to understand, interpret,
# >> and respond to natural human language in a way that is both meaningful and useful.'], 'meta': [{'model':
# >> 'gpt-5-mini', 'index': 0, 'finish_reason': 'stop', 'usage': {'prompt_tokens': 16,
# >> 'completion_tokens': 49, 'total_tokens': 65}}]}
```

#### __init__
Expand Down
6 changes: 3 additions & 3 deletions docs-website/reference/haystack-api/joiners_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,8 @@ result = pipe.run(
print(json.loads(result["validator"]["validated"][0].text))


>> {'first_name': 'Peter', 'last_name': 'Parker', 'nationality': 'American', 'name': 'Spider-Man', 'occupation':
>> 'Superhero', 'age': 23, 'location': 'New York City'}
# >> {'first_name': 'Peter', 'last_name': 'Parker', 'nationality': 'American', 'name': 'Spider-Man', 'occupation':
# >> 'Superhero', 'age': 23, 'location': 'New York City'}
```

Note that `BranchJoiner` can manage only one data type at a time. In this case, `BranchJoiner` is created for
Expand Down Expand Up @@ -545,7 +545,7 @@ pipeline.connect("prompt_builder_2.prompt", "string_joiner.strings")

print(pipeline.run(data={"prompt_builder_1": {"query": string_1}, "prompt_builder_2": {"query": string_2}}))

>> {"string_joiner": {"strings": ["Builder 1: What's Natural Language Processing?", "Builder 2: What is life?"]}}
# >> {"string_joiner": {"strings": ["Builder 1: What's Natural Language Processing?", "Builder 2: What is life?"]}}
```

#### run
Expand Down
1 change: 1 addition & 0 deletions docs-website/reference/haystack-api/pipeline_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,7 @@ Answer:

retriever = InMemoryBM25Retriever(document_store=document_store)
prompt_builder = PromptBuilder(template=prompt_template)
api_key = "your-openai-api-key"
llm = OpenAIGenerator(api_key=Secret.from_token(api_key))

rag_pipeline = Pipeline()
Expand Down
12 changes: 6 additions & 6 deletions docs-website/reference/haystack-api/preprocessors_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -861,12 +861,12 @@ AI technology is widely used throughout industry, government, and science. Some
doc = Document(content=text)
doc_chunks = chunker.run([doc])
print(doc_chunks["documents"])
>[
>Document(id=..., content: 'Artificial intelligence (AI) - Introduction\n\n', meta: {'original_id': '...', 'split_id': 0, 'split_idx_start': 0, '_split_overlap': []})
>Document(id=..., content: 'AI, in its broadest sense, is intelligence exhibited by machines, particularly computer systems.\n', meta: {'original_id': '...', 'split_id': 1, 'split_idx_start': 45, '_split_overlap': []})
>Document(id=..., content: 'AI technology is widely used throughout industry, government, and science.', meta: {'original_id': '...', 'split_id': 2, 'split_idx_start': 142, '_split_overlap': []})
>Document(id=..., content: ' Some high-profile applications include advanced web search engines; recommendation systems; interac...', meta: {'original_id': '...', 'split_id': 3, 'split_idx_start': 216, '_split_overlap': []})
>]
# [
# Document(id=..., content: 'Artificial intelligence (AI) - Introduction\n\n', meta: {'original_id': '...', 'split_id': 0, 'split_idx_start': 0, '_split_overlap': []})
# Document(id=..., content: 'AI, in its broadest sense, is intelligence exhibited by machines, particularly computer systems.\n', meta: {'original_id': '...', 'split_id': 1, 'split_idx_start': 45, '_split_overlap': []})
# Document(id=..., content: 'AI technology is widely used throughout industry, government, and science.', meta: {'original_id': '...', 'split_id': 2, 'split_idx_start': 142, '_split_overlap': []})
# Document(id=..., content: ' Some high-profile applications include advanced web search engines; recommendation systems; interac...', meta: {'original_id': '...', 'split_id': 3, 'split_idx_start': 216, '_split_overlap': []})
# ]
```

#### __init__
Expand Down
27 changes: 12 additions & 15 deletions docs-website/reference/haystack-api/routers_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,12 +516,12 @@ Categorize files or byte streams according to their MIME types.

### LLMMessagesRouter

````
Routes Chat Messages to different connections using a generative Language Model to perform classification.

This component can be used with general-purpose LLMs and with specialized LLMs for moderation like Llama Guard.

### Usage example

```python
from haystack.components.generators.chat import HuggingFaceAPIChatGenerator
from haystack.components.routers.llm_messages_router import LLMMessagesRouter
Expand All @@ -541,20 +541,17 @@ router = LLMMessagesRouter(chat_generator=chat_generator,
print(router.run([ChatMessage.from_user("How to rob a bank?")]))

# {
# 'chat_generator_text': 'unsafe
````

S2',
\# 'unsafe': \[
\# ChatMessage(
\# \_role=\<ChatRole.USER: 'user'>,
\# \_content=[TextContent(text='How to rob a bank?')],
\# \_name=None,
\# \_meta={}
\# )
\# \]
\# }
\`\`\`
# 'chat_generator_text': 'unsafe\nS2',
# 'unsafe': [
# ChatMessage(
# _role=<ChatRole.USER: 'user'>,
# _content=[TextContent(text='How to rob a bank?')],
# _name=None,
# _meta={}
# )
# ]
# }
```

#### __init__

Expand Down
Loading