Class: Vellum::GenerateStreamResultData
- Inherits:
-
Object
- Object
- Vellum::GenerateStreamResultData
- Defined in:
- lib/vellum_ai/types/generate_stream_result_data.rb
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #completion ⇒ Vellum::EnrichedNormalizedCompletion readonly
- #completion_index ⇒ Integer readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(completion_index:, completion:, additional_properties: nil) ⇒ Vellum::GenerateStreamResultData constructor
- #to_json ⇒ String
Constructor Details
#initialize(completion_index:, completion:, additional_properties: nil) ⇒ Vellum::GenerateStreamResultData
24 25 26 27 28 29 |
# File 'lib/vellum_ai/types/generate_stream_result_data.rb', line 24 def initialize(completion_index:, completion:, additional_properties: nil) @completion_index = completion_index @completion = completion @additional_properties = additional_properties @_field_set = { "completion_index": completion_index, "completion": completion } end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
13 14 15 |
# File 'lib/vellum_ai/types/generate_stream_result_data.rb', line 13 def additional_properties @additional_properties end |
#completion ⇒ Vellum::EnrichedNormalizedCompletion (readonly)
11 12 13 |
# File 'lib/vellum_ai/types/generate_stream_result_data.rb', line 11 def completion @completion end |
#completion_index ⇒ Integer (readonly)
9 10 11 |
# File 'lib/vellum_ai/types/generate_stream_result_data.rb', line 9 def completion_index @completion_index end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::GenerateStreamResultData
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/vellum_ai/types/generate_stream_result_data.rb', line 34 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) completion_index = parsed_json["completion_index"] unless parsed_json["completion"].nil? completion = parsed_json["completion"].to_json completion = Vellum::EnrichedNormalizedCompletion.from_json(json_object: completion) else completion = nil end new( completion_index: completion_index, completion: completion, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
62 63 64 65 |
# File 'lib/vellum_ai/types/generate_stream_result_data.rb', line 62 def self.validate_raw(obj:) obj.completion_index.is_a?(Integer) != false || raise("Passed value for field obj.completion_index is not the expected type, validation failed.") Vellum::EnrichedNormalizedCompletion.validate_raw(obj: obj.completion) end |
Instance Method Details
#to_json ⇒ String
53 54 55 |
# File 'lib/vellum_ai/types/generate_stream_result_data.rb', line 53 def to_json @_field_set&.to_json end |