vellum_ai 0.3.9 → 0.3.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72a042dfa14e5c853594fed021ab79235d7493790da8e34280f66c6f448fb1db
4
- data.tar.gz: 25ddfca2df59cc444d7e4c63cf221f8bb3274a660253183a165c5741ed4de8b4
3
+ metadata.gz: a34112cfe303a361bb71b349a1b752f9af3a0aeab320d337423fff77fb2b2cac
4
+ data.tar.gz: 3de6e6dc8f28729679ae89cb99a7bd210520457564910e499c0ebdddd938a219
5
5
  SHA512:
6
- metadata.gz: b0de23219672cbb8def515bc8fa00b31e0209b3914ca4284f103fbb21a9022d51830ff802d1b924599bbd8443ff40b7de721d9e265d1792acb8d736c58c5150e
7
- data.tar.gz: a7cd6b831b2937bd112d934bb6d9a1d57a20594cc567296568bd3271632b29ab082c25d2b11e2fe872579f26b26e2a1c0067ae6d6f5a754f089ba0a15b0b5593
6
+ metadata.gz: f728fd9611386219ed4871bd39a5fba81166c72f04e42d4c877f1f5e4539d5178d0f4b1a195b5090cbba8091e49fb4985dab61903ec5bbd6c89f0fc2bdac0bca
7
+ data.tar.gz: 6d9034005bbdfa8a321ddd061a6aacbfa64ab2421506069726eb56ca6bf07eef593ef55903aa354fe1b4e9fc1e72578f93700ace1c547374992738115a461fdb
data/lib/requests.rb CHANGED
@@ -20,7 +20,7 @@ module Vellum
20
20
  @headers = {
21
21
  "X-Fern-Language": "Ruby",
22
22
  "X-Fern-SDK-Name": "Vellum",
23
- "X-Fern-SDK-Version": "0.3.9",
23
+ "X-Fern-SDK-Version": "0.3.11",
24
24
  "X_API_KEY": api_key.to_s
25
25
  }
26
26
  @conn = Faraday.new(headers: @headers) do |faraday|
@@ -46,7 +46,7 @@ module Vellum
46
46
  @headers = {
47
47
  "X-Fern-Language": "Ruby",
48
48
  "X-Fern-SDK-Name": "Vellum",
49
- "X-Fern-SDK-Version": "0.3.9",
49
+ "X-Fern-SDK-Version": "0.3.11",
50
50
  "X_API_KEY": api_key.to_s
51
51
  }
52
52
  @conn = Faraday.new(headers: @headers) do |faraday|
data/lib/types_export.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "vellum_ai/deployments/types/deployments_list_request_status"
4
+ require_relative "vellum_ai/document_indexes/types/document_indexes_list_request_status"
4
5
  require_relative "vellum_ai/workflow_deployments/types/workflow_deployments_list_request_status"
5
6
  require_relative "vellum_ai/types/api_node_result"
6
7
  require_relative "vellum_ai/types/api_node_result_data"
@@ -48,6 +49,15 @@ require_relative "vellum_ai/types/execute_workflow_error_response"
48
49
  require_relative "vellum_ai/types/execute_workflow_response"
49
50
  require_relative "vellum_ai/types/execute_workflow_stream_error_response"
50
51
  require_relative "vellum_ai/types/execute_workflow_workflow_result_event"
52
+ require_relative "vellum_ai/types/execution_array_vellum_value"
53
+ require_relative "vellum_ai/types/execution_chat_history_vellum_value"
54
+ require_relative "vellum_ai/types/execution_error_vellum_value"
55
+ require_relative "vellum_ai/types/execution_function_call_vellum_value"
56
+ require_relative "vellum_ai/types/execution_json_vellum_value"
57
+ require_relative "vellum_ai/types/execution_number_vellum_value"
58
+ require_relative "vellum_ai/types/execution_search_results_vellum_value"
59
+ require_relative "vellum_ai/types/execution_string_vellum_value"
60
+ require_relative "vellum_ai/types/execution_vellum_value"
51
61
  require_relative "vellum_ai/types/finish_reason_enum"
