Commit 6c2627b
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
- src/haystack_integrations/components/generators/openrouter/chat
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
0 commit comments