vellum-ai 0.10.8__py3-none-any.whl → 0.10.9__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,6 +4,8 @@ import importlib
4
4
  import inspect
5
5
 
6
6
  from vellum.plugins.utils import load_runtime_plugins
7
+ from vellum.workflows.events.types import CodeResourceDefinition
8
+ from vellum.workflows.workflows.event_filters import workflow_event_filter
7
9
 
8
10
  load_runtime_plugins()
9
11
 
@@ -13,6 +15,7 @@ from threading import Event as ThreadingEvent
13
15
  from uuid import uuid4
14
16
  from typing import (
15
17
  Any,
18
+ Callable,
16
19
  ClassVar,
17
20
  Dict,
18
21
  Generator,
@@ -47,7 +50,6 @@ from vellum.workflows.events.node import (
47
50
  NodeExecutionStreamingBody,
48
51
  NodeExecutionStreamingEvent,
49
52
  )
50
- from vellum.workflows.events.types import WorkflowEventType
51
53
  from vellum.workflows.events.workflow import (
52
54
  GenericWorkflowEvent,
53
55
  WorkflowExecutionFulfilledBody,
@@ -116,7 +118,9 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
116
118
  ):
117
119
  self._parent_state = parent_state
118
120
  self.emitters = emitters or (self.emitters if hasattr(self, "emitters") else [])
119
- self.resolvers = resolvers or (self.resolvers if hasattr(self, "resolvers") else [])
121
+ self.resolvers = resolvers or (
122
+ self.resolvers if hasattr(self, "resolvers") else []
123
+ )
120
124
  self._context = context or WorkflowContext()
121
125
  self._store = Store()
122
126
 
@@ -133,7 +137,8 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
133
137
  return [original_graph]
134
138
  if isinstance(original_graph, set):
135
139
  return [
136
- subgraph if isinstance(subgraph, Graph) else Graph.from_node(subgraph) for subgraph in original_graph
140
+ subgraph if isinstance(subgraph, Graph) else Graph.from_node(subgraph)
141
+ for subgraph in original_graph
137
142
  ]
138
143
  if issubclass(original_graph, BaseNode):
139
144
  return [Graph.from_node(original_graph)]
@@ -188,11 +193,17 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
188
193
  entrypoint_nodes=entrypoint_nodes,
189
194
  external_inputs=external_inputs,
190
195
  cancel_signal=cancel_signal,
196
+ parent_context=self._context.parent_context,
191
197
  ).stream()
192
- first_event: Optional[Union[WorkflowExecutionInitiatedEvent, WorkflowExecutionResumedEvent]] = None
198
+ first_event: Optional[
199
+ Union[WorkflowExecutionInitiatedEvent, WorkflowExecutionResumedEvent]
200
+ ] = None
193
201
  last_event = None
194
202
  for event in events:
195
- if event.name == "workflow.execution.initiated" or event.name == "workflow.execution.resumed":
203
+ if (
204
+ event.name == "workflow.execution.initiated"
205
+ or event.name == "workflow.execution.resumed"
206
+ ):
196
207
  first_event = event
197
208
  last_event = event
198
209
 
@@ -201,7 +212,10 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
201
212
  trace_id=uuid4(),
202
213
  span_id=uuid4(),
203
214
  body=WorkflowExecutionRejectedBody(
204
- error=VellumError(code=VellumErrorCode.INTERNAL_ERROR, message="No events were emitted"),
215
+ error=VellumError(
216
+ code=VellumErrorCode.INTERNAL_ERROR,
217
+ message="No events were emitted",
218
+ ),
205
219
  workflow_definition=self.__class__,
206
220
  ),
207
221
  )
@@ -212,7 +226,8 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
212
226
  span_id=uuid4(),
213
227
  body=WorkflowExecutionRejectedBody(
214
228
  error=VellumError(
215
- code=VellumErrorCode.INTERNAL_ERROR, message="Initiated event was never emitted"
229
+ code=VellumErrorCode.INTERNAL_ERROR,
230
+ message="Initiated event was never emitted",
216
231
  ),
217
232
  workflow_definition=self.__class__,
218
233
  ),
@@ -239,14 +254,16 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
239
254
 
