Class: Vellum::FulfilledExecutePromptResponse

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

Overview

generated by the prompt.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(meta: OMIT, raw: OMIT, execution_id:, state:, outputs:, chat_message_metadata: OMIT, additional_properties: nil) ⇒ Vellum::FulfilledExecutePromptResponse

Parameters:

  • execution_id (String) —

    The ID of the execution.

  • state (String)
  • outputs (Array<Vellum::PromptOutput>)
  • chat_message_metadata (Hash{String => Object}) (defaults to: OMIT)
  • additional_properties (OpenStruct) (defaults to: nil) —

    Additional properties unmapped to the current class definition



41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 41

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

Instance Attribute Details

#additional_properties ⇒ OpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct) —

    Additional properties unmapped to the current class definition



25
26
27
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 25

def additional_properties
  @additional_properties
end

#chat_message_metadata ⇒ Hash{String => Object} (readonly)

Returns:

  • (Hash{String => Object})


23
24
25
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 23

def 
  @chat_message_metadata
end

#execution_id ⇒ String (readonly)

Returns The ID of the execution.

Returns:

  • (String) —

    The ID of the execution.



17
18
19
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 17

def execution_id
  @execution_id
end

#meta ⇒ Vellum::PromptExecutionMeta (readonly)



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

def meta
  @meta
end

#outputs ⇒ Array<Vellum::PromptOutput> (readonly)

Returns:



21
22
23
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 21

def outputs
  @outputs
end

#raw ⇒ Object (readonly)

expand_raw.



15
16
17
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 15

def raw
  @raw
end

#state ⇒ String (readonly)

Returns:

  • (String)


19
20
21
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 19

def state
  @state
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::FulfilledExecutePromptResponse

Parameters:

  • json_object (String)

Returns:



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
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 57

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


96
97
98
99
100
101
102
103
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 96

def self.validate_raw(obj:)
  obj.meta.nil? || Vellum::PromptExecutionMeta.validate_raw(obj: obj.meta)
  obj.raw&.is_a?(Hash) != false || raise("Passed value for field obj.raw 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.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.&.is_a?(Hash) != false || raise("Passed value for field obj.chat_message_metadata is not the expected type, validation failed.")
end

Instance Method Details

#to_json ⇒ String

Returns:

  • (String)


87
88
89
# File 'lib/vellum_ai/types/fulfilled_execute_prompt_response.rb', line 87

def to_json
  @_field_set&.to_json
end