vellum-ai 0.14.11__py3-none-any.whl → 0.14.12__py3-none-any.whl

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.
@@ -18,7 +18,7 @@ class BaseClientWrapper:
18
18
  headers: typing.Dict[str, str] = {
19
19
  "X-Fern-Language": "Python",
20
20
  "X-Fern-SDK-Name": "vellum-ai",
21
- "X-Fern-SDK-Version": "0.14.11",
21
+ "X-Fern-SDK-Version": "0.14.12",
22
22
  }
23
23
  headers["X_API_KEY"] = self.api_key
24
24
  return headers
@@ -70,8 +70,10 @@ class SubworkflowDeploymentNode(BaseNode[StateType], Generic[StateType]):
70
70
  value=input_value,
71
71
  )
72
72
  )
73
- elif isinstance(input_value, list) and all(
74
- isinstance(message, (ChatMessage, ChatMessageRequest)) for message in input_value
73
+ elif (
74
+ isinstance(input_value, list)
75
+ and len(input_value) > 0
76
+ and all(isinstance(message, (ChatMessage, ChatMessageRequest)) for message in input_value)
75
77
  ):
76
78
  chat_history = [
77
79
  (
@@ -95,7 +97,7 @@ class SubworkflowDeploymentNode(BaseNode[StateType], Generic[StateType]):
95
97
  value=cast(Dict[str, Any], input_value),
96
98
  )
97
99
  )
98
- elif isinstance(input_value, float):
100
+ elif isinstance(input_value, (int, float)):
99
101
  compiled_inputs.append(
100
102
  WorkflowRequestNumberInputRequest(
101
103
  name=input_name,
@@ -110,7 +112,6 @@ class SubworkflowDeploymentNode(BaseNode[StateType], Generic[StateType]):
110
112
  message=f"Failed to serialize input '{input_name}' of type '{input_value.__class__}': {e}",
111
113
  code=WorkflowErrorCode.INVALID_INPUTS,
112
114
  )
113
-
114
115
  compiled_inputs.append(
115
116
  WorkflowRequestJsonInputRequest(
116
117
  name=input_name,
@@ -10,6 +10,7 @@ from vellum.client.types.workflow_execution_workflow_result_event import Workflo
10
10
  from vellum.client.types.workflow_output_string import WorkflowOutputString
11
11
  from vellum.client.types.workflow_request_chat_history_input_request import WorkflowRequestChatHistoryInputRequest
12
12
  from vellum.client.types.workflow_request_json_input_request import WorkflowRequestJsonInputRequest
13
+ from vellum.client.types.workflow_request_number_input_request import WorkflowRequestNumberInputRequest
13
14
  from vellum.client.types.workflow_result_event import WorkflowResultEvent
14
15
  from vellum.client.types.workflow_stream_event import WorkflowStreamEvent
15
16
  from vellum.workflows.errors import WorkflowErrorCode
@@ -134,6 +135,116 @@ def test_run_workflow__any_array(vellum_client):
134
135
  ]
135
136
 
136
137
 
138
+ def test_run_workflow__empty_array(vellum_client):
139
+ # GIVEN a Subworkflow Deployment Node
140
+ class ExampleSubworkflowDeploymentNode(SubworkflowDeploymentNode):
141
+ deployment = "example_subworkflow_deployment"
142
+ subworkflow_inputs = {
143
+ "fruits": [],
144
+ }
145
+
146
+ # AND we know what the Subworkflow Deployment will respond with
147
+ def generate_subworkflow_events(*args: Any, **kwargs: Any) -> Iterator[WorkflowStreamEvent]:
148
+ execution_id = str(uuid4())
149
+ expected_events: List[WorkflowStreamEvent] = [
150
+ WorkflowExecutionWorkflowResultEvent(
151
+ execution_id=execution_id,
152
+ data=WorkflowResultEvent(
153
+ id=str(uuid4()),
154
+ state="INITIATED",
155
+ ts=datetime.now(),
156
+ ),
157
+ ),
158
+ WorkflowExecutionWorkflowResultEvent(
159
+ execution_id=execution_id,
160
+ data=WorkflowResultEvent(
161
+ id=str(uuid4()),
162
+ state="FULFILLED",
163
+ ts=datetime.now(),
164
+ outputs=[
165
+ WorkflowOutputString(
166
+ id=str(uuid4()),
167
+ name="greeting",
168
+ value="Great!",
169
+ )
170
+ ],
171
+ ),
172
+ ),
173
+ ]
174
+ yield from expected_events
175
+
176
+ vellum_client.execute_workflow_stream.side_effect = generate_subworkflow_events
177
+
178
+ # WHEN we run the node
179
+ node = ExampleSubworkflowDeploymentNode()
180
+ events = list(node.run())
181
+
182
+ # THEN the node should have completed successfully
183
+ assert events[-1].name == "greeting"
184
+ assert events[-1].value == "Great!"
185
+
186
+ # AND we should have invoked the Subworkflow Deployment with the expected inputs
187
+ call_kwargs = vellum_client.execute_workflow_stream.call_args.kwargs
188
+ assert call_kwargs["inputs"] == [
189
+ WorkflowRequestJsonInputRequest(name="fruits", value=[]),
190
+ ]
191
+
192
+
193
+ def test_run_workflow__int_input(vellum_client):
194
+ # GIVEN a Subworkflow Deployment Node
195
+ class ExampleSubworkflowDeploymentNode(SubworkflowDeploymentNode):
196
+ deployment = "example_subworkflow_deployment"
197
+ subworkflow_inputs = {
198
+ "number": 42,
199
+ }
200
+
201
+ # AND we know what the Subworkflow Deployment will respond with
202
+ def generate_subworkflow_events(*args: Any, **kwargs: Any) -> Iterator[WorkflowStreamEvent]:
203
+ execution_id = str(uuid4())
204
+ expected_events: List[WorkflowStreamEvent] = [
205
+ WorkflowExecutionWorkflowResultEvent(
206
+ execution_id=execution_id,
207
+ data=WorkflowResultEvent(
208
+ id=str(uuid4()),
209
+ state="INITIATED",
210
+ ts=datetime.now(),
211
+ ),
212
+ ),
213
+ WorkflowExecutionWorkflowResultEvent(
214
+ execution_id=execution_id,
215
+ data=WorkflowResultEvent(
216
+ id=str(uuid4()),
217
+ state="FULFILLED",
218
+ ts=datetime.now(),
219
+ outputs=[
220
+ WorkflowOutputString(
221
+ id=str(uuid4()),
222
+ name="greeting",
223
+ value="Great!",
224
+ )
225
+ ],
226
+ ),
227
+ ),
228
+ ]
229
+ yield from expected_events
230
+
231
+ vellum_client.execute_workflow_stream.side_effect = generate_subworkflow_events
232
+
233
+ # WHEN we run the node
234
+ node = ExampleSubworkflowDeploymentNode()
235
+ events = list(node.run())
236
+
237
+ # THEN the node should have completed successfully
238
+ assert events[-1].name == "greeting"
239
+ assert events[-1].value == "Great!"
240
+
241
+ # AND we should have invoked the Subworkflow Deployment with the expected inputs
242
+ call_kwargs = vellum_client.execute_workflow_stream.call_args.kwargs
243
+ assert call_kwargs["inputs"] == [
244
+ WorkflowRequestNumberInputRequest(name="number", value=42),
245
+ ]
246
+
247
+
137
248
  def test_run_workflow__no_deployment():
138
249
  """Confirm that we raise error when running a subworkflow deployment node with no deployment attribute set"""
139
250
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vellum-ai
3
- Version: 0.14.11
3
+ Version: 0.14.12
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.9,<4.0
@@ -32,7 +32,7 @@ Requires-Dist: pydantic (>=1.9.2)
32
32
  Requires-Dist: pydantic-core (>=2.18.2,<3.0.0)
33
33
  Requires-Dist: pydash (==7.0.6)
34
34
  Requires-Dist: python-dotenv (==1.0.1)
35
- Requires-Dist: pytz (==2022.6)
35
+ Requires-Dist: pytz (==2025.1)
36
36
  Requires-Dist: pyyaml (==6.0.1)
37
37
  Requires-Dist: requests (==2.32.3)
38
38
  Requires-Dist: tomli (==2.0.2)
@@ -123,7 +123,7 @@ vellum/client/README.md,sha256=JkCJjmMZl4jrPj46pkmL9dpK4gSzQQmP5I7z4aME4LY,4749
123
123
  vellum/client/__init__.py,sha256=tKtdM1_GqmGq1gpi9ydWD_T-MM7fPn8QdHh8ww19cNI,117564
124
124
  vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
125
125
  vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
126
- vellum/client/core/client_wrapper.py,sha256=l2ugjFyqT9acEpOr6jNbb_P6uA6RL_Y5IP-FTsOd_uQ,1869
126
+ vellum/client/core/client_wrapper.py,sha256=MP_Nnw3gVGA7BJKaD9TBDDwVxta-T1ASzBcOv7dF4nU,1869
127
127
  vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
128
128
  vellum/client/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
129
129
  vellum/client/core/http_client.py,sha256=R0pQpCppnEtxccGvXl4uJ76s7ro_65Fo_erlNNLp_AI,19228
@@ -1439,9 +1439,9 @@ vellum/workflows/nodes/displayable/search_node/node.py,sha256=_VHHuTNN4icZBgc7O5
1439
1439
  vellum/workflows/nodes/displayable/search_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1440
1440
  vellum/workflows/nodes/displayable/search_node/tests/test_node.py,sha256=2-QCV7Vk_-YMls33p0GOUtCv3f2uPNZCjkB2CRjek7o,6562
1441
1441
  vellum/workflows/nodes/displayable/subworkflow_deployment_node/__init__.py,sha256=9yYM6001YZeqI1VOk1QuEM_yrffk_EdsO7qaPzINKds,92
1442
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py,sha256=epzcTald7En5vcIunCBXPT2t21FfR6V154rvGutkbLA,9596
1442
+ vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py,sha256=DGjvfusXCH5F98oPT3S6Xn0yedLuCq6EXb2DTzu2oDM,9661
1443
1443
  vellum/workflows/nodes/displayable/subworkflow_deployment_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1444
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/tests/test_node.py,sha256=Eo66jE2eHGD94U0XEfhpvGNG9kFDOBADQ1_5-1EFmIc,11735
1444
+ vellum/workflows/nodes/displayable/subworkflow_deployment_node/tests/test_node.py,sha256=7Yt8rmN7xoZ91BrcA1pDGwG_t0NYtym4ORXrAIIX-P0,15861
1445
1445
  vellum/workflows/nodes/displayable/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1446
1446
  vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py,sha256=LaxohBcKfSW2PSiBBlx67FdW_q4YC2BM2ouH-vuGPAA,4700
1447
1447
  vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py,sha256=VepO5z1277c1y5N6LLIC31nnWD1aak2m5oPFplfJHHs,6935
@@ -1509,8 +1509,8 @@ vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnad
1509
1509
  vellum/workflows/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1510
1510
  vellum/workflows/workflows/tests/test_base_workflow.py,sha256=NRteiICyJvDM5zrtUfq2fZoXcGQVaWC9xmNlLLVW0cU,7979
1511
1511
  vellum/workflows/workflows/tests/test_context.py,sha256=VJBUcyWVtMa_lE5KxdhgMu0WYNYnUQUDvTF7qm89hJ0,2333
1512
- vellum_ai-0.14.11.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1513
- vellum_ai-0.14.11.dist-info/METADATA,sha256=584bKGEOfx24lR-N0_BdsuLUo5G-nDYN2-hXxKWGCNg,5408
1514
- vellum_ai-0.14.11.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1515
- vellum_ai-0.14.11.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1516
- vellum_ai-0.14.11.dist-info/RECORD,,
1512
+ vellum_ai-0.14.12.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1513
+ vellum_ai-0.14.12.dist-info/METADATA,sha256=1EKavjMZSN9SKB-BwKDVMb4xfc-TnvoUWiYD7JMCqLk,5408
1514
+ vellum_ai-0.14.12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1515
+ vellum_ai-0.14.12.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1516
+ vellum_ai-0.14.12.dist-info/RECORD,,