newrelic-python-agent icon indicating copy to clipboard operation
newrelic-python-agent copied to clipboard

Support for OpenAI's .with_raw_response.

Open lrafeei opened this issue 1 year ago • 2 comments

This PR adds support for .with_raw_response. prepending to HTTP method calls in OpenAI.

Currently, the New Relic instrumentation will instrument this, but during the collection of custom AI event attributes, this modified response type (LegacyAPIResponse) will result in a crash.

This is part 1 of two PRs. The second part will cover the streaming version of this functionality, .with_streaming_response.

lrafeei avatar May 10 '24 20:05 lrafeei

🦙 MegaLinter status: ❌ ERROR

Descriptor Linter Files Fixed Errors Elapsed time
✅ PYTHON bandit 1 0 5.71s
✅ PYTHON black 7 1 0 2.4s
✅ PYTHON flake8 7 0 0.84s
✅ PYTHON isort 7 1 0 0.23s
❌ PYTHON pylint 7 31 6.0s

See detailed report in MegaLinter reports Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

github-actions[bot] avatar May 10 '24 20:05 github-actions[bot]

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Project coverage is 81.66%. Comparing base (2ab12c5) to head (77bd146).

Files Patch % Lines
newrelic/hooks/mlmodel_openai.py 81.81% 0 Missing and 2 partials :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1138      +/-   ##
==========================================
- Coverage   81.67%   81.66%   -0.02%     
==========================================
  Files         193      193              
  Lines       21334    21341       +7     
  Branches     3717     3721       +4     
==========================================
+ Hits        17425    17428       +3     
+ Misses       2826     2825       -1     
- Partials     1083     1088       +5     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov-commenter avatar May 10 '24 20:05 codecov-commenter