240
255
  def stream(
241
256
  self,
242
- event_types: Optional[Set[WorkflowEventType]] = None,
257
+ event_filter: Optional[
258
+ Callable[[Type["BaseWorkflow"], WorkflowEvent], bool]
259
+ ] = None,
243
260
  inputs: Optional[WorkflowInputsType] = None,
244
261
  state: Optional[StateType] = None,
245
262
  entrypoint_nodes: Optional[RunFromNodeArg] = None,
246
263
  external_inputs: Optional[ExternalInputsArg] = None,
247
264
  cancel_signal: Optional[ThreadingEvent] = None,
248
265
  ) -> WorkflowEventStream:
249
- event_types = event_types or {WorkflowEventType.WORKFLOW}
266
+ should_yield = event_filter or workflow_event_filter
250
267
  for event in WorkflowRunner(
251
268
  self,
252
269
  inputs=inputs,
@@ -254,8 +271,9 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
254
271
  entrypoint_nodes=entrypoint_nodes,
255
272
  external_inputs=external_inputs,
256
273
  cancel_signal=cancel_signal,
274
+ parent_context=self.context.parent_context,
257
275
  ).stream():
258
- if WorkflowEventType(event.name.split(".")[0].upper()) in event_types:
276
+ if should_yield(self.__class__, event):
259
277
  yield event
260
278
 
261
279
  def validate(self) -> None:
@@ -268,7 +286,9 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
268
286
 
269
287
  @classmethod
270
288
  @lru_cache
271
- def _get_parameterized_classes(cls) -> Tuple[Type[WorkflowInputsType], Type[StateType]]:
289
+ def _get_parameterized_classes(
290
+ cls,
291
+ ) -> Tuple[Type[WorkflowInputsType], Type[StateType]]:
272
292
  original_base = get_original_base(cls)
273
293
 
274
294
  inputs_type, state_type = get_args(original_base)
@@ -279,10 +299,14 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
279
299
  state_type = BaseState
280
300
 
281
301
  if not issubclass(inputs_type, BaseInputs):
282
- raise ValueError(f"Expected first type to be a subclass of BaseInputs, was: {inputs_type}")
302
+ raise ValueError(
303
+ f"Expected first type to be a subclass of BaseInputs, was: {inputs_type}"
304
+ )
283
305
 
284
306
  if not issubclass(state_type, BaseState):
285
- raise ValueError(f"Expected second type to be a subclass of BaseState, was: {state_type}")
307
+ raise ValueError(
308
+ f"Expected second type to be a subclass of BaseState, was: {state_type}"
309
+ )
286
310
 
287
311
  return (inputs_type, state_type)
288
312
 
@@ -297,15 +321,23 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
297
321
  def get_default_inputs(self) -> WorkflowInputsType:
298
322
  return self.get_inputs_class()()
299
323
 
300
- def get_default_state(self, workflow_inputs: Optional[WorkflowInputsType] = None) -> StateType:
324
+ def get_default_state(
325
+ self, workflow_inputs: Optional[WorkflowInputsType] = None
326
+ ) -> StateType:
301
327
  return self.get_state_class()(
302
- meta=StateMeta(parent=self._parent_state, workflow_inputs=workflow_inputs or self.get_default_inputs())
328
+ meta=StateMeta(
329
+ parent=self._parent_state,
330
+ workflow_inputs=workflow_inputs or self.get_default_inputs(),
331
+ )
303
332
  )
304
333
 
305
334
  def get_state_at_node(self, node: Type[BaseNode]) -> StateType:
306
335
  event_ts = datetime.min
307
336
  for event in self._store.events:
308
- if event.name == "node.execution.initiated" and event.node_definition == node:
337
+ if (
338
+ event.name == "node.execution.initiated"
339
+ and event.node_definition == node
340
+ ):
309
341
  event_ts = event.timestamp
310
342
 
311
343
  most_recent_state_snapshot: Optional[StateType] = None
@@ -327,7 +359,9 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
327
359
  next_state = cast(StateType, snapshot)
328
360
  if not most_recent_state_snapshot:
329
361
  most_recent_state_snapshot = next_state
330
- elif next_state.meta.updated_ts >= most_recent_state_snapshot.meta.updated_ts:
362
+ elif (
363
+ next_state.meta.updated_ts >= most_recent_state_snapshot.meta.updated_ts
364
+ ):
331
365
  most_recent_state_snapshot = next_state
332
366
 
333
367
  if not most_recent_state_snapshot:
