From 32b07c1720e61ef018f7abf8f622bdb6b76394cf Mon Sep 17 00:00:00 2001 From: James Hush Date: Tue, 30 Sep 2025 15:31:33 +0800 Subject: [PATCH] Fix AWS Bedrock timeout exception handling - Use ReadTimeoutError and asyncio.TimeoutError which are the actual exceptions thrown by boto3 --- CHANGELOG.md | 3 +++ src/pipecat/services/aws/llm.py | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d77524a06..253db66b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Fixed +- Fixed an issue in `AWSBedrockLLMService` where timeout exceptions weren't + being detected. + - Fixed a `PipelineTask` issue that could prevent the application to exit if `task.cancel()` was called when the task was already finished. diff --git a/src/pipecat/services/aws/llm.py b/src/pipecat/services/aws/llm.py index f51e3864c..377848f76 100644 --- a/src/pipecat/services/aws/llm.py +++ b/src/pipecat/services/aws/llm.py @@ -61,7 +61,6 @@ from pipecat.utils.tracing.service_decorators import traced_llm try: import aioboto3 - import httpx from botocore.config import Config from botocore.exceptions import ReadTimeoutError except ModuleNotFoundError as e: @@ -1117,7 +1116,7 @@ class AWSBedrockLLMService(LLMService): # also get cancelled. use_completion_tokens_estimate = True raise - except httpx.TimeoutException: + except (ReadTimeoutError, asyncio.TimeoutError): await self._call_event_handler("on_completion_timeout") except Exception as e: logger.exception(f"{self} exception: {e}")