Skip to content

Commit f4e2019

Browse files
make mypy happy
1 parent a1f5b5e commit f4e2019

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎sentry_sdk/integrations/boto3/_services/bedrock.py‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
if TYPE_CHECKING:
26-
from typing import Any, Iterator, Optional, Union
26+
from typing import Any, Iterator, Mapping, Optional, Union
2727

2828
from mypy_boto3_bedrock_runtime.type_defs import (
2929
ConverseResponseTypeDef,
@@ -171,7 +171,7 @@ def _transform_system_instructions(
171171

172172

173173
def _transform_messages(
174-
input_messages: "Union[list[dict[str, Any]], tuple[dict[str, Any], ...]]",
174+
input_messages: "Union[list[Mapping[str, Any]], tuple[Mapping[str, Any], ...]]",
175175
) -> "list[InputMessage]":
176176
"""
177177
Unlike other providers, AWS declares that input and output messages use the same message type.
@@ -512,6 +512,10 @@ def on_success_response(
512512

513513
set_on_span(SPANDATA.GEN_AI_USAGE_INPUT_TOKENS, input_tokens)
514514

515+
set_on_span(
516+
SPANDATA.GEN_AI_RESPONSE_FINISH_REASONS, [response["stopReason"]]
517+
)
518+
515519
client = sentry_sdk.get_client()
516520
if "message" in response["output"] and (
517521
(

0 commit comments

Comments
 (0)