vellum_ai 0.3.9 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "search_result"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionSearchResultsVellumValue
8
+ attr_reader :id, :name, :value, :additional_properties
9
+
10
+ # @param id [String] The variable's uniquely identifying internal id.
11
+ # @param name [String]
12
+ # @param value [Array<SearchResult>]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionSearchResultsVellumValue]
15
+ def initialize(id:, name:, value: nil, additional_properties: nil)
16
+ # @type [String] The variable's uniquely identifying internal id.
17
+ @id = id
18
+ # @type [String]
19
+ @name = name
20
+ # @type [Array<SearchResult>]
21
+ @value = value
22
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
23
+ @additional_properties = additional_properties
24
+ end
25
+
26
+ # Deserialize a JSON object to an instance of ExecutionSearchResultsVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionSearchResultsVellumValue]
30
+ def self.from_json(json_object:)
31
+ struct = JSON.parse(json_object, object_class: OpenStruct)
32
+ parsed_json = JSON.parse(json_object)
33
+ id = struct.id
34
+ name = struct.name
35
+ value = parsed_json["value"].map do |v|
36
+ v = v.to_json
37
+ SearchResult.from_json(json_object: v)
38
+ end
39
+ new(id: id, name: name, value: value, additional_properties: struct)
40
+ end
41
+
42
+ # Serialize an instance of ExecutionSearchResultsVellumValue to a JSON object
43
+ #
44
+ # @return [JSON]
45
+ def to_json(*_args)
46
+ { "id": @id, "name": @name, "value": @value }.to_json
47
+ end
48
+
49
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
50
+ #
51
+ # @param obj [Object]
52
+ # @return [Void]
53
+ def self.validate_raw(obj:)
54
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
55
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
56
+ obj.value&.is_a?(Array) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ class ExecutionStringVellumValue
7
+ attr_reader :id, :name, :value, :additional_properties
8
+
9
+ # @param id [String] The variable's uniquely identifying internal id.
10
+ # @param name [String]
11
+ # @param value [String]
12
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
13
+ # @return [ExecutionStringVellumValue]
14
+ def initialize(id:, name:, value: nil, additional_properties: nil)
15
+ # @type [String] The variable's uniquely identifying internal id.
16
+ @id = id
17
+ # @type [String]
18
+ @name = name
19
+ # @type [String]
20
+ @value = value
21
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
22
+ @additional_properties = additional_properties
23
+ end
24
+
25
+ # Deserialize a JSON object to an instance of ExecutionStringVellumValue
26
+ #
27
+ # @param json_object [JSON]
28
+ # @return [ExecutionStringVellumValue]
29
+ def self.from_json(json_object:)
30
+ struct = JSON.parse(json_object, object_class: OpenStruct)
31
+ JSON.parse(json_object)
32
+ id = struct.id
33
+ name = struct.name
34
+ value = struct.value
35
+ new(id: id, name: name, value: value, additional_properties: struct)
36
+ end
37
+
38
+ # Serialize an instance of ExecutionStringVellumValue to a JSON object
39
+ #
40
+ # @return [JSON]
41
+ def to_json(*_args)
42
+ { "id": @id, "name": @name, "value": @value }.to_json
43
+ end
44
+
45
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
46
+ #
47
+ # @param obj [Object]
48
+ # @return [Void]
49
+ def self.validate_raw(obj:)
50
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
51
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
52
+ obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,168 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+ require_relative "execution_string_vellum_value"
5
+ require_relative "execution_number_vellum_value"
6
+ require_relative "execution_json_vellum_value"
7
+ require_relative "execution_chat_history_vellum_value"
8
+ require_relative "execution_search_results_vellum_value"
9
+ require_relative "execution_error_vellum_value"
10
+ require_relative "execution_array_vellum_value"
11
+ require_relative "execution_function_call_vellum_value"
12
+
13
+ module Vellum
14
+ class ExecutionVellumValue
15
+ attr_reader :member, :discriminant
16
+
17
+ private_class_method :new
18
+ alias kind_of? is_a?
19
+ # @param member [Object]
20
+ # @param discriminant [String]
21
+ # @return [ExecutionVellumValue]
22
+ def initialize(member:, discriminant:)
23
+ # @type [Object]
24
+ @member = member
25
+ # @type [String]
26
+ @discriminant = discriminant
27
+ end
28
+
29
+ # Deserialize a JSON object to an instance of ExecutionVellumValue
30
+ #
31
+ # @param json_object [JSON]
32
+ # @return [ExecutionVellumValue]
33
+ def self.from_json(json_object:)
34
+ struct = JSON.parse(json_object, object_class: OpenStruct)
35
+ member = case struct.type
36
+ when "STRING"
37
+ ExecutionStringVellumValue.from_json(json_object: json_object)
38
+ when "NUMBER"
39
+ ExecutionNumberVellumValue.from_json(json_object: json_object)
40
+ when "JSON"
41
+ ExecutionJsonVellumValue.from_json(json_object: json_object)
42
+ when "CHAT_HISTORY"
43
+ ExecutionChatHistoryVellumValue.from_json(json_object: json_object)
44
+ when "SEARCH_RESULTS"
45
+ ExecutionSearchResultsVellumValue.from_json(json_object: json_object)
46
+ when "ERROR"
47
+ ExecutionErrorVellumValue.from_json(json_object: json_object)
48
+ when "ARRAY"
49
+ ExecutionArrayVellumValue.from_json(json_object: json_object)
50
+ when "FUNCTION_CALL"
51
+ ExecutionFunctionCallVellumValue.from_json(json_object: json_object)
52
+ else
53
+ ExecutionStringVellumValue.from_json(json_object: json_object)
54
+ end
55
+ new(member: member, discriminant: struct.type)
56
+ end
57
+
58
+ # For Union Types, to_json functionality is delegated to the wrapped member.
59
+ #
60
+ # @return [JSON]
61
+ def to_json(*_args)
62
+ case @discriminant
63
+ when "STRING"
64
+ { **@member.to_json, type: @discriminant }.to_json
65
+ when "NUMBER"
66
+ { **@member.to_json, type: @discriminant }.to_json
67
+ when "JSON"
68
+ { **@member.to_json, type: @discriminant }.to_json
69
+ when "CHAT_HISTORY"
70
+ { **@member.to_json, type: @discriminant }.to_json
71
+ when "SEARCH_RESULTS"
72
+ { **@member.to_json, type: @discriminant }.to_json
73
+ when "ERROR"
74
+ { **@member.to_json, type: @discriminant }.to_json
75
+ when "ARRAY"
76
+ { **@member.to_json, type: @discriminant }.to_json
77
+ when "FUNCTION_CALL"
78
+ { **@member.to_json, type: @discriminant }.to_json
79
+ else
80
+ { "type": @discriminant, value: @member }.to_json
81
+ end
82
+ @member.to_json
83
+ end
84
+
85
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
86
+ #
87
+ # @param obj [Object]
88
+ # @return [Void]
89
+ def self.validate_raw(obj:)
90
+ case obj.type
91
+ when "STRING"
92
+ ExecutionStringVellumValue.validate_raw(obj: obj)
93
+ when "NUMBER"
94
+ ExecutionNumberVellumValue.validate_raw(obj: obj)
95
+ when "JSON"
96
+ ExecutionJsonVellumValue.validate_raw(obj: obj)
97
+ when "CHAT_HISTORY"
98
+ ExecutionChatHistoryVellumValue.validate_raw(obj: obj)
99
+ when "SEARCH_RESULTS"
100
+ ExecutionSearchResultsVellumValue.validate_raw(obj: obj)
101
+ when "ERROR"
102
+ ExecutionErrorVellumValue.validate_raw(obj: obj)
103
+ when "ARRAY"
104
+ ExecutionArrayVellumValue.validate_raw(obj: obj)
105
+ when "FUNCTION_CALL"
106
+ ExecutionFunctionCallVellumValue.validate_raw(obj: obj)
107
+ else
108
+ raise("Passed value matched no type within the union, validation failed.")
109
+ end
110
+ end
111
+
112
+ # For Union Types, is_a? functionality is delegated to the wrapped member.
113
+ #
114
+ # @param obj [Object]
115
+ # @return [Boolean]
116
+ def is_a?(obj)
117
+ @member.is_a?(obj)
118
+ end
119
+
120
+ # @param member [ExecutionStringVellumValue]
121
+ # @return [ExecutionVellumValue]
122
+ def self.string(member:)
123
+ new(member: member, discriminant: "STRING")
124
+ end
125
+
126
+ # @param member [ExecutionNumberVellumValue]
127
+ # @return [ExecutionVellumValue]
128
+ def self.number(member:)
129
+ new(member: member, discriminant: "NUMBER")
130
+ end
131
+
132
+ # @param member [ExecutionJsonVellumValue]
133
+ # @return [ExecutionVellumValue]
134
+ def self.json(member:)
135
+ new(member: member, discriminant: "JSON")
136
+ end
137
+
138
+ # @param member [ExecutionChatHistoryVellumValue]
139
+ # @return [ExecutionVellumValue]
140
+ def self.chat_history(member:)
141
+ new(member: member, discriminant: "CHAT_HISTORY")
142
+ end
143
+
144
+ # @param member [ExecutionSearchResultsVellumValue]
145
+ # @return [ExecutionVellumValue]
146
+ def self.search_results(member:)
147
+ new(member: member, discriminant: "SEARCH_RESULTS")
148
+ end
149
+
150
+ # @param member [ExecutionErrorVellumValue]
151
+ # @return [ExecutionVellumValue]
152
+ def self.error(member:)
153
+ new(member: member, discriminant: "ERROR")
154
+ end
155
+
156
+ # @param member [ExecutionArrayVellumValue]
157
+ # @return [ExecutionVellumValue]
158
+ def self.array(member:)
159
+ new(member: member, discriminant: "ARRAY")
160
+ end
161
+
162
+ # @param member [ExecutionFunctionCallVellumValue]
163
+ # @return [ExecutionVellumValue]
164
+ def self.function_call(member:)
165
+ new(member: member, discriminant: "FUNCTION_CALL")
166
+ end
167
+ end
168
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "document_index_read"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class PaginatedDocumentIndexReadList
8
+ attr_reader :count, :next_, :previous, :results, :additional_properties
9
+
10
+ # @param count [Integer]
11
+ # @param next_ [String]
12
+ # @param previous [String]
13
+ # @param results [Array<DocumentIndexRead>]
14
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
+ # @return [PaginatedDocumentIndexReadList]
16
+ def initialize(count: nil, next_: nil, previous: nil, results: nil, additional_properties: nil)
17
+ # @type [Integer]
18
+ @count = count
19
+ # @type [String]
20
+ @next_ = next_
21
+ # @type [String]
22
+ @previous = previous
23
+ # @type [Array<DocumentIndexRead>]
24
+ @results = results
25
+ # @type [OpenStruct] Additional properties unmapped to the current class definition
26
+ @additional_properties = additional_properties
27
+ end
28
+
29
+ # Deserialize a JSON object to an instance of PaginatedDocumentIndexReadList
30
+ #
31
+ # @param json_object [JSON]
32
+ # @return [PaginatedDocumentIndexReadList]
33
+ def self.from_json(json_object:)
34
+ struct = JSON.parse(json_object, object_class: OpenStruct)
35
+ parsed_json = JSON.parse(json_object)
36
+ count = struct.count
37
+ next_ = struct.next
38
+ previous = struct.previous
39
+ results = parsed_json["results"].map do |v|
40
+ v = v.to_json
41
+ DocumentIndexRead.from_json(json_object: v)
42
+ end
43
+ new(count: count, next_: next_, previous: previous, results: results, additional_properties: struct)
44
+ end
45
+
46
+ # Serialize an instance of PaginatedDocumentIndexReadList to a JSON object
47
+ #
48
+ # @return [JSON]
49
+ def to_json(*_args)
50
+ { "count": @count, "next": @next_, "previous": @previous, "results": @results }.to_json
51
+ end
52
+
53
+ # Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
54
+ #
55
+ # @param obj [Object]
56
+ # @return [Void]
57
+ def self.validate_raw(obj:)
58
+ obj.count&.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.")
59
+ obj.next_&.is_a?(String) != false || raise("Passed value for field obj.next_ is not the expected type, validation failed.")
60
+ obj.previous&.is_a?(String) != false || raise("Passed value for field obj.previous is not the expected type, validation failed.")
61
+ obj.results&.is_a?(Array) != false || raise("Passed value for field obj.results is not the expected type, validation failed.")
62
+ end
63
+ end
64
+ end
@@ -7,11 +7,12 @@ require "json"
7
7
 
