vellum-ai 0.13.0__py3-none-any.whl → 0.13.2__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.
Files changed (53) hide show
  1. vellum/client/core/client_wrapper.py +1 -1
  2. vellum/client/core/pydantic_utilities.py +5 -0
  3. vellum/client/resources/workflows/client.py +8 -0
  4. vellum/client/types/logical_operator.py +2 -0
  5. vellum/workflows/descriptors/base.py +1 -1
  6. vellum/workflows/descriptors/tests/test_utils.py +3 -0
  7. vellum/workflows/expressions/accessor.py +8 -2
  8. vellum/workflows/nodes/core/map_node/node.py +49 -24
  9. vellum/workflows/nodes/core/map_node/tests/test_node.py +4 -4
  10. vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +1 -1
  11. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +5 -3
  12. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +3 -0
  13. vellum/workflows/nodes/displayable/bases/search_node.py +37 -2
  14. vellum/workflows/nodes/displayable/bases/tests/__init__.py +0 -0
  15. vellum/workflows/nodes/displayable/bases/tests/test_utils.py +61 -0
  16. vellum/workflows/nodes/displayable/bases/types.py +42 -0
  17. vellum/workflows/nodes/displayable/bases/utils.py +112 -0
  18. vellum/workflows/nodes/displayable/inline_prompt_node/tests/test_node.py +0 -1
  19. vellum/workflows/nodes/displayable/search_node/tests/__init__.py +0 -0
  20. vellum/workflows/nodes/displayable/search_node/tests/test_node.py +164 -0
  21. vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +2 -3
  22. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +0 -1
  23. vellum/workflows/runner/runner.py +37 -4
  24. vellum/workflows/types/tests/test_utils.py +5 -2
  25. vellum/workflows/types/utils.py +4 -0
  26. vellum/workflows/workflows/base.py +14 -0
  27. {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/METADATA +1 -1
  28. {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/RECORD +53 -42
  29. vellum_cli/__init__.py +24 -0
  30. vellum_cli/ping.py +28 -0
  31. vellum_cli/push.py +62 -12
  32. vellum_cli/tests/test_ping.py +47 -0
  33. vellum_cli/tests/test_push.py +76 -0
  34. vellum_ee/workflows/display/nodes/vellum/base_node.py +59 -11
  35. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +3 -0
  36. vellum_ee/workflows/display/nodes/vellum/map_node.py +1 -1
  37. vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +14 -10
  38. vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +2 -2
  39. vellum_ee/workflows/display/nodes/vellum/utils.py +8 -1
  40. vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +48 -0
  41. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +67 -0
  42. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +286 -0
  43. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_outputs_serialization.py +177 -0
  44. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +666 -14
  45. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +7 -8
  46. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +35 -2
  47. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +29 -2
  48. vellum_ee/workflows/display/utils/vellum.py +4 -42
  49. vellum_ee/workflows/display/vellum.py +7 -36
  50. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +5 -2
  51. {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/LICENSE +0 -0
  52. {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/WHEEL +0 -0
  53. {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.2.dist-info}/entry_points.txt +0 -0
@@ -10,8 +10,7 @@ class Inputs(BaseInputs):
10
10
 
11
11
 
12
12
  class BasicGenericNode(BaseNode):
13
- class Outputs(BaseNode.Outputs):
14
- output = Inputs.input
13
+ pass
15
14
 
16
15
 
17
16
  def test_serialize_node__basic(serialize_node):
@@ -39,11 +38,13 @@ def test_serialize_node__basic(serialize_node):
39
38
  "ports": [
40
39
  {
41
40
  "id": "4fbf0fff-a42e-4410-852a-238b5059198e",
41
+ "name": "default",
42
42
  "type": "DEFAULT",
43
43
  }
44
44
  ],
45
45
  "adornments": None,
46
46
  "attributes": [],
47
+ "outputs": [],
47
48
  },
48
49
  serialized_node,
49
50
  ignore_order=True,
@@ -51,9 +52,6 @@ def test_serialize_node__basic(serialize_node):
51
52
 
52
53
 
53
54
  class AwaitAnyGenericNode(BaseNode):
54
- class Outputs(BaseNode.Outputs):
55
- output = Inputs.input
56
-
57
55
  class Trigger(BaseNode.Trigger):
58
56
  merge_behavior = MergeBehavior.AWAIT_ANY
59
57
 
@@ -83,11 +81,13 @@ def test_serialize_node__await_any(serialize_node):
83
81
  "ports": [
84
82
  {
85
83
  "id": "3e219c0a-e5f8-443a-ac78-1a458b189009",
84
+ "name": "default",
86
85
  "type": "DEFAULT",
87
86
  }
88
87
  ],
89
88
  "adornments": None,
90
89
  "attributes": [],
90
+ "outputs": [],
91
91
  },
92
92
  serialized_node,
93
93
  ignore_order=True,
@@ -95,9 +95,6 @@ def test_serialize_node__await_any(serialize_node):
95
95
 
96
96
 
97
97
  class AwaitAllGenericNode(BaseNode):
98
- class Outputs(BaseNode.Outputs):
99
- output = Inputs.input
100
-
101
98
  class Trigger(BaseNode.Trigger):
102
99
  merge_behavior = MergeBehavior.AWAIT_ALL
103
100
 
@@ -127,11 +124,13 @@ def test_serialize_node__await_all(serialize_node):
127
124
  "ports": [
128
125
  {
129
126
  "id": "9797e93f-9fe6-48b2-a48e-476abbd20e32",
127
+ "name": "default",
130
128
  "type": "DEFAULT",
131
129
  }
132
130
  ],
133
131
  "adornments": None,
134
132
  "attributes": [],
133
+ "outputs": [],
135
134
  },
136
135
  serialized_node,
137
136
  ignore_order=True,
@@ -141,9 +141,42 @@ def test_serialize_workflow():
141
141
  "module": ["tests", "workflows", "basic_inline_subworkflow", "workflow"],
142
142
  },
