Module: OpenAI::Prepend

Includes:
NewRelic::Agent::Instrumentation::OpenAI
Defined in:
lib/new_relic/agent/instrumentation/ruby_openai/prepend.rb

Constant Summary

Constants included from NewRelic::Agent::Instrumentation::OpenAI

NewRelic::Agent::Instrumentation::OpenAI::CHAT_COMPLETIONS_PATH, NewRelic::Agent::Instrumentation::OpenAI::CHAT_COMPLETIONS_SEGMENT_NAME, NewRelic::Agent::Instrumentation::OpenAI::EMBEDDINGS_PATH, NewRelic::Agent::Instrumentation::OpenAI::EMBEDDINGS_SEGMENT_NAME, NewRelic::Agent::Instrumentation::OpenAI::INSTRUMENTATION_NAME, NewRelic::Agent::Instrumentation::OpenAI::VENDOR

Instance Method Summary collapse

Methods included from NewRelic::Agent::Instrumentation::OpenAI

#json_post_with_new_relic

Instance Method Details

#json_post(**kwargs) ⇒ Object

In versions 4.0.0+ json_post is an instance method defined in the OpenAI::HTTP module, included by the OpenAI::Client class.

In versions below 4.0.0 json_post is a class method on OpenAI::Client.

Dependency detection will apply the instrumentation to the correct scope, so we don’t need to change the code here.



16
17
18
# File 'lib/new_relic/agent/instrumentation/ruby_openai/prepend.rb', line 16

def json_post(**kwargs)
  json_post_with_new_relic(**kwargs) { super }
end