@@ -0,0 +1,61 @@
1
+ from typing import TYPE_CHECKING, Type
2
+
3
+ from vellum.workflows.events.types import CodeResourceDefinition
4
+
5
+ if TYPE_CHECKING:
6
+ from vellum.workflows.events.workflow import WorkflowEvent
7
+ from vellum.workflows.workflows.base import BaseWorkflow
8
+
9
+
10
+ def workflow_event_filter(
11
+ workflow_definition: Type["BaseWorkflow"], event: "WorkflowEvent"
12
+ ) -> bool:
13
+ """
14
+ Filters for only Workflow events that were emitted by the `workflow_definition` parameter.
15
+ """
16
+
17
+ if (
18
+ event.name == "workflow.execution.initiated"
19
+ or event.name == "workflow.execution.resumed"
20
+ or event.name == "workflow.execution.fulfilled"
21
+ or event.name == "workflow.execution.rejected"
22
+ or event.name == "workflow.execution.paused"
23
+ or event.name == "workflow.execution.streaming"
24
+ ):
25
+ return event.workflow_definition == workflow_definition
26
+
27
+ return False
28
+
29
+
30
+ def root_workflow_event_filter(
31
+ workflow_definition: Type["BaseWorkflow"], event: "WorkflowEvent"
32
+ ) -> bool:
33
+ """
34
+ Filters for Workflow and Node events that were emitted by the `workflow_definition` parameter.
35
+ """
36
+
37
+ if (
38
+ event.name == "workflow.execution.initiated"
39
+ or event.name == "workflow.execution.resumed"
40
+ or event.name == "workflow.execution.fulfilled"
41
+ or event.name == "workflow.execution.rejected"
42
+ or event.name == "workflow.execution.paused"
43
+ or event.name == "workflow.execution.streaming"
44
+ ):
45
+ return event.workflow_definition == workflow_definition
46
+
47
+ if not event.parent:
48
+ return False
49
+
50
+ if event.parent.type != "WORKFLOW":
51
+ return False
52
+
53
+ return event.parent.workflow_definition == CodeResourceDefinition.encode(
54
+ workflow_definition
55
+ )
56
+
57
+
58
+ def all_workflow_event_filter(
59
+ workflow_definition: Type["BaseWorkflow"], event: "WorkflowEvent"
60
+ ) -> bool:
61
+ return True
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vellum-ai
3
- Version: 0.10.8
3
+ Version: 0.10.9
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.9,<4.0
@@ -22,10 +22,11 @@ vellum_ee/workflows/display/nodes/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
22
22
  vellum_ee/workflows/display/nodes/tests/test_base_node_display.py,sha256=x7UkKR22rnNGjeerHBczZ9_YsK8Us-YFOEbrLylvIxM,1054
23
23
  vellum_ee/workflows/display/nodes/types.py,sha256=St1BB6no528OyELGiyRabWao0GGw6mLhstQAvEACbGk,247
24
24
  vellum_ee/workflows/display/nodes/utils.py,sha256=sloya5TpXsnot1HURc9L51INwflRqUzHxRVnCS9Cd-4,973
25
- vellum_ee/workflows/display/nodes/vellum/__init__.py,sha256=jQgm0dsQAlxZ0tYR_cv5pX-6wHMPQfFwmhI3DQ29S9Y,1432
25
+ vellum_ee/workflows/display/nodes/vellum/__init__.py,sha256=BsGmoaVRcJ_dIiowKx6fFpehehmZO39G_Or7zvtjSAo,1504
26
26
  vellum_ee/workflows/display/nodes/vellum/api_node.py,sha256=awjKut2m7HoEmqewRfdR1dw8ufA0Q5mVG8V8jhaHlKw,8572
27
27
  vellum_ee/workflows/display/nodes/vellum/code_execution_node.py,sha256=MASV7u0X4eiS3SzRWeBcbWZ_YgNlwwg5cM2vaFWjpqk,3915
28
28
  vellum_ee/workflows/display/nodes/vellum/conditional_node.py,sha256=v9g263oEtyL6ejp5ZfLrVfrcqU9gZwzuUI4yBuOScbI,12983
29
+ vellum_ee/workflows/display/nodes/vellum/error_node.py,sha256=88ivEIHOHNITLAwuHQcCZ_4Mt4oUcPzs0vnwRweODcg,2136
29
30
  vellum_ee/workflows/display/nodes/vellum/final_output_node.py,sha256=2HsghUtPBOQ-4sN-2jDOnbEuIwcsilDKO3f2o1WlYgw,2897
