Fix AWS Bedrock timeout exception handling

- Use ReadTimeoutError and asyncio.TimeoutError which are the actual exceptions thrown by boto3
This commit is contained in:
James Hush
2025-09-30 15:31:33 +08:00
committed by Mark Backman
parent 029d76033d
commit 32b07c1720
2 changed files with 4 additions and 2 deletions

View File

@@ -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.

View File

@@ -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}")