From 882c2197dcc1071e52f72bb1b697dea723492596 Mon Sep 17 00:00:00 2001 From: Uma Annamalai Date: Mon, 22 Sep 2025 19:31:35 -0700 Subject: [PATCH] Add clause to avoid reporting empty content in openai. --- newrelic/hooks/mlmodel_openai.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/newrelic/hooks/mlmodel_openai.py b/newrelic/hooks/mlmodel_openai.py index 2ebd3864d..c3f7960b6 100644 --- a/newrelic/hooks/mlmodel_openai.py +++ b/newrelic/hooks/mlmodel_openai.py @@ -489,6 +489,8 @@ def _record_completion_success(transaction, linking_metadata, completion_id, kwa choices[0].get("message") or {"content": choices[0].get("text"), "role": "assistant"} ] finish_reason = choices[0].get("finish_reason") + if "tool_calls" in output_message_list[0] and not output_message_list[0].get("content"): + output_message_list = [] else: response_model = kwargs.get("response.model") response_id = kwargs.get("id")