OpenAI Responses API Instrumentation - #1813
Conversation
✅MegaLinter analysis: Success
See detailed reports in MegaLinter artifacts
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1813 +/- ##
==========================================
- Coverage 82.13% 82.09% -0.04%
==========================================
Files 220 220
Lines 27344 27447 +103
Branches 4330 4353 +23
==========================================
+ Hits 22458 22532 +74
- Misses 3381 3391 +10
- Partials 1505 1524 +19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
5f17359 to
12dfc71
Compare
| if isinstance(item, dict) and item.get("role") is not None: | ||
| content = item.get("content") | ||
| # Content is a string, or a list of typed parts each carrying `text`. | ||
| if isinstance(content, (list, tuple)): |
There was a problem hiding this comment.
For chat completions, we deliberately suppress content-less tool call messages (on line 595 by checking "tool_call" in finish_reason). Since we don't want to report every tool call as an LlmChatCompletionMessage with content: "", do we want to mirror that suppression behavior here if possible?
There was a problem hiding this comment.
Or is that why "role" is being checked for explicitly?
| ) | ||
| stream_proxy._nr_openai_attrs["content"] = stream_proxy._nr_openai_attrs.get("content", "") + delta | ||
| stream_proxy._nr_openai_attrs["role"] = stream_proxy._nr_openai_attrs.get("role") or "assistant" | ||
| elif event_type in ("response.completed", "response.incomplete", "response.failed"): |
There was a problem hiding this comment.
Are we capturing errors surfaced via response.failed somewhere? From my scan of the codebase, it seems like APIErrors are raised when the raw payload has a top-level error key. response.failed events nest errors inside response.error and the stream just ends normally afterwards. I just want to make sure we are capturing errors in this case also.

Overview
openai.responsesAPIs.chat_completionstests.