OpenAI Responses API Instrumentation - #1813
Conversation
✅MegaLinter analysis: Success
Notices📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining See detailed reports in MegaLinter artifacts
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1813 +/- ##
==========================================
+ Coverage 82.12% 82.14% +0.01%
==========================================
Files 218 218
Lines 27085 27188 +103
Branches 4286 4309 +23
==========================================
+ Hits 22244 22333 +89
- Misses 3353 3355 +2
- Partials 1488 1500 +12 ☔ 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.