You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add instrumentation for the OpenAI responses API to track API calls, similar to how other OpenAI API endpoints are currently instrumented. This will allow AgentOps to monitor and analyze responses API usage.
Approach
Create a new file responses_wrappers.py in the third_party/opentelemetry/instrumentation/openai/shared/ directory with wrapper functions for the responses API.
Add the wrapper functions to the OpenAIV1Instrumentor._instrument method in third_party/opentelemetry/instrumentation/openai/v1/__init__.py.
Add tests for the responses API instrumentation in tests/integration/test_openai_instrumentation.py.
Implementation Details
1. Create responses_wrappers.py
Create a new file with wrapper functions for both synchronous and asynchronous API calls:
Instrument OpenAI responses API
Description
Add instrumentation for the OpenAI responses API to track API calls, similar to how other OpenAI API endpoints are currently instrumented. This will allow AgentOps to monitor and analyze responses API usage.
Approach
responses_wrappers.py
in thethird_party/opentelemetry/instrumentation/openai/shared/
directory with wrapper functions for the responses API.OpenAIV1Instrumentor._instrument
method inthird_party/opentelemetry/instrumentation/openai/v1/__init__.py
.tests/integration/test_openai_instrumentation.py
.Implementation Details
1. Create responses_wrappers.py
Create a new file with wrapper functions for both synchronous and asynchronous API calls:
2. Update OpenAIV1Instrumentor._instrument method
Add the following code to the
_instrument
method inthird_party/opentelemetry/instrumentation/openai/v1/__init__.py
:3. Add tests for responses API instrumentation
Add the following test to
tests/integration/test_openai_instrumentation.py
:Files to be modified:
third_party/opentelemetry/instrumentation/openai/shared/responses_wrappers.py
third_party/opentelemetry/instrumentation/openai/v1/__init__.py
tests/integration/test_openai_instrumentation.py
Verification Strategy
The text was updated successfully, but these errors were encountered: