vellum-ai 0.13.0__py3-none-any.whl → 0.13.2__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/core/pydantic_utilities.py +5 -0
- vellum/client/resources/workflows/client.py +8 -0
- vellum/client/types/logical_operator.py +2 -0
- vellum/workflows/descriptors/base.py +1 -1
- vellum/workflows/descriptors/tests/test_utils.py +3 -0
- vellum/workflows/expressions/accessor.py +8 -2
- vellum/workflows/nodes/core/map_node/node.py +49 -24
- vellum/workflows/nodes/core/map_node/tests/test_node.py +4 -4
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +1 -1
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +5 -3
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +3 -0
- vellum/workflows/nodes/displayable/bases/search_node.py +37 -2
- vellum/workflows/nodes/displayable/bases/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/bases/tests/test_utils.py +61 -0
- vellum/workflows/nodes/displayable/bases/types.py +42 -0
- vellum/workflows/nodes/displayable/bases/utils.py +112 -0
- vellum/workflows/nodes/displayable/inline_prompt_node/tests/test_node.py +0 -1
- vellum/workflows/nodes/displayable/search_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/search_node/tests/test_node.py +164 -0
- vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +2 -3
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +0 -1
- vellum/workflows/runner/runner.py +37 -4
- vellum/workflows/types/tests/test_utils.py +5 -2
- vellum/workflows/types/utils.py +4 -0
- vellum/workflows/workflows/base.py +14 -0
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/METADATA +1 -1
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/RECORD +53 -42
- vellum_cli/__init__.py +24 -0
- vellum_cli/ping.py +28 -0
- vellum_cli/push.py +62 -12
- vellum_cli/tests/test_ping.py +47 -0
- vellum_cli/tests/test_push.py +76 -0
- vellum_ee/workflows/display/nodes/vellum/base_node.py +59 -11
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +3 -0
- vellum_ee/workflows/display/nodes/vellum/map_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +14 -10
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/utils.py +8 -1
- vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +48 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +67 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +286 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +177 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +666 -14
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +7 -8
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +35 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +29 -2
- vellum_ee/workflows/display/utils/vellum.py +4 -42
- vellum_ee/workflows/display/vellum.py +7 -36
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +5 -2
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/LICENSE +0 -0
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/WHEEL +0 -0
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/entry_points.txt +0 -0
vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
from uuid import uuid4
|
2
|
+
|
3
|
+
from deepdiff import DeepDiff
|
4
|
+
|
5
|
+
from vellum.workflows.inputs.base import BaseInputs
|
6
|
+
from vellum.workflows.nodes.bases.base import BaseNode
|
7
|
+
from vellum_ee.workflows.display.base import WorkflowInputsDisplay
|
8
|
+
from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay
|
9
|
+
from vellum_ee.workflows.display.nodes.vellum.base_node import BaseNodeDisplay
|
10
|
+
|
11
|
+
|
12
|
+
class Inputs(BaseInputs):
|
13
|
+
input: str
|
14
|
+
|
15
|
+
|
16
|
+
class AnnotatedOutputGenericNode(BaseNode):
|
17
|
+
class Outputs(BaseNode.Outputs):
|
18
|
+
output: int
|
19
|
+
|
20
|
+
|
21
|
+
def test_serialize_node__annotated_output(serialize_node):
|
22
|
+
serialized_node = serialize_node(AnnotatedOutputGenericNode)
|
23
|
+
|
24
|
+
assert not DeepDiff(
|
25
|
+
{
|
26
|
+
"id": "c0b71cfa-0d9e-4329-bde0-967c44be5c3c",
|
27
|
+
"label": "AnnotatedOutputGenericNode",
|
28
|
+
"type": "GENERIC",
|
29
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
30
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
31
|
+
"definition": {
|
32
|
+
"name": "AnnotatedOutputGenericNode",
|
33
|
+
"module": [
|
34
|
+
"vellum_ee",
|
35
|
+
"workflows",
|
36
|
+
"display",
|
37
|
+
"tests",
|
38
|
+
"workflow_serialization",
|
39
|
+
"generic_nodes",
|
40
|
+
"test_outputs_serialization",
|
41
|
+
],
|
42
|
+
},
|
43
|
+
"trigger": {"id": "256ef76c-39a6-4a8f-8bda-922f5972a1d4", "merge_behavior": "AWAIT_ANY"},
|
44
|
+
"ports": [{"id": "378d8939-7a0f-4c87-a849-7fd00067cd2d", "type": "DEFAULT", "name": "default"}],
|
45
|
+
"adornments": None,
|
46
|
+
"attributes": [],
|
47
|
+
"outputs": [
|
48
|
+
{
|
49
|
+
"id": "8c3c9aff-e1d5-49f4-af75-3ec2fcbb4af2",
|
50
|
+
"name": "output",
|
51
|
+
"type": "NUMBER",
|
52
|
+
"value": None,
|
53
|
+
}
|
54
|
+
],
|
55
|
+
},
|
56
|
+
serialized_node,
|
57
|
+
ignore_order=True,
|
58
|
+
)
|
59
|
+
|
60
|
+
|
61
|
+
class WorkflowInputGenericNode(BaseNode):
|
62
|
+
class Outputs(BaseNode.Outputs):
|
63
|
+
output = Inputs.input
|
64
|
+
|
65
|
+
|
66
|
+
def test_serialize_node__workflow_input(serialize_node):
|
67
|
+
input_id = uuid4()
|
68
|
+
serialized_node = serialize_node(
|
69
|
+
node_class=WorkflowInputGenericNode,
|
70
|
+
global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=input_id)},
|
71
|
+
)
|
72
|
+
|
73
|
+
assert not DeepDiff(
|
74
|
+
{
|
75
|
+
"id": "ddfa947f-0830-476b-b07e-ac573968f9a7",
|
76
|
+
"label": "WorkflowInputGenericNode",
|
77
|
+
"type": "GENERIC",
|
78
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
79
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
80
|
+
"definition": {
|
81
|
+
"name": "WorkflowInputGenericNode",
|
82
|
+
"module": [
|
83
|
+
"vellum_ee",
|
84
|
+
"workflows",
|
85
|
+
"display",
|
86
|
+
"tests",
|
87
|
+
"workflow_serialization",
|
88
|
+
"generic_nodes",
|
89
|
+
"test_outputs_serialization",
|
90
|
+
],
|
91
|
+
},
|
92
|
+
"trigger": {"id": "b1a5d749-bac0-4f11-8427-191febb2198e", "merge_behavior": "AWAIT_ANY"},
|
93
|
+
"ports": [{"id": "f013bf3f-49f6-41cd-ac13-7439b71a304a", "type": "DEFAULT", "name": "default"}],
|
94
|
+
"adornments": None,
|
95
|
+
"attributes": [],
|
96
|
+
"outputs": [
|
97
|
+
{
|
98
|
+
"id": "2c4a85c0-b017-4cea-a261-e8e8498570c9",
|
99
|
+
"name": "output",
|
100
|
+
"type": "STRING",
|
101
|
+
"value": {
|
102
|
+
"type": "WORKFLOW_INPUT",
|
103
|
+
"input_variable_id": str(input_id),
|
104
|
+
},
|
105
|
+
}
|
106
|
+
],
|
107
|
+
},
|
108
|
+
serialized_node,
|
109
|
+
ignore_order=True,
|
110
|
+
)
|
111
|
+
|
112
|
+
|
113
|
+
class NodeWithOutput(BaseNode):
|
114
|
+
class Outputs(BaseNode.Outputs):
|
115
|
+
output = Inputs.input
|
116
|
+
|
117
|
+
|
118
|
+
class NodeWithOutputDisplay(BaseNodeDisplay[NodeWithOutput]):
|
119
|
+
pass
|
120
|
+
|
121
|
+
|
122
|
+
class GenericNodeReferencingOutput(BaseNode):
|
123
|
+
class Outputs(BaseNode.Outputs):
|
124
|
+
output = NodeWithOutput.Outputs.output
|
125
|
+
|
126
|
+
|
127
|
+
def test_serialize_node__node_output_reference(serialize_node):
|
128
|
+
workflow_input_id = uuid4()
|
129
|
+
node_output_id = uuid4()
|
130
|
+
serialized_node = serialize_node(
|
131
|
+
node_class=GenericNodeReferencingOutput,
|
132
|
+
global_workflow_input_displays={Inputs.input: WorkflowInputsDisplay(id=workflow_input_id)},
|
133
|
+
global_node_displays={NodeWithOutput: NodeWithOutputDisplay()},
|
134
|
+
global_node_output_displays={
|
135
|
+
NodeWithOutput.Outputs.output: (NodeWithOutput, NodeOutputDisplay(id=node_output_id, name="output"))
|
136
|
+
},
|
137
|
+
)
|
138
|
+
|
139
|
+
assert not DeepDiff(
|
140
|
+
{
|
141
|
+
"id": "c1e2ce60-ac3a-4b17-915e-abe861734e03",
|
142
|
+
"label": "GenericNodeReferencingOutput",
|
143
|
+
"type": "GENERIC",
|
144
|
+
"display_data": {"position": {"x": 0.0, "y": 0.0}},
|
145
|
+
"base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
|
146
|
+
"definition": {
|
147
|
+
"name": "GenericNodeReferencingOutput",
|
148
|
+
"module": [
|
149
|
+
"vellum_ee",
|
150
|
+
"workflows",
|
151
|
+
"display",
|
152
|
+
"tests",
|
153
|
+
"workflow_serialization",
|
154
|
+
"generic_nodes",
|
155
|
+
"test_outputs_serialization",
|
156
|
+
],
|
157
|
+
},
|
158
|
+
"trigger": {"id": "449072ba-f7b6-4314-ac96-682123f225e5", "merge_behavior": "AWAIT_ANY"},
|
159
|
+
"ports": [{"id": "ec9a79b8-65c3-4de8-bd29-42c914d72d4f", "type": "DEFAULT", "name": "default"}],
|
160
|
+
"adornments": None,
|
161
|
+
"attributes": [],
|
162
|
+
"outputs": [
|
163
|
+
{
|
164
|
+
"id": "db010db3-7076-4df9-ae1b-069caa16fa20",
|
165
|
+
"name": "output",
|
166
|
+
"type": "STRING",
|
167
|
+
"value": {
|
168
|
+
"type": "NODE_OUTPUT",
|
169
|
+
"node_id": "cd954d76-0b0a-4d9b-9bdf-347179c38cb6",
|
170
|
+
"node_output_id": str(node_output_id),
|
171
|
+
},
|
172
|
+
}
|
173
|
+
],
|
174
|
+
},
|
175
|
+
serialized_node,
|
176
|
+
ignore_order=True,
|
177
|
+
)
|