File tree Expand file tree Collapse file tree 3 files changed +7
-9
lines changed
amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat
anthropic/src/haystack_integrations/components/generators/anthropic/chat
cohere/src/haystack_integrations/components/generators/cohere/chat Expand file tree Collapse file tree 3 files changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -371,7 +371,9 @@ def _prepare_request_params(
371
371
if additional_fields :
372
372
params ["additionalModelRequestFields" ] = additional_fields
373
373
374
- callback = select_streaming_callback (
374
+ # overloads that exhaust finite Literals(bool) not treated as exhaustive
375
+ # see https://github.com/python/mypy/issues/14764
376
+ callback = select_streaming_callback ( # type: ignore[call-overload]
375
377
init_callback = self .streaming_callback ,
376
378
runtime_callback = streaming_callback ,
377
379
requires_async = requires_async ,
Original file line number Diff line number Diff line change @@ -633,8 +633,7 @@ def run(
633
633
** generation_kwargs ,
634
634
)
635
635
636
- # select_streaming_callback returns a StreamingCallbackT, but we know it's SyncStreamingCallbackT
637
- return self ._process_response (response = response , streaming_callback = streaming_callback ) # type: ignore[arg-type]
636
+ return self ._process_response (response = response , streaming_callback = streaming_callback )
638
637
639
638
@component .output_types (replies = List [ChatMessage ])
640
639
async def run_async (
@@ -675,5 +674,4 @@ async def run_async(
675
674
** generation_kwargs ,
676
675
)
677
676
678
- # select_streaming_callback returns a StreamingCallbackT, but we know it's AsyncStreamingCallbackT
679
- return await self ._process_response_async (response , streaming_callback ) # type: ignore[arg-type]
677
+ return await self ._process_response_async (response , streaming_callback )
Original file line number Diff line number Diff line change @@ -528,11 +528,10 @@ def run(
528
528
messages = formatted_messages ,
529
529
** generation_kwargs ,
530
530
)
531
- # we know that streaming_callback is sync but mypy doesn't
532
531
chat_message = _parse_streaming_response (
533
532
response = streamed_response ,
534
533
model = self .model ,
535
- streaming_callback = streaming_callback , # type: ignore[arg-type]
534
+ streaming_callback = streaming_callback ,
536
535
)
537
536
else :
538
537
response = self .client .chat (
@@ -590,11 +589,10 @@ async def run_async(
590
589
messages = formatted_messages ,
591
590
** generation_kwargs ,
592
591
)
593
- # we know that streaming_callback is async but mypy doesn't
594
592
chat_message = await _parse_async_streaming_response (
595
593
response = streamed_response ,
596
594
model = self .model ,
597
- streaming_callback = streaming_callback , # type: ignore[arg-type]
595
+ streaming_callback = streaming_callback ,
598
596
)
599
597
else :
600
598
response = await self .async_client .chat (
You can’t perform that action at this time.
0 commit comments