30
31
  vellum_ee/workflows/display/nodes/vellum/guardrail_node.py,sha256=lr4d2uV3Lq8d22b5LCKbWMz_nU7Q0fvffcNQ7zx5Ygc,2163
31
32
  vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py,sha256=0lX14iOxZhdKSXE6mzBAIw480nNJD_Sz4qo7WZAXYfQ,7391
@@ -46,6 +47,7 @@ vellum_ee/workflows/display/tests/workflow_serialization/__init__.py,sha256=47DE
46
47
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py,sha256=bLdJ0VVwAPDRvwaJMiMf0fRCuIWvvuRjAxKzddGPFyA,16871
47
48
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py,sha256=0McMPIPnIwE8iGh7fzFZL3dc6Q7NCQ_wUVFpl14YATo,22846
48
49
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py,sha256=AOM1lN7_Y1wmorBpyF6Z2VVgrPUiFaePaGjauDluAsc,54187
50
+ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py,sha256=JV9TYz9BPVojWQ8ypGLsSfl9LdntDcxlm9OilP4qv6o,6874
49
51
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py,sha256=IfO5Hmr1W41X2IVq-i6pG7BuevBPZU_s6ASTNVVVkdg,8298
50
52
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py,sha256=c97A2tFWnNUXi3T4RLsvf3nZkUTPiGSC6XD_x1-ZK_U,22270
51
53
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py,sha256=Bx6tpFoW_7KrlsuzeEgXgQxa6CHJsQKwFZjilJsTivg,15451
@@ -71,7 +73,7 @@ vellum/client/README.md,sha256=JkCJjmMZl4jrPj46pkmL9dpK4gSzQQmP5I7z4aME4LY,4749
71
73
  vellum/client/__init__.py,sha256=o4m7iRZWEV8rP3GkdaztHAjNmjxjWERlarviFoHzuKI,110927
72
74
  vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
73
75
  vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
74
- vellum/client/core/client_wrapper.py,sha256=-M3uhAr1iTDcPBsJsI4SD1DfT1LMZ1qdWYe2eEbN-N4,1890
76
+ vellum/client/core/client_wrapper.py,sha256=5Xcwu40B3NhlBCsQsIOUhnY8Fb2-Vz6T9wqGP6Cei34,1890
75
77
  vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
76
78
  vellum/client/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
77
79
  vellum/client/core/http_client.py,sha256=R0pQpCppnEtxccGvXl4uJ76s7ro_65Fo_erlNNLp_AI,19228
@@ -305,7 +307,7 @@ vellum/client/types/json_input_request.py,sha256=x5sA-VXxF4QH-98xRcIKPZhsMVbnJNU
305
307
  vellum/client/types/json_variable_value.py,sha256=X7eBEWxuozfvIdqD5sIZ5L-L77Ou6IIsZaQVNXh5G2k,634
306
308
  vellum/client/types/json_vellum_value.py,sha256=8irlw6NkRRVafysfTc1Q5BFFhRrWJYzdwrDYTdJK4JY,689
307
309
  vellum/client/types/json_vellum_value_request.py,sha256=IUlkdwFGgBeLl9sCmAJhoaxomWiEMpWgRcLa_WnlK8g,696
308
- vellum/client/types/logical_operator.py,sha256=D8Chij23T00hdFAC4VUU0BcAPkLmx8SxwvxsEFYo918,524
310
+ vellum/client/types/logical_operator.py,sha256=a3a-5tP9vkZWqz2NqccZuJfB3R3fVpRnn97ejAbh1jM,567
309
311
  vellum/client/types/logprobs_enum.py,sha256=D_458cZX2CAb6dX_ovrQ6HARlJkYcZRadKwsi1Cr-JM,151
310
312
  vellum/client/types/map_node_result.py,sha256=e2YqEP-aKig2TbbZIlfn5LCeVEVhEJJBR7o7xTBKXaY,752
311
313
  vellum/client/types/map_node_result_data.py,sha256=3xJXC1JrS9lo3-3_u1S79sYwLxMknNntDyspN24vQzY,699
@@ -1181,7 +1183,7 @@ vellum/workflows/constants.py,sha256=Z0W4YlqfSlSgWC11PrVUPs6ZOBeIaQ78E_90J1hohiw
1181
1183
  vellum/workflows/descriptors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1182
1184
  vellum/workflows/descriptors/base.py,sha256=VyyXtGJ_Hc34AOC8XC_Rw_68L4WMgD5w9Y7r8t8My4E,13814
