Class: OpenApiOpenAIClient::UsageEmbeddingsResult
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- OpenApiOpenAIClient::UsageEmbeddingsResult
- Defined in:
- lib/openapi_openai/models/usage_embeddings_result.rb
Overview
The aggregated embeddings usage details of the specific time bucket.
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#api_key_id ⇒ Object
When ‘group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
-
#input_tokens ⇒ Object
The aggregated number of input tokens used.
-
#model ⇒ Object
When ‘group_by=model`, this field provides the model name of the grouped usage result.
-
#num_model_requests ⇒ Object
The count of requests made to the model.
-
#object ⇒ Object
Returns the value of attribute object.
-
#project_id ⇒ Object
When ‘group_by=project_id`, this field provides the project ID of the grouped usage result.
-
#user_id ⇒ Object
When ‘group_by=user_id`, this field provides the user ID of the grouped usage result.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ UsageEmbeddingsResult
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ UsageEmbeddingsResult
Initializes the object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 109 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `OpenApiOpenAIClient::UsageEmbeddingsResult` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `OpenApiOpenAIClient::UsageEmbeddingsResult`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'object') self.object = attributes[:'object'] else self.object = nil end if attributes.key?(:'input_tokens') self.input_tokens = attributes[:'input_tokens'] else self.input_tokens = nil end if attributes.key?(:'num_model_requests') self.num_model_requests = attributes[:'num_model_requests'] else self.num_model_requests = nil end if attributes.key?(:'project_id') self.project_id = attributes[:'project_id'] end if attributes.key?(:'user_id') self.user_id = attributes[:'user_id'] end if attributes.key?(:'api_key_id') self.api_key_id = attributes[:'api_key_id'] end if attributes.key?(:'model') self.model = attributes[:'model'] end end |
Instance Attribute Details
#api_key_id ⇒ Object
When ‘group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
34 35 36 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 34 def api_key_id @api_key_id end |
#input_tokens ⇒ Object
The aggregated number of input tokens used.
22 23 24 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 22 def input_tokens @input_tokens end |
#model ⇒ Object
When ‘group_by=model`, this field provides the model name of the grouped usage result.
37 38 39 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 37 def model @model end |
#num_model_requests ⇒ Object
The count of requests made to the model.
25 26 27 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 25 def num_model_requests @num_model_requests end |
#object ⇒ Object
Returns the value of attribute object.
19 20 21 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 19 def object @object end |
#project_id ⇒ Object
When ‘group_by=project_id`, this field provides the project ID of the grouped usage result.
28 29 30 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 28 def project_id @project_id end |
#user_id ⇒ Object
When ‘group_by=user_id`, this field provides the user ID of the grouped usage result.
31 32 33 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 31 def user_id @user_id end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
75 76 77 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 75 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
80 81 82 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 80 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 62 def self.attribute_map { :'object' => :'object', :'input_tokens' => :'input_tokens', :'num_model_requests' => :'num_model_requests', :'project_id' => :'project_id', :'user_id' => :'user_id', :'api_key_id' => :'api_key_id', :'model' => :'model' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 249 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
98 99 100 101 102 103 104 105 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 98 def self.openapi_nullable Set.new([ :'project_id', :'user_id', :'api_key_id', :'model' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 85 def self.openapi_types { :'object' => :'String', :'input_tokens' => :'Integer', :'num_model_requests' => :'Integer', :'project_id' => :'String', :'user_id' => :'String', :'api_key_id' => :'String', :'model' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
222 223 224 225 226 227 228 229 230 231 232 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 222 def ==(o) return true if self.equal?(o) self.class == o.class && object == o.object && input_tokens == o.input_tokens && num_model_requests == o.num_model_requests && project_id == o.project_id && user_id == o.user_id && api_key_id == o.api_key_id && model == o.model end |
#eql?(o) ⇒ Boolean
236 237 238 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 236 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
242 243 244 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 242 def hash [object, input_tokens, num_model_requests, project_id, user_id, api_key_id, model].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 160 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @object.nil? invalid_properties.push('invalid value for "object", object cannot be nil.') end if @input_tokens.nil? invalid_properties.push('invalid value for "input_tokens", input_tokens cannot be nil.') end if @num_model_requests.nil? invalid_properties.push('invalid value for "num_model_requests", num_model_requests cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
271 272 273 274 275 276 277 278 279 280 281 282 283 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 271 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
180 181 182 183 184 185 186 187 188 |
# File 'lib/openapi_openai/models/usage_embeddings_result.rb', line 180 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @object.nil? object_validator = EnumAttributeValidator.new('String', ["organization.usage.embeddings.result"]) return false unless object_validator.valid?(@object) return false if @input_tokens.nil? return false if @num_model_requests.nil? true end |