vellum-ai 0.12.8__py3-none-any.whl → 0.12.11__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. vellum/__init__.py +2 -2
  2. vellum/client/__init__.py +14 -4
  3. vellum/client/core/client_wrapper.py +1 -1
  4. vellum/client/types/__init__.py +2 -2
  5. vellum/client/types/function_call.py +0 -2
  6. vellum/client/types/function_call_request.py +0 -2
  7. vellum/client/types/metric_definition_execution.py +6 -0
  8. vellum/client/types/test_suite_run_execution_metric_result.py +6 -0
  9. vellum/client/types/test_suite_run_metric_array_output.py +32 -0
  10. vellum/client/types/test_suite_run_metric_output.py +2 -0
  11. vellum/evaluations/resources.py +1 -1
  12. vellum/prompts/blocks/compilation.py +4 -4
  13. vellum/types/{fulfilled_enum.py → test_suite_run_metric_array_output.py} +1 -1
  14. vellum/workflows/nodes/bases/__init__.py +0 -2
  15. vellum/workflows/nodes/bases/base.py +2 -6
  16. vellum/workflows/nodes/core/inline_subworkflow_node/node.py +13 -7
  17. vellum/workflows/nodes/core/inline_subworkflow_node/tests/__init__.py +0 -0
  18. vellum/workflows/nodes/core/inline_subworkflow_node/tests/test_node.py +41 -0
  19. vellum/workflows/nodes/core/map_node/node.py +1 -1
  20. vellum/workflows/nodes/core/templating_node/node.py +8 -1
  21. vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +66 -0
  22. vellum/workflows/nodes/core/try_node/node.py +1 -3
  23. vellum/workflows/nodes/core/try_node/tests/test_node.py +1 -1
  24. vellum/workflows/nodes/displayable/bases/api_node/node.py +2 -2
  25. vellum/workflows/nodes/displayable/bases/search_node.py +1 -2
  26. vellum/workflows/nodes/displayable/inline_prompt_node/node.py +17 -10
  27. vellum/workflows/nodes/displayable/inline_prompt_node/tests/test_node.py +13 -3
  28. vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +4 -2
  29. vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py +1 -2
  30. vellum/workflows/sandbox.py +4 -5
  31. vellum/workflows/state/context.py +5 -4
  32. vellum/workflows/state/encoder.py +4 -0
  33. vellum/workflows/state/tests/test_state.py +19 -0
  34. vellum/workflows/tests/test_sandbox.py +2 -2
  35. vellum/workflows/utils/tests/test_vellum_variables.py +3 -0
  36. vellum/workflows/utils/vellum_variables.py +5 -4
  37. vellum/workflows/workflows/base.py +5 -2
  38. {vellum_ai-0.12.8.dist-info → vellum_ai-0.12.11.dist-info}/METADATA +1 -1
  39. {vellum_ai-0.12.8.dist-info → vellum_ai-0.12.11.dist-info}/RECORD +46 -45
  40. vellum_cli/tests/test_push.py +1 -1
  41. vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +6 -1
  42. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +207 -0
  43. vellum/client/types/fulfilled_enum.py +0 -5
  44. vellum/workflows/nodes/bases/base_subworkflow_node/__init__.py +0 -5
  45. vellum/workflows/nodes/bases/base_subworkflow_node/node.py +0 -10
  46. /vellum/{evaluations/utils → utils}/uuid.py +0 -0
  47. {vellum_ai-0.12.8.dist-info → vellum_ai-0.12.11.dist-info}/LICENSE +0 -0
  48. {vellum_ai-0.12.8.dist-info → vellum_ai-0.12.11.dist-info}/WHEEL +0 -0
  49. {vellum_ai-0.12.8.dist-info → vellum_ai-0.12.11.dist-info}/entry_points.txt +0 -0
