Skip to content

Commit 6c342fe

Browse files
committed
Add clause to avoid reporting empty content in openai. (#1517)
1 parent 92d2a74 commit 6c342fe

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

newrelic/hooks/mlmodel_openai.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,8 @@ def _record_completion_success(transaction, linking_metadata, completion_id, kwa
489489
choices[0].get("message") or {"content": choices[0].get("text"), "role": "assistant"}
490490
]
491491
finish_reason = choices[0].get("finish_reason")
492+
if "tool_calls" in output_message_list[0] and not output_message_list[0].get("content"):
493+
output_message_list = []
492494
else:
493495
response_model = kwargs.get("response.model")
494496
response_id = kwargs.get("id")

0 commit comments

Comments
 (0)