Class: Vellum::RejectedExecutePromptResponse

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

Overview

The unsuccessful response from the model containing an error of what went wrong.

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:, error:, additional_properties: nil) ⇒ Vellum::RejectedExecutePromptResponse

Parameters:

  • execution_id (String)

    The ID of the execution.

  • state (String)
  • error (Vellum::VellumError)
  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



37
38
39
40
41
42
43
44
45
46
47
# File 'lib/vellum_ai/types/rejected_execute_prompt_response.rb', line 37

def initialize(meta: OMIT, raw: OMIT, execution_id:, state:, error:, additional_properties: nil)
  @meta = meta if meta != OMIT
  @raw = raw if raw != OMIT
  @execution_id = execution_id
  @state = state
  @error = error
  @additional_properties = additional_properties
  @_field_set = { "meta": meta, "raw": raw, "execution_id": execution_id, "state": state, "error": error }.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



22
23
24
# File 'lib/vellum_ai/types/rejected_execute_prompt_response.rb', line 22

def additional_properties
  @additional_properties
end

#errorVellum::VellumError (readonly)

Returns:



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

def error
  @error
end

#execution_idString (readonly)

Returns The ID of the execution.

Returns:

  • (String)

    The ID of the execution.



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

def execution_id
  @execution_id
end

#metaVellum::PromptExecutionMeta (readonly)



11
12
13
# File 'lib/vellum_ai/types/rejected_execute_prompt_response.rb', line 11

def meta
  @meta
end

#rawObject (readonly)

‘expand_raw`.



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

def raw
  @raw
end

#stateString (readonly)

Returns:

  • (String)


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

def state
  @state
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::RejectedExecutePromptResponse

Parameters:

  • json_object (String)

Returns:



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/vellum_ai/types/rejected_execute_prompt_response.rb', line 52

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"]
  unless parsed_json["error"].nil?
    error = parsed_json["error"].to_json
    error = Vellum::VellumError.from_json(json_object: error)
  else
    error = nil
  end
  new(
    meta: meta,
    raw: raw,
    execution_id: execution_id,
    state: state,
    error: error,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


91
92
93
94
95
96
97
# File 'lib/vellum_ai/types/rejected_execute_prompt_response.rb', line 91

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.")
  Vellum::VellumError.validate_raw(obj: obj.error)
end

Instance Method Details

#to_jsonString

Returns:

  • (String)


82
83
84
# File 'lib/vellum_ai/types/rejected_execute_prompt_response.rb', line 82

def to_json
  @_field_set&.to_json
end