8
8
  module Vellum
9
9
  class PromptTemplateBlockProperties
10
- attr_reader :chat_role, :chat_message_unterminated, :template, :template_type, :function_name,
10
+ attr_reader :chat_role, :chat_message_unterminated, :chat_source, :template, :template_type, :function_name,
11
11
  :function_description, :function_parameters, :function_forced, :blocks, :additional_properties
12
12
 
13
13
  # @param chat_role [CHAT_MESSAGE_ROLE]
14
14
  # @param chat_message_unterminated [Boolean]
15
+ # @param chat_source [String]
15
16
  # @param template [String]
16
17
  # @param template_type [VELLUM_VARIABLE_TYPE]
17
18
  # @param function_name [String]
@@ -21,13 +22,15 @@ module Vellum
21
22
  # @param blocks [Array<PromptTemplateBlock>]
22
23
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
24
  # @return [PromptTemplateBlockProperties]
24
- def initialize(chat_role: nil, chat_message_unterminated: nil, template: nil, template_type: nil,
25
+ def initialize(chat_role: nil, chat_message_unterminated: nil, chat_source: nil, template: nil, template_type: nil,
25
26
  function_name: nil, function_description: nil, function_parameters: nil, function_forced: nil, blocks: nil, additional_properties: nil)
26
27
  # @type [CHAT_MESSAGE_ROLE]
27
28
  @chat_role = chat_role
28
29
  # @type [Boolean]
29
30
  @chat_message_unterminated = chat_message_unterminated
30
31
  # @type [String]
32
+ @chat_source = chat_source
33
+ # @type [String]
31
34
  @template = template
32
35
  # @type [VELLUM_VARIABLE_TYPE]
33
36
  @template_type = template_type
@@ -54,6 +57,7 @@ module Vellum
54
57
  parsed_json = JSON.parse(json_object)
55
58
  chat_role = CHAT_MESSAGE_ROLE.key(parsed_json["chat_role"]) || parsed_json["chat_role"]
56
59
  chat_message_unterminated = struct.chat_message_unterminated
60
+ chat_source = struct.chat_source
57
61
  template = struct.template
58
62
  template_type = VELLUM_VARIABLE_TYPE.key(parsed_json["template_type"]) || parsed_json["template_type"]
59
63
  function_name = struct.function_name
@@ -64,8 +68,8 @@ module Vellum
64
68
  v = v.to_json
65
69
  PromptTemplateBlock.from_json(json_object: v)
66
70
  end
67
- new(chat_role: chat_role, chat_message_unterminated: chat_message_unterminated, template: template,
68
- template_type: template_type, function_name: function_name, function_description: function_description, function_parameters: function_parameters, function_forced: function_forced, blocks: blocks, additional_properties: struct)
71
+ new(chat_role: chat_role, chat_message_unterminated: chat_message_unterminated, chat_source: chat_source,
72
+ template: template, template_type: template_type, function_name: function_name, function_description: function_description, function_parameters: function_parameters, function_forced: function_forced, blocks: blocks, additional_properties: struct)
69
73
  end
70
74
 
71
75
  # Serialize an instance of PromptTemplateBlockProperties to a JSON object
@@ -75,6 +79,7 @@ module Vellum
75
79
  {
76
80
  "chat_role": CHAT_MESSAGE_ROLE[@chat_role] || @chat_role,
77
81
  "chat_message_unterminated": @chat_message_unterminated,
82
+ "chat_source": @chat_source,
78
83
  "template": @template,
79
84
  "template_type": VELLUM_VARIABLE_TYPE[@template_type] || @template_type,
80
85
  "function_name": @function_name,
@@ -92,6 +97,7 @@ module Vellum
92
97
  def self.validate_raw(obj:)
93
98
  obj.chat_role&.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.chat_role is not the expected type, validation failed.")
94
99
  obj.chat_message_unterminated&.is_a?(Boolean) != false || raise("Passed value for field obj.chat_message_unterminated is not the expected type, validation failed.")
100
+ obj.chat_source&.is_a?(String) != false || raise("Passed value for field obj.chat_source is not the expected type, validation failed.")
95
101
  obj.template&.is_a?(String) != false || raise("Passed value for field obj.template is not the expected type, validation failed.")
96
102
  obj.template_type&.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.template_type is not the expected type, validation failed.")
97
103
  obj.function_name&.is_a?(String) != false || raise("Passed value for field obj.function_name is not the expected type, validation failed.")
@@ -7,11 +7,12 @@ require "json"
7
7
 
8
8
  module Vellum
9
9
  class PromptTemplateBlockPropertiesRequest
10
- attr_reader :chat_role, :chat_message_unterminated, :template, :template_type, :function_name,
10
+ attr_reader :chat_role, :chat_message_unterminated, :chat_source, :template, :template_type, :function_name,
11
11
  :function_description, :function_parameters, :function_forced, :blocks, :additional_properties
12
12
 
13
13
  # @param chat_role [CHAT_MESSAGE_ROLE]
14
14
  # @param chat_message_unterminated [Boolean]
15
+ # @param chat_source [String]
15
16
  # @param template [String]
16
17
  # @param template_type [VELLUM_VARIABLE_TYPE]
17
18
  # @param function_name [String]
@@ -21,13 +22,15 @@ module Vellum
21
22
  # @param blocks [Array<PromptTemplateBlockRequest>]
22
23
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
23
24
  # @return [PromptTemplateBlockPropertiesRequest]
24
- def initialize(chat_role: nil, chat_message_unterminated: nil, template: nil, template_type: nil,
25
+ def initialize(chat_role: nil, chat_message_unterminated: nil, chat_source: nil, template: nil, template_type: nil,
25
26
  function_name: nil, function_description: nil, function_parameters: nil, function_forced: nil, blocks: nil, additional_properties: nil)
26
27
  # @type [CHAT_MESSAGE_ROLE]
27
28
  @chat_role = chat_role
28
29
  # @type [Boolean]
29
30
  @chat_message_unterminated = chat_message_unterminated
30
31
  # @type [String]
32
+ @chat_source = chat_source
33
+ # @type [String]
31
34
  @template = template
32
35
  # @type [VELLUM_VARIABLE_TYPE]
33
36
  @template_type = template_type
@@ -54,6 +57,7 @@ module Vellum
54
57
  parsed_json = JSON.parse(json_object)
55
58
  chat_role = CHAT_MESSAGE_ROLE.key(parsed_json["chat_role"]) || parsed_json["chat_role"]
56
59
  chat_message_unterminated = struct.chat_message_unterminated
60
+ chat_source = struct.chat_source
57
61
  template = struct.template
58
62
  template_type = VELLUM_VARIABLE_TYPE.key(parsed_json["template_type"]) || parsed_json["template_type"]
59
63
  function_name = struct.function_name
@@ -64,8 +68,8 @@ module Vellum
64
68
  v = v.to_json
65
69
  PromptTemplateBlockRequest.from_json(json_object: v)
66
70
  end
67
- new(chat_role: chat_role, chat_message_unterminated: chat_message_unterminated, template: template,
68
- template_type: template_type, function_name: function_name, function_description: function_description, function_parameters: function_parameters, function_forced: function_forced, blocks: blocks, additional_properties: struct)
71
+ new(chat_role: chat_role, chat_message_unterminated: chat_message_unterminated, chat_source: chat_source,
72
+ template: template, template_type: template_type, function_name: function_name, function_description: function_description, function_parameters: function_parameters, function_forced: function_forced, blocks: blocks, additional_properties: struct)
69
73
  end
70
74
 
71
75
  # Serialize an instance of PromptTemplateBlockPropertiesRequest to a JSON object
@@ -75,6 +79,7 @@ module Vellum
75
79
  {
76
80
  "chat_role": CHAT_MESSAGE_ROLE[@chat_role] || @chat_role,
77
81
  "chat_message_unterminated": @chat_message_unterminated,
82
+ "chat_source": @chat_source,
78
83
  "template": @template,
79
84
  "template_type": VELLUM_VARIABLE_TYPE[@template_type] || @template_type,
80
85
  "function_name": @function_name,
@@ -92,6 +97,7 @@ module Vellum
92
97
  def self.validate_raw(obj:)
93
98
  obj.chat_role&.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.chat_role is not the expected type, validation failed.")
94
99
  obj.chat_message_unterminated&.is_a?(Boolean) != false || raise("Passed value for field obj.chat_message_unterminated is not the expected type, validation failed.")
100
+ obj.chat_source&.is_a?(String) != false || raise("Passed value for field obj.chat_source is not the expected type, validation failed.")
95
101
  obj.template&.is_a?(String) != false || raise("Passed value for field obj.template is not the expected type, validation failed.")
96
102
  obj.template_type&.is_a?(VELLUM_VARIABLE_TYPE) != false || raise("Passed value for field obj.template_type is not the expected type, validation failed.")
97
103
  obj.function_name&.is_a?(String) != false || raise("Passed value for field obj.function_name is not the expected type, validation failed.")
@@ -5,11 +5,12 @@ require "date"
5
5
  require_relative "workflow_result_event_output_data"
6
6
  require_relative "workflow_event_error"
7
7
  require_relative "workflow_output"
8
+ require_relative "execution_vellum_value"
8
9
  require "json"
9
10
 
10
11
  module Vellum
11
12
  class WorkflowResultEvent
12
- attr_reader :id, :state, :ts, :output, :error, :outputs, :additional_properties
13
+ attr_reader :id, :state, :ts, :output, :error, :outputs, :inputs, :additional_properties
13
14
 
14
15
  # @param id [String]
15
16
  # @param state [WORKFLOW_NODE_RESULT_EVENT_STATE]
@@ -17,9 +18,10 @@ module Vellum
17
18
  # @param output [WorkflowResultEventOutputData]
18
19
  # @param error [WorkflowEventError]
19
20
  # @param outputs [Array<WorkflowOutput>]
21
+ # @param inputs [Array<ExecutionVellumValue>]
20
22
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
21
23
  # @return [WorkflowResultEvent]
22
- def initialize(id:, state:, ts:, output: nil, error: nil, outputs: nil, additional_properties: nil)
24
+ def initialize(id:, state:, ts:, output: nil, error: nil, outputs: nil, inputs: nil, additional_properties: nil)
23
25
  # @type [String]
24
26
  @id = id
25
27
  # @type [WORKFLOW_NODE_RESULT_EVENT_STATE]
@@ -32,6 +34,8 @@ module Vellum
32
34
  @error = error
33
35
  # @type [Array<WorkflowOutput>]
34
36
  @outputs = outputs
37
+ # @type [Array<ExecutionVellumValue>]
38
+ @inputs = inputs
35
39
  # @type [OpenStruct] Additional properties unmapped to the current class definition
36
40
  @additional_properties = additional_properties
37
41
  end
@@ -62,7 +66,12 @@ module Vellum
62
66
  v = v.to_json
63
67
  WorkflowOutput.from_json(json_object: v)
64
68
  end
65
- new(id: id, state: state, ts: ts, output: output, error: error, outputs: outputs, additional_properties: struct)
69
+ inputs = parsed_json["inputs"].map do |v|
70
+ v = v.to_json
71
+ ExecutionVellumValue.from_json(json_object: v)
72
+ end
73
+ new(id: id, state: state, ts: ts, output: output, error: error, outputs: outputs, inputs: inputs,
74
+ additional_properties: struct)
66
75
  end
67
76
 
68
77
  # Serialize an instance of WorkflowResultEvent to a JSON object
@@ -75,7 +84,8 @@ module Vellum
75
84
  "ts": @ts,
76
85
  "output": @output,
77
86
  "error": @error,
78
- "outputs": @outputs
87
+ "outputs": @outputs,
88
+ "inputs": @inputs
79
89
  }.to_json
80
90
  end
81
91
 
@@ -90,6 +100,7 @@ module Vellum
90
100
  obj.output.nil? || WorkflowResultEventOutputData.validate_raw(obj: obj.output)
91
101
  obj.error.nil? || WorkflowEventError.validate_raw(obj: obj.error)
92
102
  obj.outputs&.is_a?(Array) != false || raise("Passed value for field obj.outputs is not the expected type, validation failed.")
103
+ obj.inputs&.is_a?(Array) != false || raise("Passed value for field obj.inputs is not the expected type, validation failed.")
93
104
  end
94
105
  end
95
106
  end
data/lib/vellum_ai.rb CHANGED
@@ -96,11 +96,11 @@ module Vellum
96
96
 
97
97
  # Executes a deployed Workflow and returns its outputs.
98
98
  #
99
+ # @param inputs [Array<Hash>] The list of inputs defined in the Workflow's Deployment with their corresponding values.Request of type Array<WorkflowRequestInputRequest>, as a Hash
99
100
  # @param workflow_deployment_id [String] The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
100
101
  # @param workflow_deployment_name [String] The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
101
102
  # @param release_tag [String] Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
102
- # @param inputs [Array<Hash>] The list of inputs defined in the Workflow's Deployment with their corresponding values.Request of type Array<WorkflowRequestInputRequest>, as a Hash
103
- # @param external_id [String] Optionally include a unique identifier for monitoring purposes. Must be unique for a given workflow deployment.
103
+ # @param external_id [String] Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
104
104
  # @param request_options [RequestOptions]
105
105
  # @return [ExecuteWorkflowResponse]
106
106
  def execute_workflow(inputs:, workflow_deployment_id: nil, workflow_deployment_name: nil, release_tag: nil,
@@ -111,10 +111,10 @@ module Vellum
111
111
  req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
112
112
  req.body = {
113
113
  **(request_options&.additional_body_parameters || {}),
114
+ inputs: inputs,
114
115
  workflow_deployment_id: workflow_deployment_id,
115
116
  workflow_deployment_name: workflow_deployment_name,
116
117
  release_tag: release_tag,
117
- inputs: inputs,
118
118
  external_id: external_id
119
119
  }.compact
120
120
  req.url "#{@request_client.default_environment[:Predict]}/v1/execute-workflow"
@@ -318,11 +318,11 @@ module Vellum
318
318
 
319
319
  # Executes a deployed Workflow and returns its outputs.
320
320
  #
321
+ # @param inputs [Array<Hash>] The list of inputs defined in the Workflow's Deployment with their corresponding values.Request of type Array<WorkflowRequestInputRequest>, as a Hash
321
322
  # @param workflow_deployment_id [String] The ID of the Workflow Deployment. Must provide either this or workflow_deployment_name.
322
323
  # @param workflow_deployment_name [String] The name of the Workflow Deployment. Must provide either this or workflow_deployment_id.
323
324
  # @param release_tag [String] Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
324
- # @param inputs [Array<Hash>] The list of inputs defined in the Workflow's Deployment with their corresponding values.Request of type Array<WorkflowRequestInputRequest>, as a Hash
325
- # @param external_id [String] Optionally include a unique identifier for monitoring purposes. Must be unique for a given workflow deployment.
325
+ # @param external_id [String] Optionally include a unique identifier for tracking purposes. Must be unique for a given workflow deployment.
326
326
  # @param request_options [RequestOptions]
327
327
  # @return [ExecuteWorkflowResponse]
328
328
  def execute_workflow(inputs:, workflow_deployment_id: nil, workflow_deployment_name: nil, release_tag: nil,
@@ -333,10 +333,10 @@ module Vellum
333
333
  req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
334
334
  req.body = {
335
335
  **(request_options&.additional_body_parameters || {}),
336
+ inputs: inputs,
336
337
  workflow_deployment_id: workflow_deployment_id,
337
338
  workflow_deployment_name: workflow_deployment_name,
338
339
  release_tag: release_tag,
339
- inputs: inputs,
340
340
  external_id: external_id
341
341
  }.compact
342
342
  req.url "#{@async_request_client.default_environment[:Predict]}/v1/execute-workflow"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vellum_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.9
4
+ version: 0.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vellum
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-06 00:00:00.000000000 Z
11
+ date: 2024-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http-faraday
@@ -95,6 +95,7 @@ files:
95
95
  - lib/vellum_ai/deployments/client.rb
96
96
  - lib/vellum_ai/deployments/types/deployments_list_request_status.rb
97
97
  - lib/vellum_ai/document_indexes/client.rb
98
+ - lib/vellum_ai/document_indexes/types/document_indexes_list_request_status.rb
98
99
  - lib/vellum_ai/documents/client.rb
99
100
  - lib/vellum_ai/folder_entities/client.rb
100
101
  - lib/vellum_ai/model_versions/client.rb
@@ -147,6 +148,15 @@ files:
147
148
  - lib/vellum_ai/types/execute_workflow_response.rb
148
149
  - lib/vellum_ai/types/execute_workflow_stream_error_response.rb
149
150
  - lib/vellum_ai/types/execute_workflow_workflow_result_event.rb
151
+ - lib/vellum_ai/types/execution_array_vellum_value.rb
152
+ - lib/vellum_ai/types/execution_chat_history_vellum_value.rb
153
+ - lib/vellum_ai/types/execution_error_vellum_value.rb
154
+ - lib/vellum_ai/types/execution_function_call_vellum_value.rb
155
+ - lib/vellum_ai/types/execution_json_vellum_value.rb
156
+ - lib/vellum_ai/types/execution_number_vellum_value.rb
157
+ - lib/vellum_ai/types/execution_search_results_vellum_value.rb
158
+ - lib/vellum_ai/types/execution_string_vellum_value.rb
159
+ - lib/vellum_ai/types/execution_vellum_value.rb
150
160
  - lib/vellum_ai/types/finish_reason_enum.rb
151
161
  - lib/vellum_ai/types/fulfilled_enum.rb
152
162
  - lib/vellum_ai/types/fulfilled_execute_prompt_event.rb
@@ -222,6 +232,7 @@ files:
222
232
  - lib/vellum_ai/types/normalized_token_log_probs.rb
223
233
  - lib/vellum_ai/types/number_enum.rb
224
234
  - lib/vellum_ai/types/number_variable_value.rb
235
+ - lib/vellum_ai/types/paginated_document_index_read_list.rb
225
236
  - lib/vellum_ai/types/paginated_slim_deployment_read_list.rb
226
237
  - lib/vellum_ai/types/paginated_slim_document_list.rb
227
238
  - lib/vellum_ai/types/paginated_slim_workflow_deployment_list.rb