@@ -0,0 +1,207 @@
1
+ from deepdiff import DeepDiff
2
+
3
+ from vellum_ee.workflows.display.workflows import VellumWorkflowDisplay
4
+ from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
5
+
6
+ from tests.workflows.basic_templating_node.workflow_with_json_input import BasicTemplatingNodeWorkflowWithJson
7
+
8
+
9
+ def test_serialize_workflow():
10
+ # GIVEN a Workflow that uses a vellum templating node",
11
+
12
+ # WHEN we serialize it
13
+ workflow_display = get_workflow_display(
14
+ base_display_class=VellumWorkflowDisplay, workflow_class=BasicTemplatingNodeWorkflowWithJson
15
+ )
16
+
17
+ serialized_workflow: dict = workflow_display.serialize()
18
+
19
+ # THEN we should get a serialized representation of the Workflow
20
+ assert serialized_workflow.keys() == {
21
+ "workflow_raw_data",
22
+ "input_variables",
23
+ "output_variables",
24
+ }
25
+
26
+ # AND its input variables should be what we expect
27
+ input_variables = serialized_workflow["input_variables"]
28
+ assert len(input_variables) == 1
29
+ assert input_variables == [
30
+ {
31
+ "id": "f4435f88-703f-40e5-9197-d39b0e43ab72",
32
+ "key": "info",
33
+ "type": "JSON",
34
+ "default": None,
35
+ "required": True,
36
+ "extensions": {"color": None},
37
+ }
38
+ ]
39
+
40
+ # AND its output variables should be what we expect
41
+ output_variables = serialized_workflow["output_variables"]
42
+ assert len(output_variables) == 1
43
+ assert not DeepDiff(
44
+ [{"id": "62ec9b08-6437-4f8d-bc20-983d317bc348", "key": "result", "type": "JSON"}],
45
+ output_variables,
46
+ ignore_order=True,
47
+ )
48
+
49
+ # AND its raw data should be what we expect
50
+ workflow_raw_data = serialized_workflow["workflow_raw_data"]
51
+ assert workflow_raw_data.keys() == {"edges", "nodes", "display_data", "definition"}
52
+ assert len(workflow_raw_data["edges"]) == 2
53
+ assert len(workflow_raw_data["nodes"]) == 3
54
+
55
+ # AND each node should be serialized correctly
56
+ entrypoint_node = workflow_raw_data["nodes"][0]
57
+ assert entrypoint_node == {
58
+ "id": "09579c0a-acbf-4e04-8724-2230a8aa6534",
59
+ "type": "ENTRYPOINT",
60
+ "inputs": [],
61
+ "data": {"label": "Entrypoint Node", "source_handle_id": "34069190-0942-4e0c-8700-b33b9dea4ea0"},
62
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
63
+ "definition": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"], "bases": []},
64
+ }
65
+
66
+ templating_node = workflow_raw_data["nodes"][1]
67
+ assert not DeepDiff(
68
+ {
69
+ "id": "51cbe21d-0232-4362-bc54-5bc283297aa6",
70
+ "type": "TEMPLATING",
71
+ "inputs": [
72
+ {
73
+ "id": "7c775379-d589-4d79-b876-dcd224d72966",
74
+ "key": "template",
75
+ "value": {
76
+ "rules": [
77
+ {
78
+ "type": "CONSTANT_VALUE",
79
+ "data": {"type": "STRING", "value": "The meaning of {{ info }} is not known"},
80
+ }
81
+ ],
82
+ "combinator": "OR",
83
+ },
84
+ },
85
+ {
86
+ "id": "bb712499-4265-4d71-bc14-0c3d8ca6a7de",
87
+ "key": "info",
88
+ "value": {
89
+ "rules": [
90
+ {
91
+ "type": "INPUT_VARIABLE",
92
+ "data": {"input_variable_id": "f4435f88-703f-40e5-9197-d39b0e43ab72"},
93
+ }
94
+ ],
95
+ "combinator": "OR",
96
+ },
97
+ },
98
+ ],
99
+ "data": {
100
+ "label": "Example Templating Node",
101
+ "output_id": "6834cae4-8173-4fa6-88f7-bc09d335bdd1",
102
+ "error_output_id": None,
103
+ "source_handle_id": "39317827-df43-4f5a-bfbc-20bffc839748",
104
+ "target_handle_id": "58427684-3848-498a-8299-c6b0fc70265d",
105
+ "template_node_input_id": "7c775379-d589-4d79-b876-dcd224d72966",
106
+ "output_type": "JSON",
107
+ },
108
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
109
+ "definition": {
110
+ "name": "ExampleTemplatingNode",
111
+ "module": ["tests", "workflows", "basic_templating_node", "workflow_with_json_input"],
112
+ "bases": [
113
+ {
114
+ "name": "TemplatingNode",
115
+ "module": ["vellum", "workflows", "nodes", "core", "templating_node", "node"],
116
+ }
117
+ ],
118
+ },
119
+ },
120
+ templating_node,
121
+ )
122
+
123
+ final_output_node = workflow_raw_data["nodes"][-1]
124
+ assert not DeepDiff(
125
+ {
126
+ "id": "9f75228b-1d5b-4c30-a581-6087e6a1b738",
127
+ "type": "TERMINAL",
128
+ "data": {
129
+ "label": "Final Output",
130
+ "name": "result",
131
+ "target_handle_id": "16ba108e-61a8-4338-8a5b-4f1278d7fd7b",
132
+ "output_id": "62ec9b08-6437-4f8d-bc20-983d317bc348",
133
+ "output_type": "JSON",
134
+ "node_input_id": "310072db-6d07-4d29-8e5c-9c6909300925",
135
+ },
136
+ "inputs": [
137
+ {
138
+ "id": "310072db-6d07-4d29-8e5c-9c6909300925",
139
+ "key": "node_input",
140
+ "value": {
141
+ "rules": [
142
+ {
143
+ "type": "NODE_OUTPUT",
144
+ "data": {
145
+ "node_id": "51cbe21d-0232-4362-bc54-5bc283297aa6",
146
+ "output_id": "6834cae4-8173-4fa6-88f7-bc09d335bdd1",
147
+ },
148
+ }
149
+ ],
150
+ "combinator": "OR",
151
+ },
152
+ }
153
+ ],
154
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
155
+ "definition": {
156
+ "name": "FinalOutputNode",
157
+ "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
158
+ "bases": [
159
+ {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"], "bases": []}
160
+ ],
161
+ },
162
+ },
163
+ final_output_node,
164
+ ignore_order=True,
165
+ )
166
+
167
+ # AND each edge should be serialized correctly
168
+ serialized_edges = workflow_raw_data["edges"]
169
+ assert not DeepDiff(
170
+ [
171
+ {
172
+ "id": "9f753b40-68de-4186-838e-806a14853935",
173
+ "source_node_id": "09579c0a-acbf-4e04-8724-2230a8aa6534",
174
+ "source_handle_id": "34069190-0942-4e0c-8700-b33b9dea4ea0",
175
+ "target_node_id": "51cbe21d-0232-4362-bc54-5bc283297aa6",
176
+ "target_handle_id": "58427684-3848-498a-8299-c6b0fc70265d",
177
+ "type": "DEFAULT",
178
+ },
179
+ {
180
+ "id": "00cbff5c-5cce-4ef4-81b2-1a11d9b42597",
181
+ "source_node_id": "51cbe21d-0232-4362-bc54-5bc283297aa6",
182
+ "source_handle_id": "39317827-df43-4f5a-bfbc-20bffc839748",
183
+ "target_node_id": "9f75228b-1d5b-4c30-a581-6087e6a1b738",
184
+ "target_handle_id": "16ba108e-61a8-4338-8a5b-4f1278d7fd7b",
185
+ "type": "DEFAULT",
186
+ },
187
+ ],
188
+ serialized_edges,
189
+ ignore_order=True,
190
+ )
191
+
192
+ # AND the display data should be what we expect
193
+ display_data = workflow_raw_data["display_data"]
194
+ assert display_data == {
195
+ "viewport": {
196
+ "x": 0.0,
197
+ "y": 0.0,
198
+ "zoom": 1.0,
199
+ }
200
+ }
201
+
202
+ # AND the definition should be what we expect
203
+ definition = workflow_raw_data["definition"]
204
+ assert definition == {
205
+ "name": "BasicTemplatingNodeWorkflowWithJson",
206
+ "module": ["tests", "workflows", "basic_templating_node", "workflow_with_json_input"],
207
+ }
@@ -1,5 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import typing
4
-
5
- FulfilledEnum = typing.Literal["FULFILLED"]
@@ -1,5 +0,0 @@
1
- from .node import BaseSubworkflowNode
2
-
3
- __all__ = [
4
- "BaseSubworkflowNode",
5
- ]
@@ -1,10 +0,0 @@
1
- from typing import ClassVar, Generic
2
-
3
- from vellum.workflows.nodes.bases import BaseNode
4
- from vellum.workflows.types.core import EntityInputsInterface
5
- from vellum.workflows.types.generics import StateType
6
-
7
-
8
- class BaseSubworkflowNode(BaseNode[StateType], Generic[StateType]):
9
- # Inputs that are passed to the Subworkflow
10
- subworkflow_inputs: ClassVar[EntityInputsInterface] = {}
File without changes