Class: Vellum::FulfilledExecutePromptEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/vellum_ai/types/fulfilled_execute_prompt_event.rb

Overview

resolved values from the model can be found.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state:, outputs:, execution_id:, meta: OMIT, additional_properties: nil) ⇒ Vellum::FulfilledExecutePromptEvent

Parameters:



33
34
35
36
37
38
39
40
41
42
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 33

def initialize(state:, outputs:, execution_id:, meta: OMIT, additional_properties: nil)
  @state = state
  @outputs = outputs
  @execution_id = execution_id
  @meta = meta if meta != OMIT
  @additional_properties = additional_properties
  @_field_set = { "state": state, "outputs": outputs, "execution_id": execution_id, "meta": meta }.reject do | _k, v |
  v == OMIT
end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



20
21
22
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 20

def additional_properties
  @additional_properties
end

#execution_idString (readonly)

Returns:

  • (String)


16
17
18
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 16

def execution_id
  @execution_id
end

#metaVellum::FulfilledPromptExecutionMeta (readonly)



18
19
20
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 18

def meta
  @meta
end

#outputsArray<Vellum::PromptOutput> (readonly)

Returns:



14
15
16
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 14

def outputs
  @outputs
end

#stateString (readonly)

Returns:

  • (String)


12
13
14
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 12

def state
  @state
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::FulfilledExecutePromptEvent

Parameters:

  • json_object (String)

Returns:



47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 47

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  state = parsed_json["state"]
  outputs = parsed_json["outputs"]&.map do | item |
  item = item.to_json
  Vellum::PromptOutput.from_json(json_object: item)
end
  execution_id = parsed_json["execution_id"]
  unless parsed_json["meta"].nil?
    meta = parsed_json["meta"].to_json
    meta = Vellum::FulfilledPromptExecutionMeta.from_json(json_object: meta)
  else
    meta = nil
  end
  new(
    state: state,
    outputs: outputs,
    execution_id: execution_id,
    meta: meta,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


82
83
84
85
86
87
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 82

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.")
  obj.outputs.is_a?(Array) != false || raise("Passed value for field obj.outputs 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.meta.nil? || Vellum::FulfilledPromptExecutionMeta.validate_raw(obj: obj.meta)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


73
74
75
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_event.rb', line 73

def to_json
  @_field_set&.to_json
end