143
143
  "trigger": {"id": "a95a34f2-e894-4fb6-a2c9-15d12c1e3135", "merge_behavior": "AWAIT_ANY"},
144
- "ports": [{"id": "4a62dea3-6a4a-4390-88d8-4af5d2c81474", "type": "DEFAULT"}],
144
+ "ports": [
145
+ {"id": "4a62dea3-6a4a-4390-88d8-4af5d2c81474", "type": "DEFAULT", "name": "default"}
146
+ ],
145
147
  "adornments": None,
146
- "attributes": [],
148
+ "attributes": [
149
+ {
150
+ "id": "b0ac6b50-22a8-42ba-a707-1aa09a653205",
151
+ "name": "metro",
152
+ "value": {
153
+ "type": "WORKFLOW_INPUT",
154
+ "input_variable_id": "f2f5da15-026d-4905-bfe7-7d16bda20eed",
155
+ },
156
+ },
157
+ {
158
+ "id": "c5f2d66c-5bb6-4d2a-8e4d-5356318cd3ba",
159
+ "name": "date",
160
+ "value": {
161
+ "type": "WORKFLOW_INPUT",
162
+ "input_variable_id": "aba1e6e0-dfa7-4c15-a4e6-aec6feebfaca",
163
+ },
164
+ },
165
+ ],
166
+ "outputs": [
167
+ {
168
+ "id": "3f4c753e-f057-47bb-9748-7968283cc8aa",
169
+ "name": "temperature",
170
+ "type": "NUMBER",
171
+ "value": None,
172
+ },
173
+ {
174
+ "id": "2a4a62b3-cd26-4d2c-b3f1-eaa5f9dd22dd",
175
+ "name": "reasoning",
176
+ "type": "STRING",
177
+ "value": None,
178
+ },
179
+ ],
147
180
  },
148
181
  {
149
182
  "id": "a773c3a5-78cb-4250-8d29-7282e8a579d3",
@@ -130,9 +130,36 @@ def test_serialize_workflow():
130
130
  "module": ["tests", "workflows", "basic_map_node", "workflow"],
131
131
  },
132
132
  "trigger": {"id": "01324747-9bc0-4ecd-a8ab-40dca5a94e2e", "merge_behavior": "AWAIT_ANY"},
133
- "ports": [{"id": "36791877-95b0-4390-a794-10accd8f548e", "type": "DEFAULT"}],
133
+ "ports": [
134
+ {"id": "36791877-95b0-4390-a794-10accd8f548e", "type": "DEFAULT", "name": "default"}
135
+ ],
134
136
  "adornments": None,
135
- "attributes": [],
137
+ "attributes": [
138
+ {
139
+ "id": "4306b0ce-f31c-4c8f-8122-659d40e60ffe",
140
+ "name": "item",
141
+ "value": {
142
+ "type": "WORKFLOW_INPUT",
143
+ "input_variable_id": "b29bb546-9bc8-4136-857d-8c7a464ba9d4",
144
+ },
145
+ },
146
+ {
147
+ "id": "bca02056-0fd9-44c6-8aa9-743dd1180d48",
148
+ "name": "index",
149
+ "value": {
150
+ "type": "WORKFLOW_INPUT",
151
+ "input_variable_id": "17e7ca49-668f-450d-a792-e1f97d13db67",
152
+ },
153
+ },
154
+ ],
155
+ "outputs": [
156
+ {
157
+ "id": "a7bcb362-a2b8-4476-b0de-a361efeec204",
158
+ "name": "count",
159
+ "type": "NUMBER",
160
+ "value": None,
161
+ }
162
+ ],
136
163
  },
