Skip to content

Commit

Permalink
Update capitalization for OpenAI in segment names
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle committed Feb 13, 2024
1 parent 22968ea commit 90b7ce9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ module OpenAI
INSTRUMENTATION_NAME = NewRelic::Agent.base_name(name)
EMBEDDINGS_PATH = '/embeddings'
CHAT_COMPLETIONS_PATH = '/chat/completions'
EMBEDDINGS_SEGMENT_NAME = "Llm/embedding/#{VENDOR}/embeddings"
CHAT_COMPLETIONS_SEGMENT_NAME = "Llm/completion/#{VENDOR}/chat"
EMBEDDINGS_SEGMENT_NAME = "Llm/embedding/OpenAI/embeddings"
CHAT_COMPLETIONS_SEGMENT_NAME = "Llm/completion/OpenAI/chat"

def json_post_with_new_relic(path:, parameters:)
return yield unless path == EMBEDDINGS_PATH || path == CHAT_COMPLETIONS_PATH
Expand Down
4 changes: 2 additions & 2 deletions test/multiverse/suites/ruby_openai/openai_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,11 @@ def simulate_error(&blk)
end

def embedding_segment(txn)
txn.segments.find { |s| s.name == 'Llm/embedding/openAI/embeddings' }
txn.segments.find { |s| s.name == 'Llm/embedding/OpenAI/embeddings' }
end

def chat_completion_segment(txn)
txn.segments.find { |s| s.name == 'Llm/completion/openAI/chat' }
txn.segments.find { |s| s.name == 'Llm/completion/OpenAI/chat' }
end

def raise_segment_error(&blk)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def test_segment_error_captured_if_raised
client.chat(parameters: chat_params)
end

assert_segment_noticed_error(txn, /Llm.*openAI\/.*/, RuntimeError.name, /deception/i)
assert_segment_noticed_error(txn, /Llm.*OpenAI\/.*/, RuntimeError.name, /deception/i)
end

def test_segment_summary_event_sets_error_true_if_raised
Expand Down

0 comments on commit 90b7ce9

Please sign in to comment.