Class: Vellum::TestCaseVariableValue

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

Class Method Summary collapse

Class Method Details

.from_json(json_object:) ⇒ Vellum::TestCaseVariableValue

Parameters:

  • json_object (String)

Returns:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/vellum_ai/types/test_case_variable_value.rb', line 20

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  begin
    Vellum::TestCaseStringVariableValue.validate_raw(obj: struct)
    unless struct.nil?
  return Vellum::TestCaseStringVariableValue.from_json(json_object: struct)
else
  return nil
end
  rescue StandardError
    # noop
  end
  begin
    Vellum::TestCaseNumberVariableValue.validate_raw(obj: struct)
    unless struct.nil?
  return Vellum::TestCaseNumberVariableValue.from_json(json_object: struct)
else
  return nil
end
  rescue StandardError
    # noop
  end
  begin
    Vellum::TestCaseJsonVariableValue.validate_raw(obj: struct)
    unless struct.nil?
  return Vellum::TestCaseJsonVariableValue.from_json(json_object: struct)
else
  return nil
end
  rescue StandardError
    # noop
  end
  begin
    Vellum::TestCaseChatHistoryVariableValue.validate_raw(obj: struct)
    unless struct.nil?
  return Vellum::TestCaseChatHistoryVariableValue.from_json(json_object: struct)
else
  return nil
end
  rescue StandardError
    # noop
  end
  begin
    Vellum::TestCaseSearchResultsVariableValue.validate_raw(obj: struct)
    unless struct.nil?
  return Vellum::TestCaseSearchResultsVariableValue.from_json(json_object: struct)
else
  return nil
end
  rescue StandardError
    # noop
  end
  begin
    Vellum::TestCaseErrorVariableValue.validate_raw(obj: struct)
    unless struct.nil?
  return Vellum::TestCaseErrorVariableValue.from_json(json_object: struct)
else
  return nil
end
  rescue StandardError
    # noop
  end
  begin
    Vellum::TestCaseFunctionCallVariableValue.validate_raw(obj: struct)
    unless struct.nil?
  return Vellum::TestCaseFunctionCallVariableValue.from_json(json_object: struct)
else
  return nil
end
  rescue StandardError
    # noop
  end
  begin
    Vellum::TestCaseArrayVariableValue.validate_raw(obj: struct)
    unless struct.nil?
  return Vellum::TestCaseArrayVariableValue.from_json(json_object: struct)
else
  return nil
end
  rescue StandardError
    # noop
  end
 return struct
end

.validate_raw(obj:) ⇒ Void

Parameters:

  • obj (Object)

Returns:

  • (Void)


110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
# File 'lib/vellum_ai/types/test_case_variable_value.rb', line 110

def self.validate_raw(obj:)
  begin
    return Vellum::TestCaseStringVariableValue.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Vellum::TestCaseNumberVariableValue.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Vellum::TestCaseJsonVariableValue.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Vellum::TestCaseChatHistoryVariableValue.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Vellum::TestCaseSearchResultsVariableValue.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Vellum::TestCaseErrorVariableValue.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Vellum::TestCaseFunctionCallVariableValue.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  begin
    return Vellum::TestCaseArrayVariableValue.validate_raw(obj: obj)
  rescue StandardError
    # noop
  end
  raise("Passed value matched no type within the union, validation failed.")
end