feat: instrument the openai responses API#1493
feat: instrument the openai responses API#1493satyadevai wants to merge 3 commits intoArize-ai:mainfrom
Conversation
There was a problem hiding this comment.
Copilot reviewed 14 out of 16 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- python/instrumentation/openinference-instrumentation-openai/examples/requirements.txt: Language not supported
- python/instrumentation/openinference-instrumentation-openai/test-requirements.txt: Language not supported
Comments suppressed due to low confidence (1)
python/instrumentation/openinference-instrumentation-openai/src/openinference/instrumentation/openai/_response_accumulator.py:64
- [nitpick] Consider renaming 'chat_completion_type' to 'responses_type' for clarity, as it represents a Response type in the context of responses.
chat_completion_type: Type["Response"],
There was a problem hiding this comment.
Copilot reviewed 14 out of 16 changed files in this pull request and generated no comments.
Files not reviewed (2)
- python/instrumentation/openinference-instrumentation-openai/examples/requirements.txt: Language not supported
- python/instrumentation/openinference-instrumentation-openai/test-requirements.txt: Language not supported
Comments suppressed due to low confidence (3)
python/instrumentation/openinference-instrumentation-openai/tests/openinference/instrumentation/openai/test_instrumentor.py:541
- The delta field value '{' may result in malformed JSON parsing; please verify if this is intentional or adjust the mock data to represent a properly concatenated delta message.
b'event: response.function_call_arguments.delta\ndata: {"type":"response.function_call_arguments.delta","item_id":"call_caea3f3962f34170b06d77f8f69da8e1","output_index":0,"delta":"{"}\n\n'
python/instrumentation/openinference-instrumentation-openai/src/openinference/instrumentation/openai/_utils.py:40
- [nitpick] Consider providing more descriptive documentation or renaming the 'cast_to' parameter to better clarify its purpose in transforming the input object.
def _io_value_and_type(obj: Any, cast_to: Optional[type] = None) -> _ValueAndType:
python/instrumentation/openinference-instrumentation-openai/src/openinference/instrumentation/openai/_response_accumulator.py:75
- Consider using isinstance() for type checks instead of comparing the name string to improve type safety and handle subclassing properly.
if type(chunk).__name__ == "ResponseCompletedEvent":
There was a problem hiding this comment.
Copilot reviewed 16 out of 18 changed files in this pull request and generated no comments.
Files not reviewed (2)
- python/instrumentation/openinference-instrumentation-openai/examples/requirements.txt: Language not supported
- python/instrumentation/openinference-instrumentation-openai/test-requirements.txt: Language not supported
Comments suppressed due to low confidence (2)
python/instrumentation/openinference-instrumentation-openai/tests/openinference/instrumentation/openai/test_instrumentor.py:541
- The delta JSON fragment appears incomplete, with the delta value being just an opening brace. Please verify that the split fragments (lines 541–542) will be concatenated correctly in the stream so that the overall JSON is valid.
b'event: response.function_call_arguments.delta\ndata: {"type":"response.function_call_arguments.delta","item_id":"call_caea3f3962f34170b06d77f8f69da8e1","output_index":0,"delta":"{"}\n\n', # noqa: E501
python/instrumentation/openinference-instrumentation-openai/src/openinference/instrumentation/openai/_response_accumulator.py:75
- Instead of comparing the type name as a string, consider using isinstance() with the actual ResponseCompletedEvent type (if available) to improve robustness and maintainability.
if type(chunk).__name__ == "ResponseCompletedEvent":
|
transferred to #1521 |
New Changes:
Resolves #1351