1183
1185
  vellum/workflows/descriptors/tests/test_utils.py,sha256=icwW-YkHD5oR6rn9IH6Rck9yYOsuwnocyJVHoeJFd74,2849
1184
- vellum/workflows/descriptors/utils.py,sha256=StqMFQzeeWS70ODqKOwwDucr3PUGl2XOr6C0sERLv8M,2990
1186
+ vellum/workflows/descriptors/utils.py,sha256=lO_dbr5g3PXpHPtVBkdguAK4-1qayZ7RXjl3BgAhrMM,3795
1185
1187
  vellum/workflows/edges/__init__.py,sha256=wSkmAnz9xyi4vZwtDbKxwlplt2skD7n3NsxkvR_pUus,50
1186
1188
  vellum/workflows/edges/edge.py,sha256=N0SnY3gKVuxImPAdCbPMPlHJIXbkQ3fwq_LbJRvVMFc,677
1187
1189
  vellum/workflows/emitters/__init__.py,sha256=YyOgaoLtVW8eFNEWODzCYb0HzL0PoSeNRf4diJ1Y0dk,80
@@ -1190,13 +1192,12 @@ vellum/workflows/environment/__init__.py,sha256=wGHslgSEZ7Octe4C-hNtl84EFelNimgm
1190
1192
  vellum/workflows/environment/environment.py,sha256=IwcVSwA51jW1JTN_MAN22UbeAtZhiAVa_JRV4rmpAAs,219
1191
1193
  vellum/workflows/errors/__init__.py,sha256=BRyo4hKP2ElS4k1YDu8VdY2VhUZjILtHn2sPFf_d7U0,105
1192
1194
  vellum/workflows/errors/types.py,sha256=YQy6na_iBkqxl9GHKOcin44m8DMRG5KP9oLV1Lpal1M,541
1193
- vellum/workflows/events/__init__.py,sha256=vLwQuykMmbv0izdUvsamouRQKbmKX_r9Poo77jd404w,821
1195
+ vellum/workflows/events/__init__.py,sha256=6pxxceJo2dcaRkWtkDAYlUQZ-PHBQSZytIoyuUK48Qw,759
1194
1196
  vellum/workflows/events/node.py,sha256=YQVWrE8LD5IxRTz_e0-0bXMhk3RZ75ZKTvAJZqH8dP0,5270
1195
1197
  vellum/workflows/events/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1196
- vellum/workflows/events/tests/test_event.py,sha256=BbAeTohMdfAdpBea9fbi5nDXX6UQ7xASMv9jNuwOmDU,12704
1197
- vellum/workflows/events/types.py,sha256=9apSwzmjVtuSDxEP2NhF8HbGGOP2BkMaqnOy__YH-oY,2863
1198
- vellum/workflows/events/utils.py,sha256=OwtE8dHOCX01jvLyoS1l18tYQ4ob0YJcUhUorKWLJh0,232
1199
- vellum/workflows/events/workflow.py,sha256=kPjZTh5hzCsSrVKLkXQNwzxhnUp3X4GkFA5veGatGlQ,4353
1198
+ vellum/workflows/events/tests/test_event.py,sha256=IfDAG3CPkLRilWt_guIOCPUZglBgKMlrgdOL0gQo_9Q,12729
1199
+ vellum/workflows/events/types.py,sha256=xM6xzpgbA8lAgc6IXP2oCmfnUZhsRzku14TN3PuM-oc,2868
1200
+ vellum/workflows/events/workflow.py,sha256=5KpBMPyDcXHiiC34DJj4efVYJQtrUX31h0sCRLuzmuc,4601
1200
1201
  vellum/workflows/exceptions.py,sha256=Dc7mxstsaMDRmS91QEOiZCbZ1ZIRacnm0l5lQmC6WkA,401
1201
1202
  vellum/workflows/expressions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1202
1203
  vellum/workflows/expressions/accessor.py,sha256=OFvAHAVABr-k7GceIhtzIurV4OuV_yHft7JPRsq87Es,1472
@@ -1234,7 +1235,7 @@ vellum/workflows/inputs/base.py,sha256=1kMgr0WqCYdWUqgFvgSoAMw2067FAlgwhGXLgbIOr
1234
1235
  vellum/workflows/logging.py,sha256=_a217XogktV4Ncz6xKFz7WfYmZAzkfVRVuC0rWob8ls,437
