Merge pull request #2501 from pipecat-ai/mb/aws-tts-more-flexible-auth

Support additional authentication mechanisms for AWS services
This commit is contained in:
Mark Backman
2025-08-26 18:05:37 -07:00
committed by GitHub
3 changed files with 18 additions and 18 deletions

View File

@@ -87,12 +87,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Updated `SarvamTTSService` to use WebSocket streaming for real-time audio
generation with multiple Indian languages, with HTTP support still available
- Added support to `AWSBedrockLLMService` for setting authentication
credentials through environment variables.
- Updated `SarvamTTSService` to use WebSocket streaming for real-time audio
generation with multiple Indian languages, with HTTP support still available
via `SarvamHttpTTSService`.
### Fixed
- Fixed a missing import in `SentryMetrics`.
- Fixed `AWSPollyTTSService` to support AWS credential provider chain (IAM
roles, IRSA, instance profiles) instead of requiring explicit environment
variables.
- Fixed a `CartesiaTTSService` issue that was causing the application to hang
after Cartesia's 5 minutes timed out.
@@ -145,8 +154,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecated
- `FrameProcessor.wait_for_task()` is deprecated. Use `await task` or `await
asyncio.wait_for(task, timeout)` instead.
- `FrameProcessor.wait_for_task()` is deprecated. Use `await task` or
`await asyncio.wait_for(task, timeout)` instead.
### Removed

View File

@@ -16,6 +16,7 @@ import base64
import copy
import io
import json
import os
import re
from dataclasses import dataclass
from typing import Any, Dict, List, Optional
@@ -761,10 +762,10 @@ class AWSBedrockLLMService(LLMService):
# Store AWS session parameters for creating client in async context
self._aws_params = {
"aws_access_key_id": aws_access_key,
"aws_secret_access_key": aws_secret_key,
"aws_session_token": aws_session_token,
"region_name": aws_region,
"aws_access_key_id": aws_access_key or os.getenv("AWS_ACCESS_KEY_ID"),
"aws_secret_access_key": aws_secret_key or os.getenv("AWS_SECRET_ACCESS_KEY"),
"aws_session_token": aws_session_token or os.getenv("AWS_SESSION_TOKEN"),
"region_name": aws_region or os.getenv("AWS_REGION", "us-east-1"),
"config": client_config,
}

View File

@@ -185,16 +185,6 @@ class AWSPollyTTSService(TTSService):
"region_name": region or os.getenv("AWS_REGION", "us-east-1"),
}
# Validate that we have the required credentials
if (
not self._aws_params["aws_access_key_id"]
or not self._aws_params["aws_secret_access_key"]
):
raise ValueError(
"AWS credentials not found. Please provide them either through constructor parameters "
"or set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables."
)
self._aws_session = aioboto3.Session()
self._settings = {
"engine": params.engine,