Re-apply a couple of recent changes to AWSNovaSonicLLMService that were lost in a rebase
This commit is contained in:
@@ -65,7 +65,7 @@ try:
|
|||||||
BedrockRuntimeClient,
|
BedrockRuntimeClient,
|
||||||
InvokeModelWithBidirectionalStreamOperationInput,
|
InvokeModelWithBidirectionalStreamOperationInput,
|
||||||
)
|
)
|
||||||
from aws_sdk_bedrock_runtime.config import Config, HTTPAuthSchemeResolver, SigV4AuthScheme
|
from aws_sdk_bedrock_runtime.config import Config
|
||||||
from aws_sdk_bedrock_runtime.models import (
|
from aws_sdk_bedrock_runtime.models import (
|
||||||
BidirectionalInputPayloadPart,
|
BidirectionalInputPayloadPart,
|
||||||
InvokeModelWithBidirectionalStreamInput,
|
InvokeModelWithBidirectionalStreamInput,
|
||||||
@@ -73,8 +73,8 @@ try:
|
|||||||
InvokeModelWithBidirectionalStreamOperationOutput,
|
InvokeModelWithBidirectionalStreamOperationOutput,
|
||||||
InvokeModelWithBidirectionalStreamOutput,
|
InvokeModelWithBidirectionalStreamOutput,
|
||||||
)
|
)
|
||||||
from smithy_aws_core.credentials_resolvers.static import StaticCredentialsResolver
|
from smithy_aws_core.auth.sigv4 import SigV4AuthScheme
|
||||||
from smithy_aws_core.identity import AWSCredentialsIdentity
|
from smithy_aws_core.identity.static import StaticCredentialsResolver
|
||||||
from smithy_core.aio.eventstream import DuplexEventStream
|
from smithy_core.aio.eventstream import DuplexEventStream
|
||||||
except ModuleNotFoundError as e:
|
except ModuleNotFoundError as e:
|
||||||
logger.error(f"Exception: {e}")
|
logger.error(f"Exception: {e}")
|
||||||
@@ -453,7 +453,7 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
await self._finish_connecting_if_context_available()
|
await self._finish_connecting_if_context_available()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"{self} initialization error: {e}")
|
logger.error(f"{self} initialization error: {e}")
|
||||||
self._disconnect()
|
await self._disconnect()
|
||||||
|
|
||||||
async def _process_completed_function_calls(self, send_new_results: bool):
|
async def _process_completed_function_calls(self, send_new_results: bool):
|
||||||
# Check for set of completed function calls in the context
|
# Check for set of completed function calls in the context
|
||||||
@@ -582,15 +582,11 @@ class AWSNovaSonicLLMService(LLMService):
|
|||||||
config = Config(
|
config = Config(
|
||||||
endpoint_uri=f"https://bedrock-runtime.{self._region}.amazonaws.com",
|
endpoint_uri=f"https://bedrock-runtime.{self._region}.amazonaws.com",
|
||||||
region=self._region,
|
region=self._region,
|
||||||
aws_credentials_identity_resolver=StaticCredentialsResolver(
|
aws_access_key_id=self._access_key_id,
|
||||||
credentials=AWSCredentialsIdentity(
|
aws_secret_access_key=self._secret_access_key,
|
||||||
access_key_id=self._access_key_id,
|
aws_session_token=self._session_token,
|
||||||
secret_access_key=self._secret_access_key,
|
aws_credentials_identity_resolver=StaticCredentialsResolver(),
|
||||||
session_token=self._session_token,
|
auth_schemes={"aws.auth#sigv4": SigV4AuthScheme(service="bedrock")},
|
||||||
)
|
|
||||||
),
|
|
||||||
http_auth_scheme_resolver=HTTPAuthSchemeResolver(),
|
|
||||||
http_auth_schemes={"aws.auth#sigv4": SigV4AuthScheme()},
|
|
||||||
)
|
)
|
||||||
return BedrockRuntimeClient(config=config)
|
return BedrockRuntimeClient(config=config)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user