File tree Expand file tree Collapse file tree
sentry_sdk/integrations/boto3/_services Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -512,6 +512,9 @@ def on_success_response(
512512
513513 set_on_span (SPANDATA .GEN_AI_USAGE_INPUT_TOKENS , input_tokens )
514514
515+ finish_reasons : "list[str]" = [response ["stopReason" ]]
516+ set_on_span (SPANDATA .GEN_AI_RESPONSE_FINISH_REASONS , finish_reasons )
517+
515518 client = sentry_sdk .get_client ()
516519 if "message" in response ["output" ] and (
517520 (
Original file line number Diff line number Diff line change @@ -476,6 +476,9 @@ def test_converse(
476476 assert span ["attributes" ][SPANDATA .GEN_AI_REQUEST_MAX_TOKENS ] == 1024
477477 assert span ["attributes" ][SPANDATA .GEN_AI_REQUEST_TEMPERATURE ] == 0.7
478478 assert span ["attributes" ][SPANDATA .GEN_AI_REQUEST_TOP_P ] == 0.9
479+ assert span ["attributes" ][SPANDATA .GEN_AI_RESPONSE_FINISH_REASONS ] == [
480+ "end_turn"
481+ ]
479482
480483 assert span ["attributes" ][SPANDATA .GEN_AI_USAGE_OUTPUT_TOKENS ] == 20
481484 assert span ["attributes" ][SPANDATA .GEN_AI_USAGE_TOTAL_TOKENS ] == 30
@@ -513,6 +516,7 @@ def test_converse(
513516 assert span ["data" ][SPANDATA .GEN_AI_REQUEST_MAX_TOKENS ] == 1024
514517 assert span ["data" ][SPANDATA .GEN_AI_REQUEST_TEMPERATURE ] == 0.7
515518 assert span ["data" ][SPANDATA .GEN_AI_REQUEST_TOP_P ] == 0.9
519+ assert span ["data" ][SPANDATA .GEN_AI_RESPONSE_FINISH_REASONS ] == ["end_turn" ]
516520
517521 assert span ["data" ][SPANDATA .GEN_AI_USAGE_OUTPUT_TOKENS ] == 20
518522 assert span ["data" ][SPANDATA .GEN_AI_USAGE_TOTAL_TOKENS ] == 30
You can’t perform that action at this time.
0 commit comments