Class: Vellum::StreamingPromptExecutionMeta
- Inherits:
-
Object
- Object
- Vellum::StreamingPromptExecutionMeta
- Defined in:
- lib/vellum_ai/types/streaming_prompt_execution_meta.rb
Overview
The subset of the metadata tracked by Vellum during prompt execution that the request opted into with ‘expand_meta`.
Instance Attribute Summary collapse
-
#additional_properties ⇒ Object
readonly
Returns the value of attribute additional_properties.
-
#latency ⇒ Object
readonly
Returns the value of attribute latency.
Class Method Summary collapse
-
.from_json(json_object:) ⇒ StreamingPromptExecutionMeta
Deserialize a JSON object to an instance of StreamingPromptExecutionMeta.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(latency: nil, additional_properties: nil) ⇒ StreamingPromptExecutionMeta constructor
-
#to_json(*_args) ⇒ JSON
Serialize an instance of StreamingPromptExecutionMeta to a JSON object.
Constructor Details
#initialize(latency: nil, additional_properties: nil) ⇒ StreamingPromptExecutionMeta
13 14 15 16 17 18 |
# File 'lib/vellum_ai/types/streaming_prompt_execution_meta.rb', line 13 def initialize(latency: nil, additional_properties: nil) # @type [Integer] @latency = latency # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end |
Instance Attribute Details
#additional_properties ⇒ Object (readonly)
Returns the value of attribute additional_properties.
8 9 10 |
# File 'lib/vellum_ai/types/streaming_prompt_execution_meta.rb', line 8 def additional_properties @additional_properties end |
#latency ⇒ Object (readonly)
Returns the value of attribute latency.
8 9 10 |
# File 'lib/vellum_ai/types/streaming_prompt_execution_meta.rb', line 8 def latency @latency end |
Class Method Details
.from_json(json_object:) ⇒ StreamingPromptExecutionMeta
Deserialize a JSON object to an instance of StreamingPromptExecutionMeta
24 25 26 27 28 29 |
# File 'lib/vellum_ai/types/streaming_prompt_execution_meta.rb', line 24 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) JSON.parse(json_object) latency = struct.latency new(latency: latency, additional_properties: struct) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
42 43 44 |
# File 'lib/vellum_ai/types/streaming_prompt_execution_meta.rb', line 42 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.") end |
Instance Method Details
#to_json(*_args) ⇒ JSON
Serialize an instance of StreamingPromptExecutionMeta to a JSON object
34 35 36 |
# File 'lib/vellum_ai/types/streaming_prompt_execution_meta.rb', line 34 def to_json(*_args) { "latency": @latency }.to_json end |