52
62
  require_relative "vellum_ai/types/fulfilled_enum"
53
63
  require_relative "vellum_ai/types/fulfilled_execute_prompt_event"
@@ -123,6 +133,7 @@ require_relative "vellum_ai/types/normalized_log_probs"
123
133
  require_relative "vellum_ai/types/normalized_token_log_probs"
124
134
  require_relative "vellum_ai/types/number_enum"
125
135
  require_relative "vellum_ai/types/number_variable_value"
136
+ require_relative "vellum_ai/types/paginated_document_index_read_list"
126
137
  require_relative "vellum_ai/types/paginated_slim_deployment_read_list"
127
138
  require_relative "vellum_ai/types/paginated_slim_document_list"
128
139
  require_relative "vellum_ai/types/paginated_slim_workflow_deployment_list"
@@ -60,9 +60,11 @@ module Vellum
60
60
  # @param deployment_id [String] The ID of the deployment. Must provide either this or deployment_name.
61
61
  # @param deployment_name [String] The name of the deployment. Must provide either this or deployment_id.
62
62
  # @param inputs [Array<Hash>] The list of inputs defined in the Prompt's deployment with their corresponding values.Request of type Array<PromptDeploymentInputRequest>, as a Hash
63
+ # @param release_tag [String] Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
63
64
  # @param request_options [RequestOptions]
64
65
  # @return [DeploymentProviderPayloadResponse]
65
- def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, request_options: nil)
66
+ def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil,
67
+ request_options: nil)
66
68
  response = @request_client.conn.post do |req|
67
69
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
68
70
  req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
@@ -71,7 +73,8 @@ module Vellum
71
73
  **(request_options&.additional_body_parameters || {}),
72
74
  deployment_id: deployment_id,
73
75
  deployment_name: deployment_name,
74
- inputs: inputs
76
+ inputs: inputs,
77
+ release_tag: release_tag
75
78
  }.compact
76
79
  req.url "#{@request_client.default_environment[:Default]}/v1/deployments/provider-payload"
77
80
  end
@@ -134,9 +137,11 @@ module Vellum
134
137
  # @param deployment_id [String] The ID of the deployment. Must provide either this or deployment_name.
135
138
  # @param deployment_name [String] The name of the deployment. Must provide either this or deployment_id.
136
139
  # @param inputs [Array<Hash>] The list of inputs defined in the Prompt's deployment with their corresponding values.Request of type Array<PromptDeploymentInputRequest>, as a Hash
140
+ # @param release_tag [String] Optionally specify a release tag if you want to pin to a specific release of the Workflow Deployment
137
141
  # @param request_options [RequestOptions]
138
142
  # @return [DeploymentProviderPayloadResponse]
139
- def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, request_options: nil)
143
+ def retrieve_provider_payload(inputs:, deployment_id: nil, deployment_name: nil, release_tag: nil,
144
+ request_options: nil)
140
145
  Async do
141
146
  response = @request_client.conn.post do |req|
142
147
  req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
@@ -146,7 +151,8 @@ module Vellum
146
151
  **(request_options&.additional_body_parameters || {}),
147
152
  deployment_id: deployment_id,
148
153
  deployment_name: deployment_name,
149
- inputs: inputs
154
+ inputs: inputs,
155
+ release_tag: release_tag
150
156
  }.compact
151
157
  req.url "#{@request_client.default_environment[:Default]}/v1/deployments/provider-payload"
152
158
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "../../requests"
4
+ require_relative "types/document_indexes_list_request_status"
5
+ require_relative "../types/paginated_document_index_read_list"
4
6
  require_relative "../types/entity_status"
5
7
  require_relative "../types/environment_enum"
6
8
  require_relative "../types/document_index_read"
@@ -17,6 +19,33 @@ module Vellum
17
19
  @request_client = request_client
18
20
  end
19
21
 
