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:
13
CHANGELOG.md
13
CHANGELOG.md
@@ -87,12 +87,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
- Added support to `AWSBedrockLLMService` for setting authentication
|
||||||
|
credentials through environment variables.
|
||||||
|
|
||||||
- Updated `SarvamTTSService` to use WebSocket streaming for real-time audio
|
- Updated `SarvamTTSService` to use WebSocket streaming for real-time audio
|
||||||
generation with multiple Indian languages, with HTTP support still available
|
generation with multiple Indian languages, with HTTP support still available
|
||||||
via `SarvamHttpTTSService`.
|
via `SarvamHttpTTSService`.
|
||||||
|
|
||||||
### Fixed
|
### 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
|
- Fixed a `CartesiaTTSService` issue that was causing the application to hang
|
||||||
after Cartesia's 5 minutes timed out.
|
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
|
### Deprecated
|
||||||
|
|
||||||
- `FrameProcessor.wait_for_task()` is deprecated. Use `await task` or `await
|
- `FrameProcessor.wait_for_task()` is deprecated. Use `await task` or
|
||||||
asyncio.wait_for(task, timeout)` instead.
|
`await asyncio.wait_for(task, timeout)` instead.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import base64
|
|||||||
import copy
|
import copy
|
||||||
import io
|
import io
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
@@ -761,10 +762,10 @@ class AWSBedrockLLMService(LLMService):
|
|||||||
|
|
||||||
# Store AWS session parameters for creating client in async context
|
# Store AWS session parameters for creating client in async context
|
||||||
self._aws_params = {
|
self._aws_params = {
|
||||||
"aws_access_key_id": aws_access_key,
|
"aws_access_key_id": aws_access_key or os.getenv("AWS_ACCESS_KEY_ID"),
|
||||||
"aws_secret_access_key": aws_secret_key,
|
"aws_secret_access_key": aws_secret_key or os.getenv("AWS_SECRET_ACCESS_KEY"),
|
||||||
"aws_session_token": aws_session_token,
|
"aws_session_token": aws_session_token or os.getenv("AWS_SESSION_TOKEN"),
|
||||||
"region_name": aws_region,
|
"region_name": aws_region or os.getenv("AWS_REGION", "us-east-1"),
|
||||||
"config": client_config,
|
"config": client_config,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,16 +185,6 @@ class AWSPollyTTSService(TTSService):
|
|||||||
"region_name": region or os.getenv("AWS_REGION", "us-east-1"),
|
"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._aws_session = aioboto3.Session()
|
||||||
self._settings = {
|
self._settings = {
|
||||||
"engine": params.engine,
|
"engine": params.engine,
|
||||||
|
|||||||
Reference in New Issue
Block a user