Class: Vellum::RejectedAdHocExecutePromptEvent

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

Overview

The final data returned indicating an error occurred during the stream.

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state:, error:, execution_id:, meta: OMIT, additional_properties: nil) ⇒ Vellum::RejectedAdHocExecutePromptEvent

Parameters:



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

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



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

def additional_properties
  @additional_properties
end

#errorVellum::VellumError (readonly)

Returns:



13
14
15
# File 'lib/vellum_ai/types/rejected_ad_hoc_execute_prompt_event.rb', line 13

def error
  @error
end

#execution_idString (readonly)

Returns:

  • (String)


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

def execution_id
  @execution_id
end

#metaVellum::AdHocRejectedPromptExecutionMeta (readonly)



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

def meta
  @meta
end

#stateString (readonly)

Returns:

  • (String)


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

def state
  @state
end

Class Method Details

.from_json(json_object:) ⇒ Vellum::RejectedAdHocExecutePromptEvent

Parameters:

  • json_object (String)

Returns:



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

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

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


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

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

Instance Method Details

#to_jsonString

Returns:

  • (String)


74
75
76
# File 'lib/vellum_ai/types/rejected_ad_hoc_execute_prompt_event.rb', line 74

def to_json
  @_field_set&.to_json
end