vellum-ai 0.12.17__py3-none-any.whl → 0.13.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. vellum/__init__.py +10 -22
  2. vellum/client/__init__.py +8 -0
  3. vellum/client/core/client_wrapper.py +1 -1
  4. vellum/client/core/pydantic_utilities.py +5 -0
  5. vellum/client/resources/__init__.py +4 -0
  6. vellum/client/resources/organizations/__init__.py +2 -0
  7. vellum/client/resources/organizations/client.py +116 -0
  8. vellum/client/resources/workflows/client.py +8 -0
  9. vellum/client/resources/workspaces/__init__.py +2 -0
  10. vellum/client/resources/workspaces/client.py +114 -0
  11. vellum/client/types/__init__.py +6 -22
  12. vellum/client/types/logical_operator.py +2 -0
  13. vellum/client/types/new_member_join_behavior_enum.py +8 -0
  14. vellum/client/types/{function_call_variable_value.py → organization_read.py} +6 -4
  15. vellum/client/types/workflow_execution_workflow_result_event.py +0 -2
  16. vellum/client/types/workflow_result_event.py +0 -2
  17. vellum/client/types/workflow_result_event_output_data_array.py +4 -4
  18. vellum/client/types/{string_variable_value.py → workspace_read.py} +12 -5
  19. vellum/{types/json_variable_value.py → resources/organizations/__init__.py} +1 -1
  20. vellum/resources/organizations/client.py +3 -0
  21. vellum/{types/image_variable_value.py → resources/workspaces/__init__.py} +1 -1
  22. vellum/{types/array_variable_value.py → resources/workspaces/client.py} +1 -1
  23. vellum/types/{array_variable_value_item.py → new_member_join_behavior_enum.py} +1 -1
  24. vellum/types/{audio_variable_value.py → organization_read.py} +1 -1
  25. vellum/types/{error_variable_value.py → workspace_read.py} +1 -1
  26. vellum/workflows/descriptors/base.py +1 -1
  27. vellum/workflows/descriptors/tests/test_utils.py +3 -0
  28. vellum/workflows/expressions/accessor.py +8 -2
  29. vellum/workflows/nodes/core/map_node/node.py +49 -24
  30. vellum/workflows/nodes/core/map_node/tests/test_node.py +4 -4
  31. vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +1 -1
  32. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +5 -3
  33. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +3 -0
  34. vellum/workflows/nodes/displayable/bases/search_node.py +37 -2
  35. vellum/workflows/nodes/displayable/bases/tests/__init__.py +0 -0
  36. vellum/workflows/nodes/displayable/bases/tests/test_utils.py +61 -0
  37. vellum/workflows/nodes/displayable/bases/types.py +42 -0
  38. vellum/workflows/nodes/displayable/bases/utils.py +112 -0
  39. vellum/workflows/nodes/displayable/inline_prompt_node/tests/test_node.py +0 -1
  40. vellum/workflows/nodes/displayable/search_node/tests/__init__.py +0 -0
  41. vellum/workflows/nodes/displayable/search_node/tests/test_node.py +164 -0
  42. vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +2 -3
  43. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +0 -1
  44. vellum/workflows/runner/runner.py +37 -4
  45. vellum/workflows/types/tests/test_utils.py +5 -2
  46. vellum/workflows/types/utils.py +4 -0
  47. vellum/workflows/workflows/base.py +14 -32
  48. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/METADATA +1 -1
  49. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/RECORD +100 -97
  50. vellum_cli/__init__.py +10 -0
  51. vellum_cli/ping.py +28 -0
  52. vellum_cli/tests/test_ping.py +47 -0
  53. vellum_ee/workflows/display/nodes/base_node_display.py +17 -10
  54. vellum_ee/workflows/display/nodes/vellum/api_node.py +1 -0
  55. vellum_ee/workflows/display/nodes/vellum/base_node.py +110 -2
  56. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +1 -0
  57. vellum_ee/workflows/display/nodes/vellum/conditional_node.py +5 -62
  58. vellum_ee/workflows/display/nodes/vellum/error_node.py +1 -0
  59. vellum_ee/workflows/display/nodes/vellum/final_output_node.py +1 -0
  60. vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -0
  61. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +4 -0
  62. vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +1 -0
  63. vellum_ee/workflows/display/nodes/vellum/map_node.py +2 -1
  64. vellum_ee/workflows/display/nodes/vellum/merge_node.py +1 -0
  65. vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -0
  66. vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +15 -10
  67. vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -0
  68. vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -0
  69. vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -0
  70. vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +2 -2
  71. vellum_ee/workflows/display/nodes/vellum/utils.py +71 -1
  72. vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +2 -5
  73. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +18 -2
  74. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +67 -0
  75. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +66 -0
  76. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +1015 -0
  77. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +37 -22
  78. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +12 -56
  79. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +43 -93
  80. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +31 -151
  81. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +8 -26
  82. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +4 -15
  83. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +9 -44
  84. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +19 -101
  85. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +19 -73
  86. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +9 -44
  87. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +9 -44
  88. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +8 -6
  89. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +11 -58
  90. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +8 -11
  91. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +7 -30
  92. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -11
  93. vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +9 -44
  94. vellum_ee/workflows/display/utils/vellum.py +4 -42
  95. vellum_ee/workflows/display/vellum.py +9 -43
  96. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +7 -10
  97. vellum_ee/workflows/server/virtual_file_loader.py +3 -3
  98. vellum/client/types/array_variable_value.py +0 -27
  99. vellum/client/types/array_variable_value_item.py +0 -29
  100. vellum/client/types/audio_variable_value.py +0 -25
  101. vellum/client/types/chat_history_variable_value.py +0 -21
  102. vellum/client/types/error_variable_value.py +0 -21
  103. vellum/client/types/image_variable_value.py +0 -25
  104. vellum/client/types/json_variable_value.py +0 -20
  105. vellum/client/types/number_variable_value.py +0 -20
  106. vellum/client/types/search_results_variable_value.py +0 -21
  107. vellum/types/chat_history_variable_value.py +0 -3
  108. vellum/types/function_call_variable_value.py +0 -3
  109. vellum/types/number_variable_value.py +0 -3
  110. vellum/types/search_results_variable_value.py +0 -3
  111. vellum/types/string_variable_value.py +0 -3
  112. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/LICENSE +0 -0
  113. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/WHEEL +0 -0
  114. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/entry_points.txt +0 -0