22
+ # Used to retrieve a list of Document Indexes.
23
+ #
24
+ # @param limit [Integer] Number of results to return per page.
25
+ # @param offset [Integer] The initial index from which to return the results.
26
+ # @param ordering [String] Which field to use when ordering the results.
27
+ # @param status [DOCUMENT_INDEXES_LIST_REQUEST_STATUS] The current status of the document index
28
+ # - `ACTIVE` - Active
29
+ # - `ARCHIVED` - Archived
30
+ # @param request_options [RequestOptions]
31
+ # @return [PaginatedDocumentIndexReadList]
32
+ def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
33
+ response = @request_client.conn.get do |req|
34
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
35
+ req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
36
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
37
+ req.params = {
38
+ **(request_options&.additional_query_parameters || {}),
39
+ "limit": limit,
40
+ "offset": offset,
41
+ "ordering": ordering,
42
+ "status": status
43
+ }.compact
44
+ req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes"
45
+ end
46
+ PaginatedDocumentIndexReadList.from_json(json_object: response.body)
47
+ end
48
+
20
49
  # Creates a new document index.
21
50
  #
22
51
  # @param label [String] A human-readable label for the document index
@@ -78,6 +107,35 @@ module Vellum
78
107
  @request_client = request_client
79
108
  end
80
109
 
110
+ # Used to retrieve a list of Document Indexes.
111
+ #
112
+ # @param limit [Integer] Number of results to return per page.
113
+ # @param offset [Integer] The initial index from which to return the results.
114
+ # @param ordering [String] Which field to use when ordering the results.
115
+ # @param status [DOCUMENT_INDEXES_LIST_REQUEST_STATUS] The current status of the document index
116
+ # - `ACTIVE` - Active
117
+ # - `ARCHIVED` - Archived
118
+ # @param request_options [RequestOptions]
119
+ # @return [PaginatedDocumentIndexReadList]
120
+ def list(limit: nil, offset: nil, ordering: nil, status: nil, request_options: nil)
121
+ Async do
122
+ response = @request_client.conn.get do |req|
123
+ req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
124
+ req.headers["X_API_KEY"] = request_options.api_key unless request_options&.api_key.nil?
125
+ req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
126
+ req.params = {
127
+ **(request_options&.additional_query_parameters || {}),
128
+ "limit": limit,
129
+ "offset": offset,
130
+ "ordering": ordering,
131
+ "status": status
132
+ }.compact
133
+ req.url "#{@request_client.default_environment[:Default]}/v1/document-indexes"
134
+ end
135
+ PaginatedDocumentIndexReadList.from_json(json_object: response.body)
136
+ end
137
+ end
138
+
81
139
  # Creates a new document index.
82
140
  #
83
141
  # @param label [String] A human-readable label for the document index
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Vellum
4
+ module DocumentIndexes
5
+ # @type [DOCUMENT_INDEXES_LIST_REQUEST_STATUS]
6
+ DOCUMENT_INDEXES_LIST_REQUEST_STATUS = { active: "ACTIVE", archived: "ARCHIVED" }.freeze
7
+ end
8
+ end
@@ -6,20 +6,23 @@ require "json"
6
6
 
7
7
  module Vellum
8
8
  class ChatMessage
9
- attr_reader :text, :role, :content, :additional_properties
9
+ attr_reader :text, :role, :content, :source, :additional_properties
10
10
 
11
11
  # @param text [String]
12
12
  # @param role [CHAT_MESSAGE_ROLE]
13
13
  # @param content [ChatMessageContent]
14
+ # @param source [String] An optional identifier representing who or what generated this message.
14
15
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
16
  # @return [ChatMessage]
16
- def initialize(role:, text: nil, content: nil, additional_properties: nil)
17
+ def initialize(role:, text: nil, content: nil, source: nil, additional_properties: nil)
17
18
  # @type [String]
18
19
  @text = text
19
20
  # @type [CHAT_MESSAGE_ROLE]
20
21
  @role = role
21
22
  # @type [ChatMessageContent]
22
23
  @content = content