137
164
  {
138
165
  "id": "6f4883b2-70b1-4e1c-ae15-7d0f5aec810b",
@@ -1,10 +1,8 @@
1
- import enum
2
- import json
3
- import typing
4
- from typing import Any, List, Union, cast
1
+ from typing import Any, TypeVar
5
2
 
6
- from vellum import ChatMessage, SearchResult, SearchResultRequest, VellumVariableType
3
+ from vellum.client.types.vellum_variable_type import VellumVariableType
7
4
  from vellum.workflows.descriptors.base import BaseDescriptor
5
+ from vellum.workflows.nodes.displayable.bases.utils import primitive_to_vellum_value
8
6
  from vellum.workflows.references import OutputReference, WorkflowInputReference
9
7
  from vellum.workflows.references.execution_count import ExecutionCountReference
10
8
  from vellum.workflows.references.node import NodeReference
@@ -13,25 +11,19 @@ from vellum.workflows.utils.vellum_variables import primitive_type_to_vellum_var
13
11
  from vellum.workflows.vellum_client import create_vellum_client
14
12
  from vellum_ee.workflows.display.types import WorkflowDisplayContext
15
13
  from vellum_ee.workflows.display.vellum import (
16
- ChatHistoryVellumValue,
17
14
  ConstantValuePointer,
18
15
  ExecutionCounterData,
19
16
  ExecutionCounterPointer,
20
17
  InputVariableData,
21
18
  InputVariablePointer,
22
- JsonVellumValue,
23
19
  NodeInputValuePointerRule,
24
20
  NodeOutputData,
25
21
  NodeOutputPointer,
26
- NumberVellumValue,
27
- SearchResultsVellumValue,
28
- StringVellumValue,
29
- VellumValue,
30
22
  WorkspaceSecretData,
31
23
  WorkspaceSecretPointer,
32
24
  )
33
25
 
34
- _T = typing.TypeVar("_T")
26
+ _T = TypeVar("_T")
35
27
 
36
28
 
37
29
  def infer_vellum_variable_type(value: Any) -> VellumVariableType:
@@ -90,33 +82,3 @@ def create_node_input_value_pointer_rule(
90
82
  return ConstantValuePointer(type="CONSTANT_VALUE", data=vellum_value)
91
83
 
92
84
  raise ValueError(f"Unsupported descriptor type: {value.__class__.__name__}")
93
-
94
-
95
- def primitive_to_vellum_value(value: Any) -> VellumValue:
96
- """Converts a python primitive to a VellumVariableValue"""
97
-
98
- if isinstance(value, str):
99
- return StringVellumValue(value=value)
100
- elif isinstance(value, enum.Enum):
101
- return StringVellumValue(value=value.value)
102
- elif isinstance(value, (int, float)):
103
- return NumberVellumValue(value=value)
104
- elif isinstance(value, list) and (
105
- all(isinstance(message, ChatMessage) for message in value)
106
- or all(isinstance(message, ChatMessage) for message in value)
107
- ):
108
- chat_messages = cast(Union[List[ChatMessage], List[ChatMessage]], value)
109
- return ChatHistoryVellumValue(value=chat_messages)
110
- elif isinstance(value, list) and (
111
- all(isinstance(search_result, SearchResultRequest) for search_result in value)
112
- or all(isinstance(search_result, SearchResult) for search_result in value)
113
- ):
114
- search_results = cast(Union[List[SearchResultRequest], List[SearchResult]], value)
115
- return SearchResultsVellumValue(value=search_results)
116
-
117
- try:
118
- json_value = json.dumps(value)
119
- except json.JSONDecodeError:
120
- raise ValueError(f"Unsupported variable type: {value.__class__.__name__}")
121
-
122
- return JsonVellumValue(value=json.loads(json_value))
@@ -1,11 +1,13 @@
1
1
  from dataclasses import dataclass, field
2
2
  from enum import Enum
3
3
  from uuid import UUID
4
- from typing import Any, List, Literal, Optional, Union
4
+ from typing import List, Literal, Optional, Union
5
5
 
6
6
  from pydantic import Field
7
7
 
8
- from vellum import ChatMessage, PromptParameters, SearchResult, SearchResultRequest, VellumVariable, VellumVariableType
8
+ from vellum import PromptParameters, VellumVariable, VellumVariableType
9
+ from vellum.client.types.array_vellum_value import ArrayVellumValue
10
+ from vellum.client.types.vellum_value import VellumValue
9
11
  from vellum.core import UniversalBaseModel
10
12
  from vellum_ee.workflows.display.base import (
11
13
  EdgeDisplay,
@@ -140,45 +142,14 @@ class WorkflowNodeType(str, Enum):
140
142
  ERROR = "ERROR"
141
143
 
142
144
 
143
- class StringVellumValue(UniversalBaseModel):
144
- type: Literal["STRING"] = "STRING"
145
- value: str
146
-
147
-
148
- class NumberVellumValue(UniversalBaseModel):
149
- type: Literal["NUMBER"] = "NUMBER"
150
- value: Union[int, float]
151
-
152
-
153
- class ChatHistoryVellumValue(UniversalBaseModel):
154
- type: Literal["CHAT_HISTORY"] = "CHAT_HISTORY"
155
- value: Union[List[ChatMessage], List[ChatMessage]]
156
-
157
-
158
- class SearchResultsVellumValue(UniversalBaseModel):
159
- type: Literal["SEARCH_RESULTS"] = "SEARCH_RESULTS"
160
- value: Union[List[SearchResultRequest], List[SearchResult]]
161
-
162
-
163
- class JsonVellumValue(UniversalBaseModel):
164
- type: Literal["JSON"] = "JSON"
165
- value: Optional[Any] = None
166
-
167
-
168
- VellumValue = Union[
169
- StringVellumValue,
170
- NumberVellumValue,
171
- ChatHistoryVellumValue,
172
- SearchResultsVellumValue,
173
- JsonVellumValue,
174
- ]
175
-
176
-
177
145
  class ConstantValuePointer(UniversalBaseModel):
178
146
  type: Literal["CONSTANT_VALUE"] = "CONSTANT_VALUE"
179
147
  data: VellumValue
180
148
 
181
149
 
150
+ ArrayVellumValue.model_rebuild()
151
+
152
+
182
153
  class NodeOutputData(UniversalBaseModel):
183
154
  node_id: str
184
155
  output_id: str
@@ -5,6 +5,7 @@ from typing import Dict, List, Optional, Type, cast
5
5
  from vellum.workflows.descriptors.base import BaseDescriptor
6
6
  from vellum.workflows.edges import Edge
7
7
  from vellum.workflows.nodes.bases import BaseNode
8
+ from vellum.workflows.nodes.displayable.bases.utils import primitive_to_vellum_value
8
9
  from vellum.workflows.nodes.displayable.final_output_node import FinalOutputNode
9
10
  from vellum.workflows.nodes.utils import get_unadorned_node, get_unadorned_port, get_wrapped_node, has_wrapped_node
10
11
  from vellum.workflows.ports import Port
@@ -16,7 +17,7 @@ from vellum.workflows.utils.uuids import uuid4_from_hash
16
17
  from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
17
18
  from vellum_ee.workflows.display.nodes.types import PortDisplay
18
19
  from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
19
- from vellum_ee.workflows.display.utils.vellum import infer_vellum_variable_type, primitive_to_vellum_value
20
+ from vellum_ee.workflows.display.utils.vellum import infer_vellum_variable_type
20
21
  from vellum_ee.workflows.display.vellum import (
21
22
  EdgeVellumDisplay,
22
23
  EdgeVellumDisplayOverrides,
@@ -264,16 +265,18 @@ class VellumWorkflowDisplay(
264
265
  self, workflow_input: WorkflowInputReference, overrides: Optional[WorkflowInputsVellumDisplayOverrides] = None
265
266
  ) -> WorkflowInputsVellumDisplay:
266
267
  workflow_input_id: UUID
268
+ name = None
267
269
  required = None
268
270
  color = None
269
271
  if overrides:
270
272
  workflow_input_id = overrides.id
273
+ name = overrides.name
271
274
  required = overrides.required
272
275
  color = overrides.color
273
276
  else:
274
277
  workflow_input_id = uuid4_from_hash(f"{self.workflow_id}|inputs|id|{workflow_input.name}")
275
278
 
276
- return WorkflowInputsVellumDisplay(id=workflow_input_id, required=required, color=color)
279
+ return WorkflowInputsVellumDisplay(id=workflow_input_id, name=name, required=required, color=color)
277
280
 
278
281
  def _generate_entrypoint_display(
279
282
  self,