@@ -30,11 +30,8 @@ def test_vellum_workflow_display__serialize_empty_workflow():
30
30
  "nodes": [
31
31
  {
32
32
  "data": {"label": "Entrypoint Node", "source_handle_id": "508b8b82-3517-4672-a155-18c9c7b9c545"},
33
- "definition": {
34
- "bases": [],
35
- "module": ["vellum", "workflows", "nodes", "bases", "base"],
36
- "name": "BaseNode",
37
- },
33
+ "base": None,
34
+ "definition": None,
38
35
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
39
36
  "id": "9eef0c18-f322-4d56-aa89-f088d3e53f6a",
40
37
  "inputs": [],
@@ -1,16 +1,29 @@
1
1
  import pytest
2
2
  from uuid import uuid4
3
+ from typing import Dict, Tuple, Type
3
4
 
5
+ from vellum.workflows.nodes.bases.base import BaseNode
6
+ from vellum.workflows.references.output import OutputReference
7
+ from vellum.workflows.references.workflow_input import WorkflowInputReference
8
+ from vellum.workflows.types.core import JsonObject
9
+ from vellum.workflows.types.generics import NodeType
10
+ from vellum_ee.workflows.display.base import WorkflowInputsDisplayType
4
11
  from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
12
+ from vellum_ee.workflows.display.nodes.types import NodeOutputDisplay
5
13
  from vellum_ee.workflows.display.nodes.vellum.base_node import BaseNodeDisplay
6
- from vellum_ee.workflows.display.types import WorkflowDisplayContext
14
+ from vellum_ee.workflows.display.types import NodeDisplayType, WorkflowDisplayContext
7
15
  from vellum_ee.workflows.display.vellum import NodeDisplayData, WorkflowMetaVellumDisplay
8
16
  from vellum_ee.workflows.display.workflows.vellum_workflow_display import VellumWorkflowDisplay
9
17
 
10
18
 
11
19
  @pytest.fixture()
12
20
  def serialize_node():
13
- def _serialize_node(node_class) -> dict:
21
+ def _serialize_node(
22
+ node_class: Type[NodeType],
23
+ global_workflow_input_displays: Dict[WorkflowInputReference, WorkflowInputsDisplayType] = {},
24
+ global_node_displays: Dict[Type[BaseNode], NodeDisplayType] = {},
25
+ global_node_output_displays: Dict[OutputReference, Tuple[Type[BaseNode], NodeOutputDisplay]] = {},
26
+ ) -> JsonObject:
14
27
  node_display_class = get_node_display_class(BaseNodeDisplay, node_class)
15
28
  node_display = node_display_class()
16
29
 
@@ -22,6 +35,9 @@ def serialize_node():
22
35
  entrypoint_node_display=NodeDisplayData(),
23
36
  ),
24
37
  node_displays={node_class: node_display},
38
+ global_workflow_input_displays=global_workflow_input_displays,
39
+ global_node_displays=global_node_displays,
40
+ global_node_output_displays=global_node_output_displays,
25
41
  )
