mirror of
https://github.com/deepset-ai/haystack.git
synced 2026-10-12 02:12:50 +00:00
Merge branch 'main' into fix/query-expander-prompt-n-expansions
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
# Pinned by digest for supply-chain integrity. Bump periodically (the OSS-Fuzz
|
||||
# base-builder is updated frequently with toolchain fixes); resolve a fresh digest with:
|
||||
# docker buildx imagetools inspect gcr.io/oss-fuzz-base/base-builder-python:latest --format '{{.Manifest.Digest}}'
|
||||
FROM gcr.io/oss-fuzz-base/base-builder-python@sha256:b02a06f9d3918428825b1ebfa2c3627b591a5924a83436b8aaec40c85fd15b16
|
||||
FROM gcr.io/oss-fuzz-base/base-builder-python@sha256:7c97d379ceb773b0bd345f0ced72b037d26e9bb6c4a0c9a176525e65975c5694
|
||||
|
||||
COPY . $SRC/haystack
|
||||
WORKDIR $SRC/haystack
|
||||
|
||||
@@ -57,7 +57,11 @@ if __name__ == "__main__":
|
||||
### Docusaurus updates
|
||||
|
||||
# copy docs to versioned_docs/version-target_unstable
|
||||
shutil.copytree("docs-website/docs", f"docs-website/versioned_docs/version-{target_unstable}")
|
||||
shutil.copytree(
|
||||
src="docs-website/docs",
|
||||
dst=f"docs-website/versioned_docs/version-{target_unstable}",
|
||||
ignore=shutil.ignore_patterns("AGENTS.md"),
|
||||
)
|
||||
|
||||
# copy reference to reference_versioned_docs/version-target_unstable
|
||||
shutil.copytree("docs-website/reference", f"docs-website/reference_versioned_docs/version-{target_unstable}")
|
||||
|
||||
@@ -62,7 +62,7 @@ jobs:
|
||||
with:
|
||||
python-version: "${{ env.PYTHON_VERSION }}"
|
||||
|
||||
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
|
||||
- name: Set up Node.js
|
||||
if: steps.changed.outputs.needs_check == 'true'
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ jobs:
|
||||
persist-credentials: false
|
||||
|
||||
- name: Install Node.js
|
||||
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
||||
uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Upload result
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: docstring-label-result
|
||||
path: result/
|
||||
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
actions: read
|
||||
steps:
|
||||
- name: Download result
|
||||
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: docstring-label-result
|
||||
path: result
|
||||
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
publish_results: true
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
|
||||
@@ -170,7 +170,7 @@ jobs:
|
||||
|
||||
- name: Upload coverage comment to be posted
|
||||
if: matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' && steps.coverage_comment.outputs.COMMENT_FILE_WRITTEN == 'true'
|
||||
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: python-coverage-comment-action
|
||||
path: python-coverage-comment-action.txt
|
||||
|
||||
@@ -94,7 +94,8 @@ Also see directory-specific guidelines:
|
||||
- Keep inline comments and private-helper docs to what is non-obvious — remove restatements, keep durable caveats and rationale
|
||||
- Keep docstrings current with signatures and behavior, in the existing Haystack style: each public `:param` by meaning, default, and constraints; `:returns:` contracts; exceptions in the existing `:raises ValueError:` style; aliases like `ToolsType` reflected — stale docs mislead users and assistants
|
||||
- Keep doc examples minimal, runnable, and local: default constructors with required env vars like `OPENAI_API_KEY` noted nearby, only the imports the snippet uses, no restated defaults (name a model only for model-specific behavior), expected output as comments, generally `# >> ...`
|
||||
- When behavior, fields, or names change, update every surface in the same PR: `haystack/components/` docstrings and examples, `docs-website/docs/` plus the current `versioned_docs/version-*/` page (e.g. `concepts/data-classes.mdx`), and `experimental` wording, `pydoc` IDs, and generated markdown filenames when promoting features
|
||||
- When behavior, fields, or names change, update every relevant surface in the same PR: `haystack/components/` docstrings and examples, documentation pages, and `experimental` wording, `pydoc` IDs, and generated markdown filenames when promoting features
|
||||
- Choose which documentation versions to update: update `docs-website/docs/` by default; also update the latest stable `versioned_docs/version-X.Y/` pages for corrections to stable docs or already-released core integration features.
|
||||
|
||||
## Code Style
|
||||
|
||||
|
||||
@@ -13,6 +13,8 @@ Haystack relies on anonymous usage statistics to continuously improve. That's wh
|
||||
|
||||
Telemetry in Haystack comprises anonymous usage statistics of base components, such as `DocumentStore`, `Retriever`, `Reader`, or any other pipeline component. We receive an event every time these components are initialized. This way, we know which components are most relevant to our community. For the same reason, an event is also sent when one of the tutorials is executed.
|
||||
|
||||
When a pipeline contains an `Agent`, the event also includes the Agent's chat generator type and model, and the type and name of each of its tools. Tool descriptions are never collected.
|
||||
|
||||
Each event contains an anonymous, randomly generated user ID (`uuid`) and a collection of properties about your execution environment. They **never** contain properties that can be used to identify you, such as:
|
||||
|
||||
- IP addresses
|
||||
|
||||
@@ -29,6 +29,16 @@ The `HTMLToDocument` component converts HTML files into documents. It can be use
|
||||
|
||||
When you initialize the component, you can optionally set `extraction_kwargs`, a dictionary containing keyword arguments to customize the extraction process. These are passed to the underlying Trafilatura `extract` function. For the full list of available arguments, see the [Trafilatura documentation](https://trafilatura.readthedocs.io/en/latest/corefunctions.html#extract).
|
||||
|
||||
### Character encoding
|
||||
|
||||
By default, `HTMLToDocument` lets Trafilatura detect the HTML encoding and extract the text (`encoding=None`). If the result contains incorrect characters, you can install `trafilatura[all]`, which includes an additional encoding detector:
|
||||
|
||||
```shell
|
||||
pip install "trafilatura[all]"
|
||||
```
|
||||
|
||||
If you know the encoding, set it on the converter to bypass automatic detection, for example `HTMLToDocument(encoding="latin-1")`.
|
||||
|
||||
## Usage
|
||||
|
||||
### On its own
|
||||
|
||||
@@ -74,6 +74,8 @@ The `reasoning` parameter accepts:
|
||||
|
||||
:::note
|
||||
OpenAI does not return the actual reasoning tokens, but you can view the summary if enabled. For more details, see the [OpenAI Reasoning documentation](https://platform.openai.com/docs/guides/reasoning).
|
||||
|
||||
If a provider returns the raw reasoning as `reasoning_text` content instead, it is mapped to `reasoning.reasoning_text` in the reply when no summary is returned.
|
||||
:::
|
||||
|
||||
### Multi-turn Conversations
|
||||
|
||||
@@ -304,7 +304,7 @@ print(documents[0].content)
|
||||
__init__(
|
||||
extraction_kwargs: dict[str, Any] | None = None,
|
||||
store_full_path: bool = False,
|
||||
encoding: str = "utf-8",
|
||||
encoding: str | None = None,
|
||||
) -> None
|
||||
```
|
||||
|
||||
@@ -317,8 +317,9 @@ Create an HTMLToDocument component.
|
||||
the [Trafilatura documentation](https://trafilatura.readthedocs.io/en/latest/corefunctions.html#extract).
|
||||
- **store_full_path** (<code>bool</code>) – If True, the full path of the file is stored in the metadata of the document.
|
||||
If False, only the file name is stored.
|
||||
- **encoding** (<code>str</code>) – The default encoding to use when converting HTML files. If the encoding is specified in the metadata of a
|
||||
source ByteStream, it overrides this value.
|
||||
- **encoding** (<code>str | None</code>) – The encoding to use when decoding HTML files. If None (the default), Trafilatura detects the encoding.
|
||||
If detection produces incorrect characters, install `trafilatura[all]` for additional encoding detection
|
||||
support, or set this parameter if you know the encoding.
|
||||
|
||||
#### to_dict
|
||||
|
||||
|
||||
@@ -25,7 +25,8 @@ Response handling:
|
||||
The ChatGenerator can be configured to return JSON. For example, with the OpenAIResponsesChatGenerator, pass
|
||||
`{"text": {"format": {"type": "json_schema", ...}}}` in `generation_kwargs` as shown in the usage example below.
|
||||
|
||||
Documents that fail extraction are returned in `failed_documents` with `content_extraction_error` in metadata.
|
||||
Documents that fail extraction are returned in `failed_documents` with the error in their `extraction_error`
|
||||
metadata field.
|
||||
|
||||
### Usage example
|
||||
|
||||
@@ -113,7 +114,8 @@ Initialize the LLMDocumentContentExtractor component.
|
||||
that path-traversal payloads (e.g. absolute paths or `../`) are rejected instead of read.
|
||||
- **detail** (<code>Literal['auto', 'high', 'low'] | None</code>) – Optional detail level of the image (only supported by OpenAI). Can be "auto", "high", or "low".
|
||||
- **size** (<code>tuple\[int, int\] | None</code>) – If provided, resizes the image to fit within (width, height) while keeping aspect ratio.
|
||||
- **raise_on_failure** (<code>bool</code>) – If True, exceptions from the LLM are raised. If False, failed documents are returned.
|
||||
- **raise_on_failure** (<code>bool</code>) – If True, exceptions from the LLM are raised. If False, documents that fail extraction
|
||||
are returned in `failed_documents` with the error in their `extraction_error` metadata field.
|
||||
- **max_workers** (<code>int</code>) – Maximum number of threads for parallel LLM calls.
|
||||
|
||||
#### warm_up
|
||||
|
||||
@@ -1345,6 +1345,8 @@ in the OpenAI client.
|
||||
- `generate_summary`: Whether to generate a summary of the reasoning.
|
||||
- `mode`: The reasoning mode. Can be `standard`, or `pro`. Supported since GPT-5.6.
|
||||
Note: OpenAI does not return the reasoning tokens, but we can view summary if its enabled.
|
||||
If a provider returns the raw reasoning as `reasoning_text` content instead,
|
||||
it is mapped to `ReasoningContent.reasoning_text` when no summary is returned.
|
||||
For details, see the [OpenAI Reasoning documentation](https://platform.openai.com/docs/guides/reasoning).
|
||||
- `include`: Specify additional output data to include in the model response. Supported values are:
|
||||
- web_search_call.action.sources: Include the sources of the web search tool call.
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -716,7 +716,7 @@ Asynchronous tool invocation.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and fetch the tool schema if eager_connect is turned off.
|
||||
Connect and fetch the tool schema unless already connected.
|
||||
|
||||
#### to_dict
|
||||
|
||||
@@ -924,7 +924,7 @@ Initialize the MCP toolset.
|
||||
warm_up() -> None
|
||||
```
|
||||
|
||||
Connect and load tools when eager_connect is turned off.
|
||||
Connect and load tools unless already connected.
|
||||
|
||||
This method is automatically called by `Agent.warm_up()` and `Pipeline.warm_up()`.
|
||||
You can also call it directly before using the toolset to ensure all tool schemas
|
||||
|
||||
@@ -89,8 +89,10 @@ raw_responses = result["raw_mistral_response"]
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-ocr-2512",
|
||||
"mistral-ocr-3",
|
||||
"mistral-ocr-3-0",
|
||||
"mistral-ocr-4-0",
|
||||
"mistral-ocr-4",
|
||||
"mistral-ocr-4-1",
|
||||
"mistral-ocr-latest",
|
||||
]
|
||||
@@ -422,7 +424,7 @@ Key Features and Compatibility:
|
||||
- **Streaming Support**: Supports streaming responses from the Mistral API Chat Completion endpoint.
|
||||
- **Customizability**: Supports all parameters supported by the Mistral API Chat Completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., mistral-small with `reasoning_effort`, magistral models) and stores it in the
|
||||
(e.g., Mistral Small 4 with `reasoning_effort`, Mistral Medium 3.5, Mistral Large 4) and stores it in the
|
||||
`ReasoningContent` field on `ChatMessage`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
@@ -474,49 +476,35 @@ print(response["replies"][0].text) # Access final answer
|
||||
|
||||
```python
|
||||
SUPPORTED_MODELS: list[str] = [
|
||||
"mistral-medium-2505",
|
||||
"mistral-medium-2508",
|
||||
"mistral-medium-latest",
|
||||
"mistral-medium",
|
||||
"mistral-medium-2604",
|
||||
"mistral-medium-3",
|
||||
"mistral-medium-3-5",
|
||||
"mistral-medium-3.5",
|
||||
"mistral-vibe-cli-with-tools",
|
||||
"open-mistral-nemo",
|
||||
"open-mistral-nemo-2407",
|
||||
"mistral-tiny-2407",
|
||||
"mistral-tiny-latest",
|
||||
"codestral-2508",
|
||||
"codestral-latest",
|
||||
"devstral-2512",
|
||||
"mistral-code-latest",
|
||||
"mistral-code-fim-latest",
|
||||
"mistral-vibe-cli-latest",
|
||||
"devstral-medium-latest",
|
||||
"devstral-latest",
|
||||
"mistral-small-2506",
|
||||
"mistral-small-latest",
|
||||
"labs-mistral-small-creative",
|
||||
"magistral-medium-2509",
|
||||
"mistral-small-2603",
|
||||
"mistral-vibe-cli-fast",
|
||||
"magistral-medium-latest",
|
||||
"magistral-small-2509",
|
||||
"magistral-small-latest",
|
||||
"voxtral-small-2507",
|
||||
"voxtral-small-latest",
|
||||
"mistral-large-2512",
|
||||
"mistral-large-latest",
|
||||
"mistral-large-4",
|
||||
"mistral-large-4-0",
|
||||
"ministral-3b-2512",
|
||||
"ministral-3b-latest",
|
||||
"ministral-8b-2512",
|
||||
"ministral-8b-latest",
|
||||
"ministral-14b-2512",
|
||||
"ministral-14b-latest",
|
||||
"mistral-large-2411",
|
||||
"pixtral-large-2411",
|
||||
"pixtral-large-latest",
|
||||
"mistral-large-pixtral-2411",
|
||||
"devstral-small-2507",
|
||||
"devstral-medium-2507",
|
||||
"labs-devstral-small-2512",
|
||||
"devstral-small-latest",
|
||||
"voxtral-mini-2507",
|
||||
"voxtral-mini-latest",
|
||||
"voxtral-mini-2602",
|
||||
]
|
||||
|
||||
```
|
||||
|
||||
@@ -27,7 +27,8 @@ Key Features and Compatibility:
|
||||
- **Customizability**: Supports all parameters supported by the OpenRouter chat completion endpoint.
|
||||
- **Reasoning Support**: Extracts reasoning/thinking content from models that support it
|
||||
(e.g., DeepSeek R1, Claude with extended thinking) and stores it in the `ReasoningContent`
|
||||
field on `ChatMessage`. Reasoning content is only captured for non-streaming requests.
|
||||
field on `ChatMessage`. When streaming, reasoning is also passed to the `streaming_callback`
|
||||
in `StreamingChunk.reasoning`.
|
||||
|
||||
This component uses the ChatMessage format for structuring both input and output,
|
||||
ensuring coherent and contextually relevant responses in chat-based text generation scenarios.
|
||||
@@ -99,7 +100,6 @@ Creates an instance of OpenRouterChatGenerator.
|
||||
- `random_seed`: The seed to use for random sampling.
|
||||
- `reasoning`: A dict to configure reasoning/thinking tokens for models that support it.
|
||||
Example: `{"effort": "high"}` or `{"max_tokens": 2000}`.
|
||||
Reasoning content is only captured for non-streaming requests.
|
||||
See [OpenRouter reasoning docs](https://openrouter.ai/docs/use-cases/reasoning-tokens).
|
||||
- `response_format`: A JSON schema or a Pydantic model that enforces the structure of the model's response.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of tools or a Toolset for which the model can prepare calls. This parameter can accept either a
|
||||
@@ -145,8 +145,9 @@ Invokes chat completion on the OpenRouter API.
|
||||
- **messages** (<code>list\[ChatMessage\] | str</code>) – A list of ChatMessage instances representing the input messages.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These parameters will
|
||||
override the parameters passed during component initialization.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
For details on OpenRouter API parameters, see
|
||||
[OpenRouter docs](https://openrouter.ai/docs/quickstart).
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
|
||||
@@ -179,7 +180,9 @@ Asynchronously invokes chat completion on the OpenRouter API.
|
||||
If a string is provided, it is converted to a list containing a ChatMessage with user role.
|
||||
- **streaming_callback** (<code>StreamingCallbackT | None</code>) – A callback function that is called when a new token is received from the stream.
|
||||
Must be a coroutine.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation.
|
||||
- **generation_kwargs** (<code>dict\[str, Any\] | None</code>) – Additional keyword arguments for text generation. These are merged per key with the
|
||||
`generation_kwargs` passed at initialization: keys provided here take precedence, keys set only
|
||||
at initialization are kept.
|
||||
- **tools** (<code>ToolsType | None</code>) – A list of Tool and/or Toolset objects, or a single Toolset.
|
||||
- **tools_strict** (<code>bool | None</code>) – Whether to enable strict schema adherence for tool calls.
|
||||
|
||||
|
||||
@@ -107,9 +107,9 @@ The Haystack Enterprise Platform currently supports **247 components** and **76
|
||||
| [AmazonBedrockChatGenerator](https://docs.haystack.deepset.ai/docs/amazonbedrockchatgenerator) | Generator | ✅ Available |
|
||||
| [AmazonBedrockDocumentEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrockdocumentembedder) | Embedder | ✅ Available |
|
||||
| [AmazonBedrockDocumentImageEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrockdocumentimageembedder) | Embedder | ✅ Available |
|
||||
| [AmazonBedrockKnowledgeBaseRetriever](https://docs.haystack.deepset.ai/docs/amazonbedrockknowledgebaseretriever) | Retriever | ✅ Available |
|
||||
| [AmazonBedrockRanker](https://docs.haystack.deepset.ai/docs/amazonbedrockranker) | Ranker | ✅ Available |
|
||||
| [AmazonBedrockTextEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrocktextembedder) | Embedder | ✅ Available |
|
||||
| BedrockKnowledgeBaseRetriever | Retriever | ✅ Available |
|
||||
|
||||
## Amazon S3
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# docs-website/docs/ Guidelines
|
||||
|
||||
## Documentation
|
||||
|
||||
- Edit `docs-website/docs/pipeline-components/` pages only for outdated, incorrect, or materially useful guidance; keep examples concise and `Agent`-level and polish prose before merge — avoids churn while keeping docs copyable
|
||||
- Add `## Overview` near the top of `docs-website/docs/pipeline-components/**` pages — explains what the component does and why to use it before details
|
||||
- Document component outputs, extractor side effects, and exact `doc.meta` keys; link producers, API references, and the authoritative reference for any partial config summary
|
||||
- Use current chat APIs in new docs pipelines — `ChatPromptBuilder`, `ChatMessage`, chat generators, and `result["last_message"]` for agent output — matching wiring, edge names like `prompt`, and declared variables; keep YAML examples on current default model names
|
||||
- Mark joiners/adapters optional where smart pipeline connections already handle the composition
|
||||
@@ -107,6 +107,7 @@ The [Haystack Enterprise Platform](https://www.deepset.ai/haystack-platform) cur
|
||||
| [AmazonBedrockChatGenerator](https://docs.haystack.deepset.ai/docs/amazonbedrockchatgenerator) | Generator | ✅ Available |
|
||||
| [AmazonBedrockDocumentEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrockdocumentembedder) | Embedder | ✅ Available |
|
||||
| [AmazonBedrockDocumentImageEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrockdocumentimageembedder) | Embedder | ✅ Available |
|
||||
| [AmazonBedrockKnowledgeBaseRetriever](https://docs.haystack.deepset.ai/docs/amazonbedrockknowledgebaseretriever) | Retriever | ✅ Available |
|
||||
| [AmazonBedrockRanker](https://docs.haystack.deepset.ai/docs/amazonbedrockranker) | Ranker | ✅ Available |
|
||||
| [AmazonBedrockTextEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrocktextembedder) | Embedder | ✅ Available |
|
||||
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
# docs-website/docs/ Guidelines
|
||||
|
||||
## Documentation
|
||||
|
||||
- Edit `docs-website/docs/pipeline-components/` pages only for outdated, incorrect, or materially useful guidance; keep examples concise and `Agent`-level and polish prose before merge — avoids churn while keeping docs copyable
|
||||
- Add `## Overview` near the top of `docs-website/docs/pipeline-components/**` pages — explains what the component does and why to use it before details
|
||||
- Document component outputs, extractor side effects, and exact `doc.meta` keys; link producers, API references, and the authoritative reference for any partial config summary
|
||||
- Use current chat APIs in new docs pipelines — `ChatPromptBuilder`, `ChatMessage`, chat generators, and `result["last_message"]` for agent output — matching wiring, edge names like `prompt`, and declared variables; keep YAML examples on current default model names
|
||||
- Mark joiners/adapters optional where smart pipeline connections already handle the composition
|
||||
@@ -107,6 +107,7 @@ The [Haystack Enterprise Platform](https://www.deepset.ai/haystack-platform) cur
|
||||
| [AmazonBedrockChatGenerator](https://docs.haystack.deepset.ai/docs/amazonbedrockchatgenerator) | Generator | ✅ Available |
|
||||
| [AmazonBedrockDocumentEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrockdocumentembedder) | Embedder | ✅ Available |
|
||||
| [AmazonBedrockDocumentImageEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrockdocumentimageembedder) | Embedder | ✅ Available |
|
||||
| [AmazonBedrockKnowledgeBaseRetriever](https://docs.haystack.deepset.ai/docs/amazonbedrockknowledgebaseretriever) | Retriever | ✅ Available |
|
||||
| [AmazonBedrockRanker](https://docs.haystack.deepset.ai/docs/amazonbedrockranker) | Ranker | ✅ Available |
|
||||
| [AmazonBedrockTextEmbedder](https://docs.haystack.deepset.ai/docs/amazonbedrocktextembedder) | Embedder | ✅ Available |
|
||||
|
||||
|
||||
+2
@@ -74,6 +74,8 @@ The `reasoning` parameter accepts:
|
||||
|
||||
:::note
|
||||
OpenAI does not return the actual reasoning tokens, but you can view the summary if enabled. For more details, see the [OpenAI Reasoning documentation](https://platform.openai.com/docs/guides/reasoning).
|
||||
|
||||
If a provider returns the raw reasoning as `reasoning_text` content instead, it is mapped to `reasoning.reasoning_text` in the reply when no summary is returned.
|
||||
:::
|
||||
|
||||
### Multi-turn Conversations
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import inspect
|
||||
from collections import Counter
|
||||
from dataclasses import dataclass
|
||||
from typing import Any, Literal, cast
|
||||
|
||||
@@ -28,7 +29,12 @@ from haystack.components.agents.utils import (
|
||||
)
|
||||
from haystack.components.builders import ChatPromptBuilder
|
||||
from haystack.components.generators.chat.types import ChatGenerator
|
||||
from haystack.core.serialization import component_to_dict, default_from_dict, default_to_dict
|
||||
from haystack.core.serialization import (
|
||||
component_to_dict,
|
||||
default_from_dict,
|
||||
default_to_dict,
|
||||
generate_qualified_class_name,
|
||||
)
|
||||
from haystack.dataclasses import ChatMessage, ChatRole, StreamingCallbackT, select_streaming_callback
|
||||
from haystack.hooks.invocation import _run_hooks, _run_hooks_async
|
||||
from haystack.hooks.protocol import (
|
||||
@@ -51,6 +57,8 @@ from haystack.hooks.utils import (
|
||||
warm_up_hooks_async,
|
||||
)
|
||||
from haystack.tools import (
|
||||
ComponentTool,
|
||||
Tool,
|
||||
Toolset,
|
||||
ToolsType,
|
||||
_check_duplicate_tool_names,
|
||||
@@ -202,6 +210,34 @@ def _pending_tool_call_messages_from_state(state: State) -> list[ChatMessage]:
|
||||
return [last_message] if last_message.tool_calls else []
|
||||
|
||||
|
||||
def _get_tool_telemetry_data(tool: Tool) -> dict[str, Any]:
|
||||
"""
|
||||
Describe a single tool for telemetry.
|
||||
|
||||
Descriptions are deliberately left out: they are free text that can hold personal or confidential data.
|
||||
"""
|
||||
data = {"type": generate_qualified_class_name(type(tool)), "name": tool.name}
|
||||
if isinstance(tool, ComponentTool):
|
||||
data["component"] = generate_qualified_class_name(type(tool._component))
|
||||
return data
|
||||
|
||||
|
||||
def _get_tools_telemetry_data(tools: ToolsType) -> dict[str, Any]:
|
||||
"""
|
||||
Summarize the tools for telemetry.
|
||||
|
||||
Call it only after the tools are warmed up: flattening iterates the Toolsets, and some of them (e.g.
|
||||
SearchableToolset) warm up on iteration, while others (e.g. MCPToolset) only load their tools in `warm_up()`.
|
||||
"""
|
||||
toolsets = [tools] if isinstance(tools, Toolset) else [entry for entry in tools if isinstance(entry, Toolset)]
|
||||
flat_tools = flatten_tools_or_toolsets(tools=tools)
|
||||
return {
|
||||
"count": len(flat_tools),
|
||||
"tools": [_get_tool_telemetry_data(tool) for tool in flat_tools],
|
||||
"toolset_types": dict(Counter(generate_qualified_class_name(type(toolset)) for toolset in toolsets)),
|
||||
}
|
||||
|
||||
|
||||
@dataclass(kw_only=True)
|
||||
class _ExecutionContext:
|
||||
"""
|
||||
@@ -638,6 +674,15 @@ class Agent:
|
||||
params: dict[str, Any] = {name: getattr(self, name) for name in init_params if name != "self"}
|
||||
return type(self)(**{**params, **overrides})
|
||||
|
||||
def _get_telemetry_data(self) -> dict[str, Any]:
|
||||
"""
|
||||
Data that is sent to Posthog for usage analytics.
|
||||
"""
|
||||
chat_generator_data: dict[str, Any] = {"type": generate_qualified_class_name(type(self.chat_generator))}
|
||||
if hasattr(self.chat_generator, "_get_telemetry_data"):
|
||||
chat_generator_data.update(self.chat_generator._get_telemetry_data())
|
||||
return {"chat_generator": chat_generator_data, "tools": _get_tools_telemetry_data(self.tools)}
|
||||
|
||||
def to_dict(self) -> dict[str, Any]:
|
||||
"""
|
||||
Serialize the component to a dictionary.
|
||||
|
||||
@@ -17,7 +17,7 @@ from haystack.dataclasses import ChatMessage, ToolCall
|
||||
from haystack.dataclasses.streaming_chunk import StreamingCallbackT, StreamingChunk, _invoke_streaming_callback
|
||||
from haystack.tools import ComponentTool, Tool, ToolsType, _check_duplicate_tool_names, flatten_tools_or_toolsets
|
||||
from haystack.tools.errors import ToolInvocationError
|
||||
from haystack.tools.parameters_schema_utils import _unwrap_optional
|
||||
from haystack.tools.parameters_schema_utils import _is_state_annotation
|
||||
from haystack.tracing.utils import _serializable_value
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -307,7 +307,7 @@ def _inject_state_args(tool: Tool, llm_args: dict[str, Any], state: State) -> di
|
||||
|
||||
# We also inject the full State object for any parameter annotated as State
|
||||
for param_name, param_type in func_params.items():
|
||||
if _unwrap_optional(param_type) is State:
|
||||
if _is_state_annotation(param_type):
|
||||
final_args[param_name] = state
|
||||
|
||||
return final_args
|
||||
@@ -424,7 +424,7 @@ def _state_io_for_call(tool: Tool, llm_args: dict[str, Any]) -> tuple[_StateKeys
|
||||
"""
|
||||
func_params = _get_func_params(tool)
|
||||
# Check if State is in func_params
|
||||
if any(_unwrap_optional(param_type) is State for param_type in func_params.values()):
|
||||
if any(_is_state_annotation(param_type) for param_type in func_params.values()):
|
||||
return _ALL_STATE_KEYS, _ALL_STATE_KEYS
|
||||
|
||||
# Calculate reads
|
||||
|
||||
@@ -36,7 +36,10 @@ class HTMLToDocument:
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self, extraction_kwargs: dict[str, Any] | None = None, store_full_path: bool = False, encoding: str = "utf-8"
|
||||
self,
|
||||
extraction_kwargs: dict[str, Any] | None = None,
|
||||
store_full_path: bool = False,
|
||||
encoding: str | None = None,
|
||||
) -> None:
|
||||
"""
|
||||
Create an HTMLToDocument component.
|
||||
@@ -48,8 +51,9 @@ class HTMLToDocument:
|
||||
If True, the full path of the file is stored in the metadata of the document.
|
||||
If False, only the file name is stored.
|
||||
:param encoding:
|
||||
The default encoding to use when converting HTML files. If the encoding is specified in the metadata of a
|
||||
source ByteStream, it overrides this value.
|
||||
The encoding to use when decoding HTML files. If None (the default), Trafilatura detects the encoding.
|
||||
If detection produces incorrect characters, install `trafilatura[all]` for additional encoding detection
|
||||
support, or set this parameter if you know the encoding.
|
||||
"""
|
||||
trafilatura_import.check()
|
||||
|
||||
@@ -124,8 +128,9 @@ class HTMLToDocument:
|
||||
continue
|
||||
|
||||
try:
|
||||
encoding = bytestream.meta.get("encoding", self.encoding)
|
||||
text = extract(bytestream.data.decode(encoding), **merged_extraction_kwargs)
|
||||
html_bytes = bytestream.data
|
||||
html_content = html_bytes.decode(self.encoding) if self.encoding is not None else html_bytes
|
||||
text = extract(html_content, **merged_extraction_kwargs)
|
||||
except Exception as conversion_e:
|
||||
logger.warning(
|
||||
"Failed to extract text from {source}. Skipping it. Error: {error}",
|
||||
@@ -134,6 +139,10 @@ class HTMLToDocument:
|
||||
)
|
||||
continue
|
||||
|
||||
if text is None:
|
||||
logger.warning("No text could be extracted from {source}. Skipping it.", source=source)
|
||||
continue
|
||||
|
||||
merged_metadata = {**bytestream.meta, **metadata}
|
||||
|
||||
if not self.store_full_path and "file_path" in bytestream.meta:
|
||||
|
||||
@@ -162,54 +162,55 @@ def _convert_pdf_to_images(
|
||||
|
||||
resolved_page_range = page_range or range(1, num_pages + 1)
|
||||
|
||||
for page_number in resolved_page_range:
|
||||
if page_number < 1 or page_number > num_pages:
|
||||
logger.warning(
|
||||
"Page {page_number} is out of range for the PDF file {file_path}. Skipping it.",
|
||||
page_number=page_number,
|
||||
file_path=bytestream.meta.get("file_path"),
|
||||
)
|
||||
continue
|
||||
try:
|
||||
for page_number in resolved_page_range:
|
||||
if page_number < 1 or page_number > num_pages:
|
||||
logger.warning(
|
||||
"Page {page_number} is out of range for the PDF file {file_path}. Skipping it.",
|
||||
page_number=page_number,
|
||||
file_path=bytestream.meta.get("file_path"),
|
||||
)
|
||||
continue
|
||||
|
||||
# Get dimensions of the page
|
||||
page = pdf[max(page_number - 1, 0)] # Adjust for 0-based indexing
|
||||
_, _, width, height = page.get_mediabox()
|
||||
# Get dimensions of the page
|
||||
page = pdf[max(page_number - 1, 0)] # Adjust for 0-based indexing
|
||||
_, _, width, height = page.get_mediabox()
|
||||
|
||||
target_resolution_dpi = 300.0
|
||||
target_resolution_dpi = 300.0
|
||||
|
||||
# From pypdfium2 docs: scale (float) – A factor scaling the number of pixels per PDF canvas unit. This defines
|
||||
# the resolution of the image. To convert a DPI value to a scale factor, multiply it by the size of 1 canvas
|
||||
# unit in inches (usually 1/72in).
|
||||
# https://pypdfium2.readthedocs.io/en/stable/python_api.html#pypdfium2._helpers.page.PdfPage.render
|
||||
target_scale = target_resolution_dpi / 72.0
|
||||
# From pypdfium2 docs: scale (float) – A factor scaling the number of pixels per PDF canvas unit. This
|
||||
# defines the resolution of the image. To convert a DPI value to a scale factor, multiply it by the size of
|
||||
# 1 canvas unit in inches (usually 1/72in).
|
||||
# https://pypdfium2.readthedocs.io/en/stable/python_api.html#pypdfium2._helpers.page.PdfPage.render
|
||||
target_scale = target_resolution_dpi / 72.0
|
||||
|
||||
# Calculate potential pixels for target_dpi
|
||||
pixels_for_target_scale = width * height * target_scale**2
|
||||
# Calculate potential pixels for target_dpi
|
||||
pixels_for_target_scale = width * height * target_scale**2
|
||||
|
||||
pil_max_pixels = PILImage.MAX_IMAGE_PIXELS or int(1024 * 1024 * 1024 // 4 // 3)
|
||||
# 90% of PIL's default limit to prevent borderline cases
|
||||
pixel_limit = pil_max_pixels * 0.9
|
||||
pil_max_pixels = PILImage.MAX_IMAGE_PIXELS or int(1024 * 1024 * 1024 // 4 // 3)
|
||||
# 90% of PIL's default limit to prevent borderline cases
|
||||
pixel_limit = pil_max_pixels * 0.9
|
||||
|
||||
scale = target_scale
|
||||
if pixels_for_target_scale > pixel_limit:
|
||||
logger.info(
|
||||
"Large PDF detected ({pixels:.2f} pixels). Resizing the image to fit the pixel limit.",
|
||||
pixels=pixels_for_target_scale,
|
||||
)
|
||||
scale = (pixel_limit / (width * height)) ** 0.5
|
||||
scale = target_scale
|
||||
if pixels_for_target_scale > pixel_limit:
|
||||
logger.info(
|
||||
"Large PDF detected ({pixels:.2f} pixels). Resizing the image to fit the pixel limit.",
|
||||
pixels=pixels_for_target_scale,
|
||||
)
|
||||
scale = (pixel_limit / (width * height)) ** 0.5
|
||||
|
||||
pdf_bitmap = page.render(scale=scale)
|
||||
pdf_bitmap = page.render(scale=scale)
|
||||
|
||||
image: "Image" = pdf_bitmap.to_pil()
|
||||
pdf_bitmap.close()
|
||||
if size is not None:
|
||||
# Set reducing_gap=None to disable multi-step shrink; better quality.
|
||||
# https://pillow.readthedocs.io/en/latest/reference/Image.html#PIL.Image.Image.thumbnail
|
||||
image.thumbnail(size=size, reducing_gap=None)
|
||||
image: "Image" = pdf_bitmap.to_pil()
|
||||
pdf_bitmap.close()
|
||||
if size is not None:
|
||||
# Set reducing_gap=None to disable multi-step shrink; better quality.
|
||||
# https://pillow.readthedocs.io/en/latest/reference/Image.html#PIL.Image.Image.thumbnail
|
||||
image.thumbnail(size=size, reducing_gap=None)
|
||||
|
||||
all_pdf_images.append((page_number, image))
|
||||
|
||||
pdf.close()
|
||||
all_pdf_images.append((page_number, image))
|
||||
finally:
|
||||
pdf.close()
|
||||
|
||||
if return_base64:
|
||||
return [
|
||||
|
||||
@@ -71,13 +71,14 @@ class LLMDocumentContentExtractor:
|
||||
Response handling:
|
||||
- If the LLM returns a **plain string** (non-JSON or not a JSON object), it is written to the document's content.
|
||||
- If the LLM returns a **JSON object with only the key** `document_content`, that value is written to content.
|
||||
- If the LLM returns a **JSON object with multiple keys**, the value of ``document_content`` (if present) is
|
||||
- If the LLM returns a **JSON object with multiple keys**, the value of `document_content` (if present) is
|
||||
written to content and all other keys are merged into the document's metadata.
|
||||
|
||||
The ChatGenerator can be configured to return JSON. For example, with the OpenAIResponsesChatGenerator, pass
|
||||
`{"text": {"format": {"type": "json_schema", ...}}}` in `generation_kwargs` as shown in the usage example below.
|
||||
|
||||
Documents that fail extraction are returned in ``failed_documents`` with ``content_extraction_error`` in metadata.
|
||||
Documents that fail extraction are returned in `failed_documents` with the error in their `extraction_error`
|
||||
metadata field.
|
||||
|
||||
### Usage example
|
||||
|
||||
@@ -161,7 +162,8 @@ class LLMDocumentContentExtractor:
|
||||
that path-traversal payloads (e.g. absolute paths or `../`) are rejected instead of read.
|
||||
:param detail: Optional detail level of the image (only supported by OpenAI). Can be "auto", "high", or "low".
|
||||
:param size: If provided, resizes the image to fit within (width, height) while keeping aspect ratio.
|
||||
:param raise_on_failure: If True, exceptions from the LLM are raised. If False, failed documents are returned.
|
||||
:param raise_on_failure: If True, exceptions from the LLM are raised. If False, documents that fail extraction
|
||||
are returned in `failed_documents` with the error in their `extraction_error` metadata field.
|
||||
:param max_workers: Maximum number of threads for parallel LLM calls.
|
||||
"""
|
||||
self._chat_generator = chat_generator
|
||||
@@ -260,7 +262,7 @@ class LLMDocumentContentExtractor:
|
||||
Parse LLM response. Returns (content, meta_updates, error).
|
||||
|
||||
- Plain string (non-JSON): use entire response as document content;
|
||||
- Valid JSON object: use key ``document_content`` for Document.content and all other keys for Document.metadata;
|
||||
- Valid JSON object: use key `document_content` for Document.content and all other keys for Document.metadata;
|
||||
- Valid JSON but not an object (e.g. array or primitive), report an error;
|
||||
"""
|
||||
try:
|
||||
@@ -276,7 +278,7 @@ class LLMDocumentContentExtractor:
|
||||
|
||||
@staticmethod
|
||||
def _fail(document: Document, error: str) -> tuple[Document, bool]:
|
||||
"""Return a copy of ``document`` with ``extraction_error`` set, flagged as failed."""
|
||||
"""Return a copy of `document` with `extraction_error` set, flagged as failed."""
|
||||
return replace(document, meta={**document.meta, "extraction_error": error}), False
|
||||
|
||||
def _run_on_thread(
|
||||
@@ -292,7 +294,7 @@ class LLMDocumentContentExtractor:
|
||||
The updated document and True on success, or the document with failure metadata and False.
|
||||
"""
|
||||
if image_content is None:
|
||||
return self._fail(document, "Document has no content, skipping LLM call.")
|
||||
return self._fail(document, "Document could not be converted to an image, skipping LLM call.")
|
||||
|
||||
# the prompt is the same for all documents, so we can set it up once here for each document/thread
|
||||
message = ChatMessage.from_user(content_parts=[TextContent(text=self.prompt), image_content])
|
||||
@@ -307,8 +309,8 @@ class LLMDocumentContentExtractor:
|
||||
if self.raise_on_failure:
|
||||
raise e
|
||||
logger.exception(
|
||||
"LLM {class_name} execution failed. Skipping metadata extraction. Failed with exception '{error}'.",
|
||||
class_name=self._chat_generator.__class__.__name__,
|
||||
"LLMDocumentContentExtractor failed during chat generation. Returning the document in "
|
||||
"failed_documents. Error: {error}",
|
||||
error=e,
|
||||
)
|
||||
return self._fail(document, "LLM failed with exception: " + str(e))
|
||||
@@ -328,7 +330,7 @@ class LLMDocumentContentExtractor:
|
||||
The updated document and True on success, or the document with failure metadata and False.
|
||||
"""
|
||||
if image_content is None:
|
||||
return self._fail(document, "Document has no content, skipping LLM call.")
|
||||
return self._fail(document, "Document could not be converted to an image, skipping LLM call.")
|
||||
|
||||
# the prompt is the same for all documents, so we can set it up once here for each document
|
||||
message = ChatMessage.from_user(content_parts=[TextContent(text=self.prompt), image_content])
|
||||
@@ -343,8 +345,8 @@ class LLMDocumentContentExtractor:
|
||||
if self.raise_on_failure:
|
||||
raise e
|
||||
logger.exception(
|
||||
"LLM {class_name} execution failed. Skipping metadata extraction. Failed with exception '{error}'.",
|
||||
class_name=self._chat_generator.__class__.__name__,
|
||||
"LLMDocumentContentExtractor failed during chat generation. Returning the document in "
|
||||
"failed_documents. Error: {error}",
|
||||
error=e,
|
||||
)
|
||||
return self._fail(document, "LLM failed with exception: " + str(e))
|
||||
@@ -366,6 +368,12 @@ class LLMDocumentContentExtractor:
|
||||
content, meta_updates, error = LLMDocumentContentExtractor._process_response(reply.text or "")
|
||||
|
||||
if error:
|
||||
logger.warning(
|
||||
"LLMDocumentContentExtractor couldn't use the ChatGenerator response for document {document_id}. "
|
||||
"Returning the document in failed_documents. Error: {error}",
|
||||
document_id=document.id,
|
||||
error=error,
|
||||
)
|
||||
new_meta["extraction_error"] = error
|
||||
return replace(document, meta=new_meta), False
|
||||
|
||||
|
||||
@@ -183,6 +183,8 @@ class OpenAIResponsesChatGenerator:
|
||||
- `generate_summary`: Whether to generate a summary of the reasoning.
|
||||
- `mode`: The reasoning mode. Can be `standard`, or `pro`. Supported since GPT-5.6.
|
||||
Note: OpenAI does not return the reasoning tokens, but we can view summary if its enabled.
|
||||
If a provider returns the raw reasoning as `reasoning_text` content instead,
|
||||
it is mapped to `ReasoningContent.reasoning_text` when no summary is returned.
|
||||
For details, see the [OpenAI Reasoning documentation](https://platform.openai.com/docs/guides/reasoning).
|
||||
- `include`: Specify additional output data to include in the model response. Supported values are:
|
||||
- web_search_call.action.sources: Include the sources of the web search tool call.
|
||||
@@ -662,20 +664,13 @@ def _convert_response_to_chat_message(responses: Response | ParsedResponse) -> C
|
||||
logprobs.append(_serialize_object(content.logprobs))
|
||||
|
||||
if output.type == "reasoning":
|
||||
# openai doesn't return the reasoning tokens, but we can view summary if its enabled
|
||||
# https://platform.openai.com/docs/guides/reasoning#reasoning-summaries
|
||||
summaries = output.summary
|
||||
extra = output.to_dict()
|
||||
# we dont need the summary in the extra
|
||||
extra.pop("summary")
|
||||
if output.content:
|
||||
logger.warning(
|
||||
"OpenAI returned a non-empty 'content' field on a reasoning item ({_id}). "
|
||||
"The content is preserved in ReasoningContent.extra['content'] but is NOT "
|
||||
"reflected in ReasoningContent.reasoning_text.",
|
||||
_id=output.id,
|
||||
)
|
||||
reasoning_text = "\n".join([summary.text for summary in summaries if summaries])
|
||||
# OpenAI returns reasoning summaries, other providers may return raw reasoning as `reasoning_text` content
|
||||
reasoning_text = "\n".join(summary.text for summary in output.summary)
|
||||
if not reasoning_text:
|
||||
reasoning_text = "\n".join(part.text for part in output.content or [] if part.type == "reasoning_text")
|
||||
reasoning = ReasoningContent(reasoning_text=reasoning_text, extra=extra)
|
||||
|
||||
elif output.type == "function_call":
|
||||
@@ -761,15 +756,7 @@ def _convert_response_chunk_to_streaming_chunk( # noqa: PLR0911
|
||||
# event falls through to the generic default and reasoning=None, so encrypted_content
|
||||
# is never available for multi-turn conversations.
|
||||
if chunk.item.type == "reasoning":
|
||||
if chunk.item.content:
|
||||
logger.warning(
|
||||
"OpenAI returned a non-empty 'content' field on a reasoning item ({_id}). "
|
||||
"This field is currently undocumented and was never observed in practice. "
|
||||
"The content is preserved in ReasoningContent.extra['content'] but is NOT "
|
||||
"reflected in ReasoningContent.reasoning_text. Please report this at "
|
||||
"https://github.com/deepset-ai/haystack/issues so we can update the mapping.",
|
||||
_id=chunk.item.id,
|
||||
)
|
||||
# The completed item repeats the reasoning text already streamed as deltas, so we only keep its fields
|
||||
reasoning = ReasoningContent(reasoning_text="", extra=chunk.item.to_dict())
|
||||
return StreamingChunk(
|
||||
content="",
|
||||
@@ -804,7 +791,10 @@ def _convert_response_chunk_to_streaming_chunk( # noqa: PLR0911
|
||||
meta={**chunk.to_dict(), "received_at": datetime.now().isoformat()},
|
||||
)
|
||||
|
||||
elif chunk.type == "response.reasoning_summary_text.delta":
|
||||
# Unlike non-streaming, where raw reasoning text is only a fallback when there is no summary, summary and raw
|
||||
# reasoning deltas are both streamed as they arrive and end up concatenated in the final reasoning_text.
|
||||
# In practice this rarely matters, because providers usually send only one kind.
|
||||
elif chunk.type in ("response.reasoning_summary_text.delta", "response.reasoning_text.delta"):
|
||||
# We remove the delta from the extra because it is already in the reasoning_text
|
||||
# Remaining information needs to be saved for chat message
|
||||
extra = chunk.to_dict()
|
||||
@@ -1042,7 +1032,8 @@ def _convert_chat_message_to_responses_api_format(message: ChatMessage) -> list[
|
||||
_valid_reasoning_fields = {"id", "type", "encrypted_content", "status", "content"}
|
||||
filtered_extra = {k: v for k, v in reasoning.extra.items() if k in _valid_reasoning_fields}
|
||||
reasoning_item = {"summary": [], **filtered_extra}
|
||||
if reasoning.reasoning_text:
|
||||
# Raw reasoning text is already sent back in `content`, repeating it as a summary would duplicate it
|
||||
if reasoning.reasoning_text and not filtered_extra.get("content"):
|
||||
reasoning_item["summary"] = [{"text": reasoning.reasoning_text, "type": "summary_text"}]
|
||||
formatted_reasonings.append(reasoning_item)
|
||||
formatted_messages.extend(formatted_reasonings)
|
||||
|
||||
@@ -103,7 +103,7 @@ if nltk_imports.is_successful():
|
||||
"""
|
||||
try:
|
||||
return self._re_period_context # type: ignore
|
||||
except: # noqa: E722
|
||||
except AttributeError:
|
||||
self._re_period_context = re.compile(
|
||||
self._period_context_fmt
|
||||
% {
|
||||
|
||||
@@ -764,7 +764,8 @@ class PipelineBase: # noqa: PLW1641
|
||||
receiver_socket_name=receiver_socket.name,
|
||||
)
|
||||
|
||||
if receiver_component_name in sender_socket.receivers and sender_component_name in receiver_socket.senders:
|
||||
edge_key = f"{sender_socket.name}/{receiver_socket.name}"
|
||||
if self.graph.has_edge(sender_component_name, receiver_component_name, key=edge_key):
|
||||
# This is already connected, nothing to do
|
||||
return self
|
||||
|
||||
|
||||
@@ -162,14 +162,15 @@ def _save_pipeline_snapshot(
|
||||
the function will return None without saving to a file (custom callbacks are still invoked).
|
||||
|
||||
:param pipeline_snapshot: The pipeline snapshot to save.
|
||||
:param raise_on_failure: If True, raises an exception if saving fails. If False, logs the error and returns.
|
||||
:param raise_on_failure: If True, raises an exception if saving fails. If False, logs the error and returns None.
|
||||
:param snapshot_callback: Optional callback function that receives the PipelineSnapshot.
|
||||
If provided, the callback is invoked instead of the default file-saving behavior.
|
||||
The callback should return an optional string (e.g., a file path or identifier) or None.
|
||||
|
||||
:returns:
|
||||
The full path to the saved JSON file (or the value returned by the callback), or None if
|
||||
`snapshot_file_path` is None, no callback is provided, or snapshot saving is disabled.
|
||||
`snapshot_file_path` is None, no callback is provided, snapshot saving is disabled, or saving fails and
|
||||
`raise_on_failure` is False.
|
||||
:raises:
|
||||
Exception: If saving the JSON snapshot fails (when raise_on_failure is True).
|
||||
"""
|
||||
@@ -217,6 +218,7 @@ def _save_pipeline_snapshot(
|
||||
logger.exception("Failed to save pipeline snapshot to '{full_path}'. Error: {e}", full_path=full_path, e=error)
|
||||
if raise_on_failure:
|
||||
raise
|
||||
return None
|
||||
|
||||
return str(full_path)
|
||||
|
||||
|
||||
@@ -325,8 +325,6 @@ class Pipeline(PipelineBase):
|
||||
:raises PipelineBreakpointException:
|
||||
When a pipeline_breakpoint is triggered. Contains the component name, state, and partial results.
|
||||
"""
|
||||
pipeline_running(self) # telemetry
|
||||
|
||||
if (
|
||||
break_point
|
||||
and pipeline_snapshot
|
||||
@@ -347,6 +345,9 @@ class Pipeline(PipelineBase):
|
||||
# warm up the pipeline by running each component's warm_up method
|
||||
self.warm_up()
|
||||
|
||||
# after warm-up, so toolsets that load their tools in warm_up() report them
|
||||
pipeline_running(self) # telemetry
|
||||
|
||||
if include_outputs_from is None:
|
||||
include_outputs_from = set()
|
||||
|
||||
@@ -900,11 +901,12 @@ class Pipeline(PipelineBase):
|
||||
if concurrency_limit < 1:
|
||||
raise ValueError("concurrency_limit must be greater than or equal to 1.")
|
||||
|
||||
pipeline_running(self) # telemetry
|
||||
|
||||
# warm up the pipeline by running each component's warm_up_async (or warm_up) method
|
||||
await self.warm_up_async()
|
||||
|
||||
# after warm-up, so toolsets that load their tools in warm_up() report them
|
||||
pipeline_running(self) # telemetry
|
||||
|
||||
if include_outputs_from is None:
|
||||
include_outputs_from = set()
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ class EvaluationRunResult:
|
||||
row = [data[header][i] for header in headers]
|
||||
rows.append(row)
|
||||
|
||||
with open(csv_file, "w", newline="") as csvfile:
|
||||
with open(csv_file, "w", newline="", encoding="utf-8") as csvfile:
|
||||
writer = csv.writer(csvfile)
|
||||
writer.writerow(headers)
|
||||
writer.writerows(rows)
|
||||
|
||||
@@ -8,7 +8,6 @@ from typing import Any, get_args, get_origin
|
||||
from pydantic import Field, TypeAdapter, create_model
|
||||
|
||||
from haystack import logging
|
||||
from haystack.components.agents.state.state import State
|
||||
from haystack.core.component import Component
|
||||
from haystack.core.serialization import component_to_dict, generate_qualified_class_name
|
||||
from haystack.tools import Tool
|
||||
@@ -17,6 +16,7 @@ from haystack.tools.from_function import _remove_title_from_schema
|
||||
from haystack.tools.parameters_schema_utils import (
|
||||
_contains_callable_type,
|
||||
_get_component_param_descriptions,
|
||||
_is_state_annotation,
|
||||
_resolve_type,
|
||||
_unwrap_optional,
|
||||
)
|
||||
@@ -361,7 +361,7 @@ class ComponentTool(Tool):
|
||||
continue
|
||||
|
||||
# Skip State-typed parameters - Agent tool execution injects them at runtime
|
||||
if _unwrap_optional(input_type) is State:
|
||||
if _is_state_annotation(input_type):
|
||||
continue
|
||||
|
||||
description = param_descriptions.get(input_name, f"Input '{input_name}' for the component.")
|
||||
|
||||
@@ -8,11 +8,10 @@ from typing import Any, overload
|
||||
|
||||
from pydantic import create_model
|
||||
|
||||
from haystack.components.agents.state.state import State
|
||||
from haystack.core.type_utils import _resolve_parameter_types
|
||||
|
||||
from .errors import SchemaGenerationError
|
||||
from .parameters_schema_utils import _contains_callable_type, _unwrap_optional
|
||||
from .parameters_schema_utils import _contains_callable_type, _is_state_annotation
|
||||
from .tool import Tool
|
||||
|
||||
|
||||
@@ -149,7 +148,7 @@ def create_tool_from_function(
|
||||
continue
|
||||
|
||||
# Skip State-typed parameters (including Optional[State]) - Agent tool execution injects them at runtime
|
||||
if _unwrap_optional(annotation) is State:
|
||||
if _is_state_annotation(annotation):
|
||||
continue
|
||||
|
||||
if annotation is param.empty:
|
||||
|
||||
@@ -9,12 +9,13 @@ from collections.abc import Callable as ABCCallable
|
||||
from dataclasses import MISSING, fields, is_dataclass
|
||||
from inspect import getdoc
|
||||
from types import NoneType
|
||||
from typing import Any, Union, get_args, get_origin
|
||||
from typing import Annotated, Any, Union, get_args, get_origin
|
||||
|
||||
from docstring_parser import parse
|
||||
from pydantic import BaseModel, Field, create_model
|
||||
|
||||
from haystack import logging
|
||||
from haystack.components.agents.state.state import State
|
||||
from haystack.dataclasses import ChatMessage
|
||||
from haystack.utils.type_serialization import _is_union_type
|
||||
|
||||
@@ -36,6 +37,18 @@ def _unwrap_optional(type_hint: Any) -> Any:
|
||||
return type_hint
|
||||
|
||||
|
||||
def _is_state_annotation(annotation: Any) -> bool:
|
||||
"""Recognize State through Annotated and optional wrappers."""
|
||||
if get_origin(annotation) is Annotated:
|
||||
return _is_state_annotation(get_args(annotation)[0])
|
||||
|
||||
unwrapped = _unwrap_optional(annotation)
|
||||
if unwrapped is not annotation:
|
||||
return _is_state_annotation(unwrapped)
|
||||
|
||||
return annotation is State
|
||||
|
||||
|
||||
def _contains_callable_type(type_hint: Any) -> bool:
|
||||
"""
|
||||
Check if a type hint contains a Callable type, including within Union types.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
enhancements:
|
||||
- |
|
||||
When an ``Agent`` runs inside a ``Pipeline``, the anonymous pipeline telemetry event now also reports the
|
||||
chat generator class and its tools: the number of tools, the class and name of each tool, the component
|
||||
wrapped by each ``ComponentTool``, and the classes of any ``Toolset`` objects.
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Converting PDF pages to images, as ``PDFToImageContent`` and ``DocumentToImageContent`` do, now closes the
|
||||
pypdfium2 document even when rendering a page raises an error. Before, the document was only closed after all
|
||||
pages rendered successfully, so a failing page left it open until garbage collection.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixed a ``SchemaGenerationError`` when using ``@tool``, ``create_tool_from_function``, or ``ComponentTool``
|
||||
with a parameter typed as ``Annotated[State, ...]``, including optional variants.
|
||||
These parameters are now excluded from the schema sent to the language model and receive
|
||||
the Agent's live ``State`` object when the tool runs, just like parameters typed as ``State``.
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
``EvaluationRunResult.aggregated_report``, ``detailed_report`` and ``comparative_detailed_report`` with
|
||||
``output_format="csv"`` now write the CSV file as UTF-8. Previously the file used the locale encoding, so on Windows
|
||||
a report with text outside the ANSI code page (e.g. Japanese or Cyrillic questions) was left half-written and an
|
||||
error message was returned instead, and accented characters were written as cp1252.
|
||||
@@ -0,0 +1,15 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
``HTMLToDocument`` now defaults to ``encoding=None``, delegating HTML encoding detection to Trafilatura.
|
||||
Set ``encoding="utf-8"`` to retain explicit UTF-8 decoding.
|
||||
- |
|
||||
Previously, ``HTMLToDocument`` used the ``encoding`` value in a source ByteStream's metadata to decode its content,
|
||||
overriding the converter's encoding setting. This metadata no longer affects decoding. If you relied on it,
|
||||
pass the encoding to the converter instead, for example ``HTMLToDocument(encoding="latin-1")``.
|
||||
enhancements:
|
||||
- |
|
||||
``HTMLToDocument`` now uses Trafilatura's encoding detection instead of assuming UTF-8, allowing non-UTF-8 sources
|
||||
to be converted without manually specifying their encoding. If conversion produces incorrect characters,
|
||||
install ``trafilatura[all]`` for additional encoding detection support, or set the converter's ``encoding``
|
||||
explicitly.
|
||||
@@ -0,0 +1,8 @@
|
||||
---
|
||||
fixes:
|
||||
- |
|
||||
Fixed misleading ``LLMDocumentContentExtractor`` messages. The failure warning said "Skipping metadata
|
||||
extraction", and a document that couldn't be converted to an image got ``extraction_error`` set to "Document has
|
||||
no content". The docstring also named the wrong metadata field (``content_extraction_error`` instead of
|
||||
``extraction_error``). Warnings now say the document is returned in ``failed_documents``, and a response that
|
||||
isn't a JSON object is now logged too.
|
||||
@@ -0,0 +1,6 @@
|
||||
fixes:
|
||||
- |
|
||||
Fix ``Pipeline.connect()`` silently skipping a new socket-to-socket connection
|
||||
when other connections already link the same sender and receiver components.
|
||||
Repeating an existing connection remains a no-op, and invalid additional
|
||||
connections now raise the expected error.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user