vellum-ai 0.14.22__py3-none-any.whl → 0.14.24__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.
- vellum/__init__.py +122 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/resources/workflow_deployments/client.py +250 -0
- vellum/client/types/__init__.py +122 -0
- vellum/client/types/api_request_parent_context.py +41 -0
- vellum/client/types/api_version_enum.py +5 -0
- vellum/client/types/base_output.py +21 -0
- vellum/client/types/code_resource_definition.py +31 -0
- vellum/client/types/external_input_descriptor.py +23 -0
- vellum/client/types/invoked_port.py +19 -0
- vellum/client/types/ml_model_usage_wrapper.py +21 -0
- vellum/client/types/node_event_display_context.py +30 -0
- vellum/client/types/node_execution_fulfilled_body.py +24 -0
- vellum/client/types/node_execution_fulfilled_event.py +49 -0
- vellum/client/types/node_execution_initiated_body.py +21 -0
- vellum/client/types/node_execution_initiated_event.py +49 -0
- vellum/client/types/node_execution_paused_body.py +20 -0
- vellum/client/types/node_execution_paused_event.py +49 -0
- vellum/client/types/node_execution_rejected_body.py +22 -0
- vellum/client/types/node_execution_rejected_event.py +49 -0
- vellum/client/types/node_execution_resumed_body.py +20 -0
- vellum/client/types/node_execution_resumed_event.py +49 -0
- vellum/client/types/node_execution_span.py +46 -0
- vellum/client/types/node_execution_span_attributes.py +19 -0
- vellum/client/types/node_execution_streaming_body.py +22 -0
- vellum/client/types/node_execution_streaming_event.py +49 -0
- vellum/client/types/node_parent_context.py +43 -0
- vellum/client/types/parent_context.py +21 -0
- vellum/client/types/prompt_deployment_parent_context.py +49 -0
- vellum/client/types/slim_workflow_execution_read.py +54 -0
- vellum/client/types/span_link.py +41 -0
- vellum/client/types/span_link_type_enum.py +5 -0
- vellum/client/types/vellum_code_resource_definition.py +25 -0
- vellum/client/types/vellum_node_execution_event.py +18 -0
- vellum/client/types/vellum_sdk_error.py +21 -0
- vellum/client/types/vellum_sdk_error_code_enum.py +20 -0
- vellum/client/types/vellum_span.py +7 -0
- vellum/client/types/vellum_workflow_execution_event.py +20 -0
- vellum/client/types/workflow_deployment_event_executions_response.py +55 -0
- vellum/client/types/workflow_deployment_parent_context.py +49 -0
- vellum/client/types/workflow_error.py +7 -0
- vellum/client/types/workflow_event_display_context.py +28 -0
- vellum/client/types/workflow_event_execution_read.py +60 -0
- vellum/client/types/workflow_execution_actual.py +30 -0
- vellum/client/types/workflow_execution_fulfilled_body.py +21 -0
- vellum/client/types/workflow_execution_fulfilled_event.py +49 -0
- vellum/client/types/workflow_execution_initiated_body.py +30 -0
- vellum/client/types/workflow_execution_initiated_event.py +53 -0
- vellum/client/types/workflow_execution_paused_body.py +22 -0
- vellum/client/types/workflow_execution_paused_event.py +49 -0
- vellum/client/types/workflow_execution_rejected_body.py +22 -0
- vellum/client/types/workflow_execution_rejected_event.py +49 -0
- vellum/client/types/workflow_execution_resumed_body.py +20 -0
- vellum/client/types/workflow_execution_resumed_event.py +49 -0
- vellum/client/types/workflow_execution_snapshotted_body.py +21 -0
- vellum/client/types/workflow_execution_snapshotted_event.py +51 -0
- vellum/client/types/workflow_execution_span.py +50 -0
- vellum/client/types/workflow_execution_span_attributes.py +19 -0
- vellum/client/types/workflow_execution_streaming_body.py +22 -0
- vellum/client/types/workflow_execution_streaming_event.py +49 -0
- vellum/client/types/workflow_execution_usage_calculation_fulfilled_body.py +22 -0
- vellum/client/types/workflow_execution_view_online_eval_metric_result.py +30 -0
- vellum/client/types/workflow_initialization_error.py +24 -0
- vellum/client/types/workflow_parent_context.py +43 -0
- vellum/client/types/workflow_sandbox_parent_context.py +44 -0
- vellum/plugins/pydantic.py +2 -0
- vellum/types/api_request_parent_context.py +3 -0
- vellum/types/api_version_enum.py +3 -0
- vellum/types/base_output.py +3 -0
- vellum/types/code_resource_definition.py +3 -0
- vellum/types/external_input_descriptor.py +3 -0
- vellum/types/invoked_port.py +3 -0
- vellum/types/ml_model_usage_wrapper.py +3 -0
- vellum/types/node_event_display_context.py +3 -0
- vellum/types/node_execution_fulfilled_body.py +3 -0
- vellum/types/node_execution_fulfilled_event.py +3 -0
- vellum/types/node_execution_initiated_body.py +3 -0
- vellum/types/node_execution_initiated_event.py +3 -0
- vellum/types/node_execution_paused_body.py +3 -0
- vellum/types/node_execution_paused_event.py +3 -0
- vellum/types/node_execution_rejected_body.py +3 -0
- vellum/types/node_execution_rejected_event.py +3 -0
- vellum/types/node_execution_resumed_body.py +3 -0
- vellum/types/node_execution_resumed_event.py +3 -0
- vellum/types/node_execution_span.py +3 -0
- vellum/types/node_execution_span_attributes.py +3 -0
- vellum/types/node_execution_streaming_body.py +3 -0
- vellum/types/node_execution_streaming_event.py +3 -0
- vellum/types/node_parent_context.py +3 -0
- vellum/types/parent_context.py +3 -0
- vellum/types/prompt_deployment_parent_context.py +3 -0
- vellum/types/slim_workflow_execution_read.py +3 -0
- vellum/types/span_link.py +3 -0
- vellum/types/span_link_type_enum.py +3 -0
- vellum/types/vellum_code_resource_definition.py +3 -0
- vellum/types/vellum_node_execution_event.py +3 -0
- vellum/types/vellum_sdk_error.py +3 -0
- vellum/types/vellum_sdk_error_code_enum.py +3 -0
- vellum/types/vellum_span.py +3 -0
- vellum/types/vellum_workflow_execution_event.py +3 -0
- vellum/types/workflow_deployment_event_executions_response.py +3 -0
- vellum/types/workflow_deployment_parent_context.py +3 -0
- vellum/types/workflow_error.py +3 -0
- vellum/types/workflow_event_display_context.py +3 -0
- vellum/types/workflow_event_execution_read.py +3 -0
- vellum/types/workflow_execution_actual.py +3 -0
- vellum/types/workflow_execution_fulfilled_body.py +3 -0
- vellum/types/workflow_execution_fulfilled_event.py +3 -0
- vellum/types/workflow_execution_initiated_body.py +3 -0
- vellum/types/workflow_execution_initiated_event.py +3 -0
- vellum/types/workflow_execution_paused_body.py +3 -0
- vellum/types/workflow_execution_paused_event.py +3 -0
- vellum/types/workflow_execution_rejected_body.py +3 -0
- vellum/types/workflow_execution_rejected_event.py +3 -0
- vellum/types/workflow_execution_resumed_body.py +3 -0
- vellum/types/workflow_execution_resumed_event.py +3 -0
- vellum/types/workflow_execution_snapshotted_body.py +3 -0
- vellum/types/workflow_execution_snapshotted_event.py +3 -0
- vellum/types/workflow_execution_span.py +3 -0
- vellum/types/workflow_execution_span_attributes.py +3 -0
- vellum/types/workflow_execution_streaming_body.py +3 -0
- vellum/types/workflow_execution_streaming_event.py +3 -0
- vellum/types/workflow_execution_usage_calculation_fulfilled_body.py +3 -0
- vellum/types/workflow_execution_view_online_eval_metric_result.py +3 -0
- vellum/types/workflow_initialization_error.py +3 -0
- vellum/types/workflow_parent_context.py +3 -0
- vellum/types/workflow_sandbox_parent_context.py +3 -0
- vellum/workflows/nodes/core/inline_subworkflow_node/node.py +6 -0
- vellum/workflows/nodes/core/inline_subworkflow_node/tests/test_node.py +27 -0
- vellum/workflows/nodes/core/retry_node/tests/test_node.py +0 -23
- vellum/workflows/workflows/base.py +2 -2
- vellum/workflows/workflows/tests/test_base_workflow.py +10 -0
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/METADATA +1 -1
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/RECORD +157 -33
- vellum_ee/workflows/display/base.py +26 -4
- vellum_ee/workflows/display/editor/__init__.py +7 -0
- vellum_ee/workflows/display/editor/types.py +22 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +2 -1
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/api_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +8 -0
- vellum_ee/workflows/display/nodes/vellum/search_node.py +2 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +5 -11
- vellum_ee/workflows/display/nodes/vellum/utils.py +3 -4
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +8 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +12 -8
- vellum_ee/workflows/display/types.py +16 -13
- vellum_ee/workflows/display/utils/expressions.py +6 -2
- vellum_ee/workflows/display/utils/vellum.py +59 -13
- vellum_ee/workflows/display/vellum.py +18 -95
- vellum_ee/workflows/display/workflows/base_workflow_display.py +54 -46
- vellum_ee/workflows/display/workflows/tests/test_workflow_display.py +15 -1
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +2 -4
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.22.dist-info → vellum_ai-0.14.24.dist-info}/entry_points.txt +0 -0
@@ -13,6 +13,7 @@ from vellum.workflows.state.base import BaseState
|
|
13
13
|
from vellum.workflows.state.context import WorkflowContext
|
14
14
|
from vellum.workflows.types.core import EntityInputsInterface
|
15
15
|
from vellum.workflows.types.generics import InputsType, StateType
|
16
|
+
from vellum.workflows.utils.uuids import uuid4_from_hash
|
16
17
|
from vellum.workflows.workflows.event_filters import all_workflow_event_filter
|
17
18
|
|
18
19
|
if TYPE_CHECKING:
|
@@ -140,3 +141,8 @@ class InlineSubworkflowNode(
|
|
140
141
|
# Subclasses of InlineSubworkflowNode can override this method to provider their own
|
141
142
|
# approach to annotating the outputs class based on the `subworkflow.Outputs`
|
142
143
|
setattr(outputs_class, reference.name, reference)
|
144
|
+
|
145
|
+
if cls.__output_ids__ is None:
|
146
|
+
cls.__output_ids__ = {}
|
147
|
+
|
148
|
+
cls.__output_ids__[reference.name] = uuid4_from_hash(f"{cls.__id__}|{reference.name}")
|
@@ -116,3 +116,30 @@ def test_inline_subworkflow_node__base_inputs_validation():
|
|
116
116
|
# AND the error message should indicate the missing required input
|
117
117
|
assert e.value.code == WorkflowErrorCode.INVALID_INPUTS
|
118
118
|
assert "Required input variables required_input should have defined value" == str(e.value)
|
119
|
+
|
120
|
+
|
121
|
+
def test_inline_subworkflow_node__with_adornment():
|
122
|
+
# GIVEN a simple inline subworkflow with an output
|
123
|
+
class InnerNode(BaseNode):
|
124
|
+
class Outputs(BaseNode.Outputs):
|
125
|
+
final_output = "hello"
|
126
|
+
|
127
|
+
class TestSubworkflow(BaseWorkflow):
|
128
|
+
graph = InnerNode
|
129
|
+
|
130
|
+
class Outputs(BaseWorkflow.Outputs):
|
131
|
+
final_output = InnerNode.Outputs.final_output
|
132
|
+
|
133
|
+
# AND it's wrapped in a TryNode
|
134
|
+
@TryNode.wrap()
|
135
|
+
class TestNode(InlineSubworkflowNode):
|
136
|
+
subworkflow = TestSubworkflow
|
137
|
+
|
138
|
+
# THEN the wrapped node should have the correct output IDs
|
139
|
+
assert "final_output" in TestNode.__output_ids__
|
140
|
+
|
141
|
+
# AND when we run the node
|
142
|
+
node = TestNode()
|
143
|
+
outputs = list(node.run())
|
144
|
+
|
145
|
+
assert outputs[-1].name == "final_output" and outputs[-1].value == "hello"
|
@@ -33,29 +33,6 @@ def test_retry_node__retry_on_error_code__successfully_retried():
|
|
33
33
|
assert outputs.execution_count == 3
|
34
34
|
|
35
35
|
|
36
|
-
def test_retry_node__retry_on_error_code_all():
|
37
|
-
# GIVEN a retry node that is configured to retry on all errors
|
38
|
-
@RetryNode.wrap(max_attempts=3)
|
39
|
-
class TestNode(BaseNode):
|
40
|
-
attempt_number = RetryNode.SubworkflowInputs.attempt_number
|
41
|
-
|
42
|
-
class Outputs(BaseOutputs):
|
43
|
-
execution_count: int
|
44
|
-
|
45
|
-
def run(self) -> Outputs:
|
46
|
-
if self.attempt_number < 3:
|
47
|
-
raise NodeException(message="This will be retried", code=WorkflowErrorCode.PROVIDER_ERROR)
|
48
|
-
|
49
|
-
return self.Outputs(execution_count=self.attempt_number)
|
50
|
-
|
51
|
-
# WHEN the node is run and throws a None
|
52
|
-
node = TestNode(state=BaseState())
|
53
|
-
outputs = node.run()
|
54
|
-
|
55
|
-
# THEN the exception is retried
|
56
|
-
assert outputs.execution_count == 3
|
57
|
-
|
58
|
-
|
59
36
|
def test_retry_node__retry_on_error_code__missed():
|
60
37
|
# GIVEN a retry node that is configured to retry on PROVIDER_ERROR
|
61
38
|
@RetryNode.wrap(max_attempts=3, retry_on_error_code=WorkflowErrorCode.PROVIDER_ERROR)
|
@@ -110,10 +110,10 @@ class _BaseWorkflowMeta(type):
|
|
110
110
|
nodes.update(node for node in item.nodes)
|
111
111
|
elif inspect.isclass(item) and issubclass(item, BaseNode):
|
112
112
|
nodes.add(item)
|
113
|
-
elif issubclass(graph_item, BaseNode):
|
113
|
+
elif inspect.isclass(graph_item) and issubclass(graph_item, BaseNode):
|
114
114
|
nodes.add(graph_item)
|
115
115
|
else:
|
116
|
-
raise
|
116
|
+
raise TypeError(f"Unexpected graph type: {graph_item.__class__}")
|
117
117
|
return nodes
|
118
118
|
|
119
119
|
graph_nodes = collect_nodes(dct.get("graph", set()))
|
@@ -304,3 +304,13 @@ def test_workflow__node_in_both_graph_and_unused():
|
|
304
304
|
|
305
305
|
# THEN it should raise an error
|
306
306
|
assert "Node(s) NodeA cannot appear in both graph and unused_graphs" in str(exc_info.value)
|
307
|
+
|
308
|
+
|
309
|
+
def test_workflow__unsupported_graph_item():
|
310
|
+
with pytest.raises(TypeError) as exc_info:
|
311
|
+
# GIVEN a workflow with an unsupported graph item
|
312
|
+
class TestWorkflow(BaseWorkflow[BaseInputs, BaseState]):
|
313
|
+
graph = 1 # type: ignore
|
314
|
+
|
315
|
+
# THEN it should raise an error
|
316
|
+
assert "Unexpected graph type: <class 'int'>" in str(exc_info.value)
|