Class: Vellum::RejectedPromptExecutionMeta
- Inherits:
-
Object
- Object
- Vellum::RejectedPromptExecutionMeta
- Defined in:
- lib/vellum_ai/types/rejected_prompt_execution_meta.rb
Overview
request opted into with ‘expand_meta`.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #finish_reason ⇒ Vellum::FinishReasonEnum readonly
- #latency ⇒ Integer readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(latency: OMIT, finish_reason: OMIT, additional_properties: nil) ⇒ Vellum::RejectedPromptExecutionMeta constructor
- #to_json ⇒ String
Constructor Details
#initialize(latency: OMIT, finish_reason: OMIT, additional_properties: nil) ⇒ Vellum::RejectedPromptExecutionMeta
26 27 28 29 30 31 32 33 |
# File 'lib/vellum_ai/types/rejected_prompt_execution_meta.rb', line 26 def initialize(latency: OMIT, finish_reason: OMIT, additional_properties: nil) @latency = latency if latency != OMIT @finish_reason = finish_reason if finish_reason != OMIT @additional_properties = additional_properties @_field_set = { "latency": latency, "finish_reason": finish_reason }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
15 16 17 |
# File 'lib/vellum_ai/types/rejected_prompt_execution_meta.rb', line 15 def additional_properties @additional_properties end |
#finish_reason ⇒ Vellum::FinishReasonEnum (readonly)
13 14 15 |
# File 'lib/vellum_ai/types/rejected_prompt_execution_meta.rb', line 13 def finish_reason @finish_reason end |
#latency ⇒ Integer (readonly)
11 12 13 |
# File 'lib/vellum_ai/types/rejected_prompt_execution_meta.rb', line 11 def latency @latency end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::RejectedPromptExecutionMeta
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/vellum_ai/types/rejected_prompt_execution_meta.rb', line 38 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) latency = parsed_json["latency"] finish_reason = parsed_json["finish_reason"] new( latency: latency, finish_reason: finish_reason, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
61 62 63 64 |
# File 'lib/vellum_ai/types/rejected_prompt_execution_meta.rb', line 61 def self.validate_raw(obj:) obj.latency&.is_a?(Integer) != false || raise("Passed value for field obj.latency is not the expected type, validation failed.") obj.finish_reason&.is_a?(Vellum::FinishReasonEnum) != false || raise("Passed value for field obj.finish_reason is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
52 53 54 |
# File 'lib/vellum_ai/types/rejected_prompt_execution_meta.rb', line 52 def to_json @_field_set&.to_json end |