class NewRelic::Agent::Llm::Embedding
Constants
- ATTRIBUTES
- ATTRIBUTE_NAME_EXCEPTIONS
- ERROR_EMBEDDING_ID
- EVENT_NAME
Public Instance Methods
Source
# File lib/new_relic/agent/llm/embedding.rb, line 24 def attribute_name_exceptions # TODO: OLD RUBIES < 2.6 # Hash#merge accepts multiple arguments in 2.6 # Remove condition once support for Ruby <2.6 is dropped if RUBY_VERSION >= '2.6.0' LlmEvent::ATTRIBUTE_NAME_EXCEPTIONS.merge(ResponseHeaders::ATTRIBUTE_NAME_EXCEPTIONS, ATTRIBUTE_NAME_EXCEPTIONS) else LlmEvent::ATTRIBUTE_NAME_EXCEPTIONS.merge(ResponseHeaders::ATTRIBUTE_NAME_EXCEPTIONS).merge(ATTRIBUTE_NAME_EXCEPTIONS) end end
Source
# File lib/new_relic/agent/llm/embedding.rb, line 20 def attributes LlmEvent::ATTRIBUTES + ResponseHeaders::ATTRIBUTES + ATTRIBUTES end
Source
# File lib/new_relic/agent/llm/embedding.rb, line 39 def error_attributes(exception) attrs = {} attrs[ERROR_EMBEDDING_ID] = id error_attributes_from_response(exception, attrs) end
Source
# File lib/new_relic/agent/llm/embedding.rb, line 35 def event_name EVENT_NAME end
Private Instance Methods
Source
# File lib/new_relic/agent/llm/embedding.rb, line 48 def error_attributes_from_response(exception, attrs) return attrs unless exception.respond_to?(:response) attrs[ERROR_ATTRIBUTE_STATUS_CODE] = exception.response.dig(:status) attrs[ERROR_ATTRIBUTE_CODE] = exception.response.dig(:body, ERROR_STRING, CODE_STRING) attrs[ERROR_ATTRIBUTE_PARAM] = exception.response.dig(:body, ERROR_STRING, PARAM_STRING) attrs end