24
+ # @type [String] An optional identifier representing who or what generated this message.
25
+ @source = source
23
26
  # @type [OpenStruct] Additional properties unmapped to the current class definition
24
27
  @additional_properties = additional_properties
25
28
  end
@@ -39,14 +42,15 @@ module Vellum
39
42
  content = parsed_json["content"].to_json
40
43
  content = ChatMessageContent.from_json(json_object: content)
41
44
  end
42
- new(text: text, role: role, content: content, additional_properties: struct)
45
+ source = struct.source
46
+ new(text: text, role: role, content: content, source: source, additional_properties: struct)
43
47
  end
44
48
 
45
49
  # Serialize an instance of ChatMessage to a JSON object
46
50
  #
47
51
  # @return [JSON]
48
52
  def to_json(*_args)
49
- { "text": @text, "role": CHAT_MESSAGE_ROLE[@role] || @role, "content": @content }.to_json
53
+ { "text": @text, "role": CHAT_MESSAGE_ROLE[@role] || @role, "content": @content, "source": @source }.to_json
50
54
  end
51
55
 
52
56
  # 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.
@@ -57,6 +61,7 @@ module Vellum
57
61
  obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
58
62
  obj.role.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
59
63
  obj.content.nil? || ChatMessageContent.validate_raw(obj: obj.content)
64
+ obj.source&.is_a?(String) != false || raise("Passed value for field obj.source is not the expected type, validation failed.")
60
65
  end
61
66
  end
62
67
  end
@@ -6,20 +6,23 @@ require "json"
6
6
 
7
7
  module Vellum
8
8
  class ChatMessageRequest
9
- attr_reader :text, :role, :content, :additional_properties
9
+ attr_reader :text, :role, :content, :source, :additional_properties
10
10
 
11
11
  # @param text [String]
12
12
  # @param role [CHAT_MESSAGE_ROLE]
13
13
  # @param content [ChatMessageContentRequest]
14
+ # @param source [String] An optional identifier representing who or what generated this message.
14
15
  # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
15
16
  # @return [ChatMessageRequest]
16
- def initialize(role:, text: nil, content: nil, additional_properties: nil)
17
+ def initialize(role:, text: nil, content: nil, source: nil, additional_properties: nil)
17
18
  # @type [String]
18
19
  @text = text
19
20
  # @type [CHAT_MESSAGE_ROLE]
20
21
  @role = role
21
22
  # @type [ChatMessageContentRequest]
22
23
  @content = content
24
+ # @type [String] An optional identifier representing who or what generated this message.
25
+ @source = source
23
26
  # @type [OpenStruct] Additional properties unmapped to the current class definition
24
27
  @additional_properties = additional_properties
25
28
  end
@@ -39,14 +42,15 @@ module Vellum
39
42
  content = parsed_json["content"].to_json
40
43
  content = ChatMessageContentRequest.from_json(json_object: content)
41
44
  end
42
- new(text: text, role: role, content: content, additional_properties: struct)
45
+ source = struct.source
46
+ new(text: text, role: role, content: content, source: source, additional_properties: struct)
43
47
  end
44
48
 
45
49
  # Serialize an instance of ChatMessageRequest to a JSON object
46
50
  #
47
51
  # @return [JSON]
48
52
  def to_json(*_args)
49
- { "text": @text, "role": CHAT_MESSAGE_ROLE[@role] || @role, "content": @content }.to_json
53
+ { "text": @text, "role": CHAT_MESSAGE_ROLE[@role] || @role, "content": @content, "source": @source }.to_json
50
54
  end
51
55
 
52
56
  # 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.
@@ -57,6 +61,7 @@ module Vellum
57
61
  obj.text&.is_a?(String) != false || raise("Passed value for field obj.text is not the expected type, validation failed.")
58
62
  obj.role.is_a?(CHAT_MESSAGE_ROLE) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
59
63
  obj.content.nil? || ChatMessageContentRequest.validate_raw(obj: obj.content)