1235
1236
  vellum/workflows/nodes/__init__.py,sha256=aVdQVv7Y3Ro3JlqXGpxwaU2zrI06plDHD2aumH5WUIs,1157
1236
1237
  vellum/workflows/nodes/bases/__init__.py,sha256=Ll1Ti6t3e_HKtGLsQTHAJevDmfo0QtfgPZUZ9FCRduI,140
1237
- vellum/workflows/nodes/bases/base.py,sha256=2WP30q6OtEK5nA15NljZnyoIPko3fYpf_sStvzNTsrE,13628
1238
+ vellum/workflows/nodes/bases/base.py,sha256=n8OveMW8OakoQ2xhgXrifHB5MfUwOonCi-eVpnIb7yQ,14696
1238
1239
  vellum/workflows/nodes/bases/base_subworkflow_node/__init__.py,sha256=0nkHQiFC4IpA1ZGx60XG0BLUWF6hwUpgqmS3ZrlFGhg,80
1239
1240
  vellum/workflows/nodes/bases/base_subworkflow_node/node.py,sha256=vC0gUBQewAUNtP3i2G0-LUpE_kY-r_ijBD_tS1XkQ1E,383
1240
1241
  vellum/workflows/nodes/bases/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1259,9 +1260,9 @@ vellum/workflows/nodes/core/templating_node/node.py,sha256=uxdOk_vyb5ONoOWG4xMDo
1259
1260
  vellum/workflows/nodes/core/templating_node/render.py,sha256=OpJp0NAH6qcEL6K9lxR0qjpFb75TYNttJR5iCos8tmg,1792
1260
1261
  vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py,sha256=L6F3Gw9doguj1TSKmAns-mzXvoRuRivaCFe3mhjo13E,551
1261
1262
  vellum/workflows/nodes/core/try_node/__init__.py,sha256=JVD4DrldTIqFQQFrubs9KtWCCc0YCAc7Fzol5ZWIWeM,56
1262
- vellum/workflows/nodes/core/try_node/node.py,sha256=ZP7Suh025siA8T4D_1niL_-5lwSHXvY72-cj2x8S2U8,5813
1263
+ vellum/workflows/nodes/core/try_node/node.py,sha256=_mpmppZ6XUr_2zsAfhrsL0wbOhq8Ayipj_q9n52oBbI,6562
1263
1264
  vellum/workflows/nodes/core/try_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1264
- vellum/workflows/nodes/core/try_node/tests/test_node.py,sha256=u06GmVGln5lg-65YYFAmjlKwxuXbP8bKA8Qf_Zbq7ak,3764
1265
+ vellum/workflows/nodes/core/try_node/tests/test_node.py,sha256=NyyCkZGoG2eTzdewCpnnYjjUrRLDF31cGmJBGbvEOIw,4075
1265
1266
  vellum/workflows/nodes/displayable/__init__.py,sha256=6F_4DlSwvHuilWnIalp8iDjjDXl0Nmz4QzJV2PYe5RI,1023
1266
1267
  vellum/workflows/nodes/displayable/api_node/__init__.py,sha256=MoxdQSnidIj1Nf_d-hTxlOxcZXaZnsWFDbE-PkTK24o,56
1267
1268
  vellum/workflows/nodes/displayable/api_node/node.py,sha256=mnoncJtxo5YhuFCR3_axpvCqrGQKLShvfU6xJO7Fa8I,2047
@@ -1325,17 +1326,17 @@ vellum/workflows/references/workflow_input.py,sha256=epspVRZ9n_nxoTxI5Am3GDd2fpU
1325
1326
  vellum/workflows/resolvers/__init__.py,sha256=eH6hTvZO4IciDaf_cf7aM2vs-DkBDyJPycOQevJxQnI,82
1326
1327
  vellum/workflows/resolvers/base.py,sha256=WHra9LRtlTuB1jmuNqkfVE2JUgB61Cyntn8f0b0WZg4,411
1327
1328
  vellum/workflows/runner/__init__.py,sha256=i1iG5sAhtpdsrlvwgH6B-m49JsINkiWyPWs8vyT-bqM,72
1328
- vellum/workflows/runner/runner.py,sha256=zqVjt4r7BuMou5oVFUglMPGshmQitUPfASBvATsfxGk,26770
1329
+ vellum/workflows/runner/runner.py,sha256=EGelAr8bWGjXLBWyjMLJSF55rI0kwdDFuZudprmg8T4,28226
1329
1330
  vellum/workflows/runner/types.py,sha256=UQIGqOuCDgxEQpoJr4ut3wAnAjp4scDWhNhEhYFyLrw,466
