Class: Vellum::StreamingAdHocExecutePromptEvent
- Inherits:
-
Object
- Object
- Vellum::StreamingAdHocExecutePromptEvent
- Defined in:
- lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb
Overview
The data returned for each delta during the prompt execution stream.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #execution_id ⇒ String readonly
- #meta ⇒ Vellum::AdHocStreamingPromptExecutionMeta readonly
- #output ⇒ Vellum::PromptOutput readonly
- #output_index ⇒ Integer readonly
-
#raw ⇒ Object
readonly
‘expand_raw`.
- #state ⇒ String readonly
Class Method Summary collapse
Instance Method Summary collapse
- #initialize(state:, output:, output_index:, execution_id:, meta: OMIT, raw: OMIT, additional_properties: nil) ⇒ Vellum::StreamingAdHocExecutePromptEvent constructor
- #to_json ⇒ String
Constructor Details
#initialize(state:, output:, output_index:, execution_id:, meta: OMIT, raw: OMIT, additional_properties: nil) ⇒ Vellum::StreamingAdHocExecutePromptEvent
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 40 def initialize(state:, output:, output_index:, execution_id:, meta: OMIT, raw: OMIT, additional_properties: nil) @state = state @output = output @output_index = output_index @execution_id = execution_id @meta = if != OMIT @raw = raw if raw != OMIT @additional_properties = additional_properties @_field_set = { "state": state, "output": output, "output_index": output_index, "execution_id": execution_id, "meta": , "raw": raw }.reject do | _k, v | v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 24 def additional_properties @additional_properties end |
#execution_id ⇒ String (readonly)
17 18 19 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 17 def execution_id @execution_id end |
#meta ⇒ Vellum::AdHocStreamingPromptExecutionMeta (readonly)
19 20 21 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 19 def @meta end |
#output ⇒ Vellum::PromptOutput (readonly)
13 14 15 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 13 def output @output end |
#output_index ⇒ Integer (readonly)
15 16 17 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 15 def output_index @output_index end |
#raw ⇒ Object (readonly)
‘expand_raw`.
22 23 24 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 22 def raw @raw end |
#state ⇒ String (readonly)
11 12 13 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 11 def state @state end |
Class Method Details
.from_json(json_object:) ⇒ Vellum::StreamingAdHocExecutePromptEvent
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 56 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) state = parsed_json["state"] unless parsed_json["output"].nil? output = parsed_json["output"].to_json output = Vellum::PromptOutput.from_json(json_object: output) else output = nil end output_index = parsed_json["output_index"] execution_id = parsed_json["execution_id"] unless parsed_json["meta"].nil? = parsed_json["meta"].to_json = Vellum::AdHocStreamingPromptExecutionMeta.from_json(json_object: ) else = nil end raw = parsed_json["raw"] new( state: state, output: output, output_index: output_index, execution_id: execution_id, meta: , raw: raw, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
97 98 99 100 101 102 103 104 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 97 def self.validate_raw(obj:) obj.state.is_a?(String) != false || raise("Passed value for field obj.state is not the expected type, validation failed.") Vellum::PromptOutput.validate_raw(obj: obj.output) obj.output_index.is_a?(Integer) != false || raise("Passed value for field obj.output_index is not the expected type, validation failed.") obj.execution_id.is_a?(String) != false || raise("Passed value for field obj.execution_id is not the expected type, validation failed.") obj..nil? || Vellum::AdHocStreamingPromptExecutionMeta.validate_raw(obj: obj.) obj.raw&.is_a?(Hash) != false || raise("Passed value for field obj.raw is not the expected type, validation failed.") end |
Instance Method Details
#to_json ⇒ String
88 89 90 |
# File 'lib/vellum_ai/types/streaming_ad_hoc_execute_prompt_event.rb', line 88 def to_json @_field_set&.to_json end |