64
+ obj.source&.is_a?(String) != false || raise("Passed value for field obj.source is not the expected type, validation failed.")
60
65
  end
61
66
  end
62
67
  end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "array_variable_value_item"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionArrayVellumValue
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<ArrayVariableValueItem>]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionArrayVellumValue]
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<ArrayVariableValueItem>]
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 ExecutionArrayVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionArrayVellumValue]
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
+ ArrayVariableValueItem.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 ExecutionArrayVellumValue 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,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "chat_message"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionChatHistoryVellumValue
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<ChatMessage>]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionChatHistoryVellumValue]
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<ChatMessage>]
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 ExecutionChatHistoryVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionChatHistoryVellumValue]
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
+ ChatMessage.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 ExecutionChatHistoryVellumValue 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,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "vellum_error"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionErrorVellumValue
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 [VellumError]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionErrorVellumValue]
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 [VellumError]
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 ExecutionErrorVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionErrorVellumValue]
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
+ if parsed_json["value"].nil?
36
+ value = nil
37
+ else
38
+ value = parsed_json["value"].to_json
39
+ value = VellumError.from_json(json_object: value)
40
+ end
41
+ new(id: id, name: name, value: value, additional_properties: struct)
42
+ end
43
+
44
+ # Serialize an instance of ExecutionErrorVellumValue to a JSON object
45
+ #
46
+ # @return [JSON]
47
+ def to_json(*_args)
48
+ { "id": @id, "name": @name, "value": @value }.to_json
49
+ end
50
+
51
+ # 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.
52
+ #
53
+ # @param obj [Object]
54
+ # @return [Void]
55
+ def self.validate_raw(obj:)
56
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
57
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
58
+ obj.value.nil? || VellumError.validate_raw(obj: obj.value)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,61 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "function_call"
4
+ require "json"
5
+
6
+ module Vellum
7
+ class ExecutionFunctionCallVellumValue
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 [FunctionCall]
13
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
14
+ # @return [ExecutionFunctionCallVellumValue]
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 [FunctionCall]
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 ExecutionFunctionCallVellumValue
27
+ #
28
+ # @param json_object [JSON]
29
+ # @return [ExecutionFunctionCallVellumValue]
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
+ if parsed_json["value"].nil?
36
+ value = nil
37
+ else
38
+ value = parsed_json["value"].to_json
39
+ value = FunctionCall.from_json(json_object: value)
40
+ end
41
+ new(id: id, name: name, value: value, additional_properties: struct)
42
+ end
43
+
44
+ # Serialize an instance of ExecutionFunctionCallVellumValue to a JSON object
45
+ #
46
+ # @return [JSON]
47
+ def to_json(*_args)
48
+ { "id": @id, "name": @name, "value": @value }.to_json
49
+ end
50
+
51
+ # 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.
52
+ #
53
+ # @param obj [Object]
54
+ # @return [Void]
55
+ def self.validate_raw(obj:)
56
+ obj.id.is_a?(String) != false || raise("Passed value for field obj.id is not the expected type, validation failed.")
57
+ obj.name.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
58
+ obj.value.nil? || FunctionCall.validate_raw(obj: obj.value)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ class ExecutionJsonVellumValue
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 [Hash{String => String}]
12
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
13
+ # @return [ExecutionJsonVellumValue]
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 [Hash{String => 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 ExecutionJsonVellumValue
26
+ #
27
+ # @param json_object [JSON]
28
+ # @return [ExecutionJsonVellumValue]
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 ExecutionJsonVellumValue 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?(Hash) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module Vellum
6
+ class ExecutionNumberVellumValue
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 [Float]
12
+ # @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
13
+ # @return [ExecutionNumberVellumValue]
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 [Float]
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 ExecutionNumberVellumValue
26
+ #
27
+ # @param json_object [JSON]
28
+ # @return [ExecutionNumberVellumValue]
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 ExecutionNumberVellumValue 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?(Float) != false || raise("Passed value for field obj.value is not the expected type, validation failed.")
53
+ end
54
+ end
55
+ end