Skip to content

Commit 6c2627b

Browse files
julian-rischclaude
andcommitted
refactor: align OpenRouter reasoning support with MistralChatGenerator
- Accept `list[ChatMessage] | str` in run/run_async and normalize via `_normalize_messages`. Fixes the mypy override (LSP) error and restores the string-input support that OpenAIChatGenerator now provides. - Stop overriding the streaming handlers and the chunk converter; inherit them from the parent and instead warn when streaming is combined with reasoning, since reasoning content can only be reconstructed from non-streaming responses (mirrors MistralChatGenerator). This removes ~150 lines of duplicated parent code that also silently dropped `reasoning_details` during streaming, so multi-turn reasoning pass-back no longer no-ops when streaming. - Restore the explanatory comments that were dropped from `to_dict` and `_prepare_api_call` (the `openai_endpoint` hint mechanism and the `to_dict` override rationale). - Bump the `haystack-ai` dependency to >=2.30.0 for `_normalize_messages`. - Tests: add string-input and streaming-with-reasoning-warning tests; drop the tests for the removed streaming converter. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3380a4f commit 6c2627b

4 files changed

Lines changed: 123 additions & 360 deletions

File tree

integrations/openrouter/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ classifiers = [
2323
"Programming Language :: Python :: Implementation :: CPython",
2424
"Programming Language :: Python :: Implementation :: PyPy",
2525
]
26-
dependencies = ["haystack-ai>=2.22.0"]
26+
dependencies = ["haystack-ai>=2.30.0"]
2727

2828
[project.urls]
2929
Documentation = "https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/openrouter#readme"

0 commit comments

Comments
 (0)