From 69d2818a574b90038387af17eddcb877ac112cad Mon Sep 17 00:00:00 2001 From: hmstepanek Date: Thu, 16 May 2024 21:12:16 +0000 Subject: [PATCH] [Mega-Linter] Apply linters fixes --- newrelic/hooks/external_botocore.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/newrelic/hooks/external_botocore.py b/newrelic/hooks/external_botocore.py index ad13a2809a..345809945e 100644 --- a/newrelic/hooks/external_botocore.py +++ b/newrelic/hooks/external_botocore.py @@ -120,9 +120,11 @@ def create_chat_completion_message_event( "request_id": request_id, "span_id": span_id, "trace_id": trace_id, - "token_count": settings.ai_monitoring.llm_token_count_callback(request_model, content) - if settings.ai_monitoring.llm_token_count_callback - else None, + "token_count": ( + settings.ai_monitoring.llm_token_count_callback(request_model, content) + if settings.ai_monitoring.llm_token_count_callback + else None + ), "role": message.get("role"), "completion_id": chat_completion_id, "sequence": index, @@ -156,9 +158,11 @@ def create_chat_completion_message_event( "request_id": request_id, "span_id": span_id, "trace_id": trace_id, - "token_count": settings.ai_monitoring.llm_token_count_callback(request_model, content) - if settings.ai_monitoring.llm_token_count_callback - else None, + "token_count": ( + settings.ai_monitoring.llm_token_count_callback(request_model, content) + if settings.ai_monitoring.llm_token_count_callback + else None + ), "role": message.get("role"), "completion_id": chat_completion_id, "sequence": index, @@ -736,9 +740,11 @@ def handle_embedding_event(transaction, bedrock_attrs): "id": embedding_id, "span_id": span_id, "trace_id": trace_id, - "token_count": settings.ai_monitoring.llm_token_count_callback(model, input) - if settings.ai_monitoring.llm_token_count_callback - else None, + "token_count": ( + settings.ai_monitoring.llm_token_count_callback(model, input) + if settings.ai_monitoring.llm_token_count_callback + else None + ), "request_id": request_id, "duration": bedrock_attrs.get("duration", None), "request.model": model,