1330
1331
  vellum/workflows/state/__init__.py,sha256=yUUdR-_Vl7UiixNDYQZ-GEM_kJI9dnOia75TtuNEsnE,60
1331
- vellum/workflows/state/base.py,sha256=gm4pun9BzYaZbW8I1j7EriUIlAzqQkKT3IBbXPh3FkA,12663
1332
- vellum/workflows/state/context.py,sha256=tpJoOgmx7bmeNrQeOtavOfqTwBbtJCNDqjJ6ssh4gh8,464
1332
+ vellum/workflows/state/base.py,sha256=ZtbQReKY9P3HRuCFV2338iI6rhJVVoBGgPGKQFysvT0,14514
1333
+ vellum/workflows/state/context.py,sha256=oXiEdNsWJi1coRB85IreTgUeR6_CrWWBXndtLff9S7M,1272
1333
1334
  vellum/workflows/state/encoder.py,sha256=kRrqwD0vFCiSRZR3rg8Sjkh8sDEerQQhlvmdSYQAOl8,1741
1334
1335
  vellum/workflows/state/store.py,sha256=VYGBQgN1bpd1as5eGiouV_7scg8QsRs4_1aqZAGIsRQ,793
1335
1336
  vellum/workflows/state/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1336
1337
  vellum/workflows/state/tests/test_state.py,sha256=BQjcdREIK1MPuGhivRUgpynVJLftjEpH9RG3cRKxQEY,3310
1337
1338
  vellum/workflows/types/__init__.py,sha256=KxUTMBGzuRCfiMqzzsykOeVvrrkaZmTTo1a7SLu8gRM,68
1338
- vellum/workflows/types/core.py,sha256=llsHFE3XKnVEk_pYoK0s9WUdeninSU5Kmoi7dU4GX0c,1804
1339
+ vellum/workflows/types/core.py,sha256=CV_9YgZN8QorFIn18uCwxHxv8bWoYXNnLUB6JyYlf4A,1845
1339
1340
  vellum/workflows/types/generics.py,sha256=ZkfoRhWs042i5IjA99v2wIhmh1u-Wieo3LzosgGWJVk,600
1340
1341
  vellum/workflows/types/stack.py,sha256=RDSGLkcV612ge8UuAH9TZiEGXxJt0Av2-H5rfzrTVVI,1014
1341
1342
  vellum/workflows/types/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1349,9 +1350,10 @@ vellum/workflows/utils/tests/test_vellum_variables.py,sha256=lsYgQV4Iq4ECoVdBNQH
1349
1350
  vellum/workflows/utils/vellum_variables.py,sha256=wbYejKwjy23ITDRfdGW4d181buvCbZityEp5UTJPl28,3123
1350
1351
  vellum/workflows/vellum_client.py,sha256=ODrq_TSl-drX2aezXegf7pizpWDVJuTXH-j6528t75s,683
1351
1352
  vellum/workflows/workflows/__init__.py,sha256=KY45TqvavCCvXIkyCFMEc0dc6jTMOUci93U2DUrlZYc,66
1352
- vellum/workflows/workflows/base.py,sha256=QxIm0zCic8P-y0NNLdqgC1YKTu-3TmMJ-wH1nUylguA,13689
1353
- vellum_ai-0.10.8.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1354
- vellum_ai-0.10.8.dist-info/METADATA,sha256=n5dQCMNsh-FaCOh5YMeDVzfusigZuus_UEjWSmFnK2Q,5128
1355
- vellum_ai-0.10.8.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
1356
- vellum_ai-0.10.8.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1357
- vellum_ai-0.10.8.dist-info/RECORD,,
1353
+ vellum/workflows/workflows/base.py,sha256=7GV9ApiOW-nXwb5v1MGKAa_Mh2XDQD2ZD0qjFehFIxQ,14334
1354
+ vellum/workflows/workflows/event_filters.py,sha256=o1IPA6nS5Yw5mPIpTdWVO870Swl3N4UQ5ITzkVlraqY,1885
1355
+ vellum_ai-0.10.9.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1356
+ vellum_ai-0.10.9.dist-info/METADATA,sha256=5w-XqUtc-2tPSnumluxaUZNh62U99RIVY2Ne7_L9oZ0,5128
1357
+ vellum_ai-0.10.9.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
1358
+ vellum_ai-0.10.9.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1359
+ vellum_ai-0.10.9.dist-info/RECORD,,
@@ -1,6 +1,7 @@
1
1
  from .api_node import BaseAPINodeDisplay
