vellum-ai 1.3.1__py3-none-any.whl → 1.3.3__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 +6 -0
- vellum/client/README.md +5 -5
- vellum/client/__init__.py +20 -0
- vellum/client/core/client_wrapper.py +2 -2
- vellum/client/raw_client.py +20 -0
- vellum/client/reference.md +61 -27
- vellum/client/resources/ad_hoc/client.py +29 -29
- vellum/client/resources/ad_hoc/raw_client.py +13 -13
- vellum/client/resources/events/client.py +69 -33
- vellum/client/resources/events/raw_client.py +13 -9
- vellum/client/types/__init__.py +6 -0
- vellum/client/types/create_workflow_event_request.py +7 -0
- vellum/client/types/deprecated_prompt_request_input.py +8 -0
- vellum/client/types/event_create_response.py +5 -0
- vellum/client/types/logical_operator.py +1 -0
- vellum/client/types/processing_failure_reason_enum.py +3 -1
- vellum/client/types/slim_document.py +1 -0
- vellum/client/types/workflow_input.py +31 -0
- vellum/types/create_workflow_event_request.py +3 -0
- vellum/types/deprecated_prompt_request_input.py +3 -0
- vellum/types/workflow_input.py +3 -0
- vellum/workflows/constants.py +3 -0
- vellum/workflows/emitters/vellum_emitter.py +55 -9
- vellum/workflows/events/node.py +1 -0
- vellum/workflows/events/tests/test_event.py +1 -0
- vellum/workflows/events/workflow.py +1 -0
- vellum/workflows/nodes/core/retry_node/tests/test_node.py +1 -2
- vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +16 -0
- vellum/workflows/nodes/displayable/code_execution_node/tests/test_node.py +3 -13
- vellum/workflows/nodes/displayable/tool_calling_node/utils.py +6 -13
- vellum/workflows/nodes/tests/test_utils.py +23 -0
- vellum/workflows/nodes/utils.py +14 -0
- vellum/workflows/runner/runner.py +33 -12
- vellum/workflows/state/tests/test_state.py +14 -0
- vellum/workflows/types/code_execution_node_wrappers.py +5 -1
- vellum/workflows/utils/vellum_variables.py +11 -2
- {vellum_ai-1.3.1.dist-info → vellum_ai-1.3.3.dist-info}/METADATA +1 -1
- {vellum_ai-1.3.1.dist-info → vellum_ai-1.3.3.dist-info}/RECORD +49 -40
- vellum_cli/__init__.py +21 -0
- vellum_cli/move.py +56 -0
- vellum_cli/tests/test_move.py +154 -0
- vellum_ee/workflows/display/base.py +1 -0
- vellum_ee/workflows/display/editor/types.py +1 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +1 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py +16 -5
- vellum_ee/workflows/display/tests/workflow_serialization/test_web_search_node_serialization.py +81 -0
- {vellum_ai-1.3.1.dist-info → vellum_ai-1.3.3.dist-info}/LICENSE +0 -0
- {vellum_ai-1.3.1.dist-info → vellum_ai-1.3.3.dist-info}/WHEEL +0 -0
- {vellum_ai-1.3.1.dist-info → vellum_ai-1.3.3.dist-info}/entry_points.txt +0 -0
@@ -47,17 +47,20 @@ def test_serialize_workflow():
|
|
47
47
|
|
48
48
|
# AND its output variables should be what we expect
|
49
49
|
output_variables = serialized_workflow["output_variables"]
|
50
|
-
assert len(output_variables) ==
|
50
|
+
assert len(output_variables) == 2
|
51
51
|
assert not DeepDiff(
|
52
|
-
[
|
52
|
+
[
|
53
|
+
{"id": "15a0ab89-8ed4-43b9-afa2-3c0b29d4dc3e", "key": "results", "type": "JSON"},
|
54
|
+
{"id": "0ef1608e-1737-41cc-9b90-a8e124138f70", "key": "json", "type": "JSON"},
|
55
|
+
],
|
53
56
|
output_variables,
|
54
57
|
ignore_order=True,
|
55
58
|
)
|
56
59
|
|
57
60
|
# AND its raw data should be what we expect
|
58
61
|
workflow_raw_data = serialized_workflow["workflow_raw_data"]
|
59
|
-
assert len(workflow_raw_data["edges"]) ==
|
60
|
-
assert len(workflow_raw_data["nodes"]) ==
|
62
|
+
assert len(workflow_raw_data["edges"]) == 3
|
63
|
+
assert len(workflow_raw_data["nodes"]) == 4
|
61
64
|
|
62
65
|
# AND each node should be serialized correctly
|
63
66
|
entrypoint_node = workflow_raw_data["nodes"][0]
|
@@ -305,7 +308,7 @@ def test_serialize_workflow():
|
|
305
308
|
},
|
306
309
|
}
|
307
310
|
],
|
308
|
-
"display_data": {"position": {"x": 400.0, "y":
|
311
|
+
"display_data": {"position": {"x": 400.0, "y": 75.0}},
|
309
312
|
"base": {
|
310
313
|
"name": "FinalOutputNode",
|
311
314
|
"module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
|
@@ -336,6 +339,14 @@ def test_serialize_workflow():
|
|
336
339
|
"target_handle_id": "46c99277-2b4b-477d-851c-ea497aef6b16",
|
337
340
|
"type": "DEFAULT",
|
338
341
|
},
|
342
|
+
{
|
343
|
+
"id": "0b1a2960-4cd5-4045-844f-42b6c87487aa",
|
344
|
+
"source_node_id": "8450dd06-975a-41a4-a564-808ee8808fe6",
|
345
|
+
"source_handle_id": "d4a097ab-e22d-42f1-b6bc-2ed96856377a",
|
346
|
+
"target_node_id": "1f4e3b7b-6af1-42c8-ab33-05b0f01e2b62",
|
347
|
+
"target_handle_id": "7d94907f-c840-4ced-b813-ee3b17f2a8a9",
|
348
|
+
"type": "DEFAULT",
|
349
|
+
},
|
339
350
|
],
|
340
351
|
serialized_edges,
|
341
352
|
ignore_order=True,
|
vellum_ee/workflows/display/tests/workflow_serialization/test_web_search_node_serialization.py
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
2
|
+
|
3
|
+
from tests.workflows.web_search.workflow import WebSearchWorkflow
|
4
|
+
|
5
|
+
|
6
|
+
def test_serialize_web_search_workflow():
|
7
|
+
# GIVEN a WebSearchWorkflow with a node that has various input types
|
8
|
+
# - query from workflow input
|
9
|
+
# - api_key from VellumSecretReference
|
10
|
+
# - num_results as a constant integer
|
11
|
+
# - location as a constant string
|
12
|
+
|
13
|
+
# WHEN we serialize the workflow through the display system
|
14
|
+
workflow_display = get_workflow_display(workflow_class=WebSearchWorkflow)
|
15
|
+
serialized_workflow: dict = workflow_display.serialize()
|
16
|
+
|
17
|
+
# THEN we should get a properly structured serialized workflow
|
18
|
+
assert serialized_workflow.keys() == {
|
19
|
+
"workflow_raw_data",
|
20
|
+
"input_variables",
|
21
|
+
"state_variables",
|
22
|
+
"output_variables",
|
23
|
+
}
|
24
|
+
|
25
|
+
# AND it should have input variables
|
26
|
+
input_variables = serialized_workflow["input_variables"]
|
27
|
+
assert len(input_variables) == 1
|
28
|
+
assert input_variables[0]["key"] == "search_query"
|
29
|
+
assert input_variables[0]["type"] == "STRING"
|
30
|
+
|
31
|
+
# AND it should have output variables
|
32
|
+
output_variables = serialized_workflow["output_variables"]
|
33
|
+
assert len(output_variables) == 2
|
34
|
+
output_keys = {var["key"] for var in output_variables}
|
35
|
+
assert output_keys == {"search_results", "result_urls"}
|
36
|
+
|
37
|
+
# AND the web search node should be serialized as a GENERIC type node
|
38
|
+
workflow_raw_data = serialized_workflow["workflow_raw_data"]
|
39
|
+
nodes = workflow_raw_data["nodes"]
|
40
|
+
|
41
|
+
web_search_node = next(
|
42
|
+
(
|
43
|
+
node
|
44
|
+
for node in nodes
|
45
|
+
if node and node.get("type") == "GENERIC" and node.get("base", {}).get("name") == "WebSearchNode"
|
46
|
+
),
|
47
|
+
None,
|
48
|
+
)
|
49
|
+
|
50
|
+
assert web_search_node is not None, "WebSearchNode should be serialized as GENERIC type"
|
51
|
+
|
52
|
+
# AND it should have the correct base module reference
|
53
|
+
expected_base = {
|
54
|
+
"name": "WebSearchNode",
|
55
|
+
"module": ["vellum", "workflows", "nodes", "displayable", "web_search_node", "node"],
|
56
|
+
}
|
57
|
+
assert (
|
58
|
+
web_search_node["base"] == expected_base
|
59
|
+
), f"Base mismatch. Expected: {expected_base}, Found: {web_search_node['base']}"
|
60
|
+
|
61
|
+
# AND it should have all four serializable attributes defined in our display class
|
62
|
+
web_search_attributes = web_search_node["attributes"]
|
63
|
+
attribute_names = {attr["name"] for attr in web_search_attributes}
|
64
|
+
|
65
|
+
# AND the attributes should match exactly what we defined in __serializable_inputs__
|
66
|
+
assert attribute_names == {"query", "api_key", "num_results", "location"}
|
67
|
+
|
68
|
+
# AND it should have all three expected outputs from WebSearchNode
|
69
|
+
assert {output["name"] for output in web_search_node["outputs"]} == {"text", "urls", "results"}
|
70
|
+
|
71
|
+
# AND each attribute should have the correct value type based on its source
|
72
|
+
attr_types_by_name = {attr["name"]: attr["value"]["type"] for attr in web_search_attributes}
|
73
|
+
|
74
|
+
# AND query should reference the workflow input
|
75
|
+
assert attr_types_by_name["query"] == "WORKFLOW_INPUT"
|
76
|
+
# AND api_key should reference a Vellum secret
|
77
|
+
assert attr_types_by_name["api_key"] == "VELLUM_SECRET"
|
78
|
+
# AND num_results should be a constant value
|
79
|
+
assert attr_types_by_name["num_results"] == "CONSTANT_VALUE"
|
80
|
+
# AND location should be a constant value
|
81
|
+
assert attr_types_by_name["location"] == "CONSTANT_VALUE"
|
File without changes
|
File without changes
|
File without changes
|