26
42
  return node_display.serialize(context)
27
43
 
@@ -0,0 +1,67 @@
1
+ import pytest
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.workflows.nodes.core.map_node.node import MapNode
8
+ from vellum.workflows.outputs.base import BaseOutputs
9
+ from vellum.workflows.state.base import BaseState
10
+
11
+
12
+ class Inputs(BaseInputs):
13
+ foo: str
14
+
15
+
16
+ class State(BaseState):
17
+ bar: str
18
+
19
+
20
+ @MapNode.wrap(items=[1, 2, 3])
21
+ class MapGenericNode(BaseNode):
22
+ item = MapNode.SubworkflowInputs.item
23
+ foo = Inputs.foo
24
+ bar = State.bar
25
+
26
+ class Outputs(BaseOutputs):
27
+ value: str
28
+
29
+ def run(self) -> Outputs:
30
+ return self.Outputs(value=f"{self.foo} {self.bar} {self.item}")
31
+
32
+
33
+ @pytest.mark.skip(reason="not implemented")
34
+ def test_serialize_node__try(serialize_node):
35
+ serialized_node = serialize_node(MapGenericNode)
36
+ assert not DeepDiff(
37
+ {
38
+ "id": "c2ed23f7-f6cb-4a56-a91c-2e5f9d8fda7f",
39
+ "label": "BasicGenericNode",
40
+ "type": "GENERIC",
41
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
42
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
43
+ "definition": {
44
+ "name": "BasicGenericNode",
45
+ "module": [
46
+ "vellum_ee",
47
+ "workflows",
48
+ "display",
49
+ "tests",
50
+ "workflow_serialization",
51
+ "generic_nodes",
52
+ "test_adornments_serialization",
53
+ ],
54
+ },
55
+ "trigger": {"id": "9d3a1b3d-4a38-4f2e-bbf1-dd8be152bce8", "merge_behavior": "AWAIT_ANY"},
56
+ "ports": [
57
+ {
58
+ "id": "4fbf0fff-a42e-4410-852a-238b5059198e",
59
+ "type": "DEFAULT",
60
+ }
61
+ ],
62
+ "adornments": None,
63
+ "attributes": [],
64
+ },
65
+ serialized_node,
66
+ ignore_order=True,
67
+ )
@@ -0,0 +1,66 @@
1
+ import pytest
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
+
8
+
9
+ class Inputs(BaseInputs):
10
+ input: str
11
+
12
+
13
+ class BasicGenericNode(BaseNode):
14
+ attr: str = "hello"
15
+
16
+ class Outputs(BaseNode.Outputs):
17
+ output = Inputs.input
18
+
19
+
20
+ @pytest.mark.skip(reason="not implemented")
21
+ def test_serialize_node__try(serialize_node):
22
+ serialized_node = serialize_node(BasicGenericNode)
23
+ assert not DeepDiff(
24
+ {
25
+ "id": "c2ed23f7-f6cb-4a56-a91c-2e5f9d8fda7f",
26
+ "label": "BasicGenericNode",
27
+ "type": "GENERIC",
28
+ "display_data": {"position": {"x": 0.0, "y": 0.0}},
29
+ "base": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"]},
30
+ "definition": {
31
+ "name": "BasicGenericNode",
32
+ "module": [
33
+ "vellum_ee",
34
+ "workflows",
35
+ "display",
36
+ "tests",
37
+ "workflow_serialization",
38
+ "generic_nodes",
39
+ "test_attributes_serialization",
40
+ ],
41
+ },
42
+ "trigger": {"id": "9d3a1b3d-4a38-4f2e-bbf1-dd8be152bce8", "merge_behavior": "AWAIT_ANY"},
43
+ "ports": [
44
+ {
45
+ "id": "4fbf0fff-a42e-4410-852a-238b5059198e",
46
+ "type": "DEFAULT",
47
+ }
48
+ ],
49
+ "adornments": None,
50
+ "attributes": [
51
+ {
52
+ "id": "e3c8b6e4-4b7d-4e3c-8a5c-6e5f4e3c8b6e",
53
+ "name": "attr",
54
+ "value": {
55
+ "type": "CONSTANT_VALUE",
56
+ "value": {
57
+ "type": "STRING",
58
+ "value": "hello",
59
+ },
60
+ },
61
+ }
62
+ ],
63
+ },
64
+ serialized_node,
65
+ ignore_order=True,
66
+ )