2
2
  from .code_execution_node import BaseCodeExecutionNodeDisplay
3
3
  from .conditional_node import BaseConditionalNodeDisplay
4
+ from .error_node import BaseErrorNodeDisplay
4
5
  from .final_output_node import BaseFinalOutputNodeDisplay
5
6
  from .guardrail_node import BaseGuardrailNodeDisplay
6
7
  from .inline_prompt_node import BaseInlinePromptNodeDisplay
@@ -16,19 +17,20 @@ from .try_node import BaseTryNodeDisplay
16
17
 
17
18
  # All node display classes must be imported here to be registered in BaseNodeDisplay's node display registry
18
19
  __all__ = [
20
+ "BaseAPINodeDisplay",
19
21
  "BaseCodeExecutionNodeDisplay",
20
22
  "BaseConditionalNodeDisplay",
23
+ "BaseErrorNodeDisplay",
24
+ "BaseFinalOutputNodeDisplay",
21
25
  "BaseGuardrailNodeDisplay",
22
26
  "BaseInlinePromptNodeDisplay",
23
27
  "BaseInlineSubworkflowNodeDisplay",
24
- "BaseAPINodeDisplay",
25
28
  "BaseMapNodeDisplay",
26
29
  "BaseMergeNodeDisplay",
27
30
  "BaseNoteNodeDisplay",
31
+ "BasePromptDeploymentNodeDisplay",
28
32
  "BaseSearchNodeDisplay",
29
33
  "BaseSubworkflowDeploymentNodeDisplay",
30
34
  "BaseTemplatingNodeDisplay",
31
- "BasePromptDeploymentNodeDisplay",
32
- "BaseFinalOutputNodeDisplay",
33
- "BaseTryNodeDisplay",
35
+ "BaseTryNodeDisplay"
34
36
  ]
@@ -0,0 +1,49 @@
1
+ from uuid import UUID
2
+ from typing import Any, ClassVar, Dict, Generic, Optional, TypeVar
3
+
4
+ from vellum.workflows.nodes import ErrorNode
5
+ from vellum.workflows.types.core import EntityInputsInterface, Json, JsonObject
6
+ from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
7
+ from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
8
+ from vellum_ee.workflows.display.types import WorkflowDisplayContext
9
+
10
+ _ErrorNodeType = TypeVar("_ErrorNodeType", bound=ErrorNode)
11
+
12
+ class BaseErrorNodeDisplay(BaseNodeVellumDisplay[_ErrorNodeType], Generic[_ErrorNodeType]):
13
+ error_output_id: ClassVar[Optional[UUID]] = None
14
+ error_inputs_by_name: ClassVar[Dict[str, Any]] = {}
15
+ name: ClassVar[str] = "error-node"
16
+
17
+ def serialize(
18
+ self, display_context: WorkflowDisplayContext, error_output_id: Optional[UUID] = None, **kwargs
19
+ ) -> JsonObject:
20
+ node = self._node
21
+ node_id = self.node_id
22
+ error_source_input_id = self.node_input_ids_by_name.get("error_source_input_id")
23
+
24
+ node_inputs = [
25
+ create_node_input(
26
+ node_id=node_id,
27
+ input_name=variable_name,
28
+ value=variable_value,
29
+ display_context=display_context,
30
+ input_id=self.node_input_ids_by_name.get(variable_name),
31
+ )
32
+ for variable_name, variable_value in self.error_inputs_by_name.items()
33
+ ]
34
+
35
+ return {
36
+ "id": str(node_id),
37
+ "type": "ERROR",
38
+ "inputs": [node_input.dict() for node_input in node_inputs],
39
+ "data": {
40
+ "name": self.name,
41
+ "label": self.label,
42
+ "source_handle_id": str(self.get_source_handle_id(display_context.port_displays)),
43
+ "target_handle_id": str(self.get_target_handle_id()),
44
+ "error_source_input_id": str(error_source_input_id),
45
+ "error_output_id": str(self.error_output_id),
46
+ },
47
+ "display_data": self.get_display_data().dict(),
48
+ "definition": self.get_definition().dict(),
49
+ }