vellum-ai 0.11.0__py3-none-any.whl → 0.11.3__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/__init__.py +18 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/types/__init__.py +30 -0
- vellum/client/types/document_document_to_document_index.py +6 -0
- vellum/client/types/slim_document.py +2 -2
- vellum/client/types/slim_document_document_to_document_index.py +43 -0
- vellum/client/types/test_suite_run_exec_config.py +7 -1
- vellum/client/types/test_suite_run_exec_config_request.py +8 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +31 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +27 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +27 -0
- vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +31 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +31 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +27 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +27 -0
- vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +31 -0
- vellum/types/slim_document_document_to_document_index.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +3 -0
- vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +3 -0
- vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +3 -0
- vellum/workflows/context.py +42 -0
- vellum/workflows/descriptors/base.py +1 -1
- vellum/workflows/nodes/bases/tests/test_base_node.py +1 -1
- vellum/workflows/nodes/core/inline_subworkflow_node/node.py +13 -7
- vellum/workflows/nodes/core/map_node/node.py +27 -4
- vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +21 -0
- vellum/workflows/nodes/displayable/api_node/node.py +3 -2
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +9 -0
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +10 -1
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +10 -1
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +1 -1
- vellum/workflows/runner/runner.py +74 -70
- vellum/workflows/workflows/event_filters.py +4 -1
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/METADATA +1 -1
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/RECORD +54 -35
- vellum_cli/pull.py +3 -1
- vellum_cli/tests/test_pull.py +18 -0
- vellum_ee/workflows/display/base.py +1 -2
- vellum_ee/workflows/display/nodes/vellum/api_node.py +53 -54
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +20 -1
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +15 -4
- vellum_ee/workflows/display/nodes/vellum/utils.py +26 -6
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +29 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +2 -2
- vellum_ee/workflows/display/vellum.py +4 -4
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +18 -9
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/LICENSE +0 -0
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/WHEEL +0 -0
- {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/entry_points.txt +0 -0
@@ -1,5 +1,5 @@
|
|
1
1
|
from uuid import UUID
|
2
|
-
from typing import Any, List, Optional, cast
|
2
|
+
from typing import Any, List, Optional, Type, cast
|
3
3
|
|
4
4
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
5
5
|
from vellum.workflows.expressions.coalesce_expression import CoalesceExpression
|
@@ -13,6 +13,8 @@ from vellum_ee.workflows.display.vellum import (
|
|
13
13
|
NodeInput,
|
14
14
|
NodeInputValuePointer,
|
15
15
|
NodeInputValuePointerRule,
|
16
|
+
WorkspaceSecretData,
|
17
|
+
WorkspaceSecretPointer,
|
16
18
|
)
|
17
19
|
|
18
20
|
|
@@ -22,6 +24,7 @@ def create_node_input(
|
|
22
24
|
value: Any,
|
23
25
|
display_context: WorkflowDisplayContext,
|
24
26
|
input_id: Optional[UUID],
|
27
|
+
pointer_type: Optional[Type[NodeInputValuePointerRule]] = ConstantValuePointer,
|
25
28
|
) -> NodeInput:
|
26
29
|
input_id = input_id or uuid4_from_hash(f"{node_id}|{input_name}")
|
27
30
|
if (
|
@@ -33,7 +36,7 @@ def create_node_input(
|
|
33
36
|
if wrapped_node._is_wrapped_node:
|
34
37
|
value = getattr(wrapped_node.Outputs, value.name)
|
35
38
|
|
36
|
-
rules = create_node_input_value_pointer_rules(value, display_context)
|
39
|
+
rules = create_node_input_value_pointer_rules(value, display_context, pointer_type=pointer_type)
|
37
40
|
return NodeInput(
|
38
41
|
id=str(input_id),
|
39
42
|
key=input_name,
|
@@ -48,6 +51,7 @@ def create_node_input_value_pointer_rules(
|
|
48
51
|
value: Any,
|
49
52
|
display_context: WorkflowDisplayContext,
|
50
53
|
existing_rules: Optional[List[NodeInputValuePointerRule]] = None,
|
54
|
+
pointer_type: Optional[Type[NodeInputValuePointerRule]] = None,
|
51
55
|
) -> List[NodeInputValuePointerRule]:
|
52
56
|
node_input_value_pointer_rules: List[NodeInputValuePointerRule] = existing_rules or []
|
53
57
|
|
@@ -59,18 +63,34 @@ def create_node_input_value_pointer_rules(
|
|
59
63
|
|
60
64
|
if isinstance(value, CoalesceExpression):
|
61
65
|
# Recursively handle the left-hand side
|
62
|
-
lhs_rules = create_node_input_value_pointer_rules(value.lhs, display_context, [])
|
66
|
+
lhs_rules = create_node_input_value_pointer_rules(value.lhs, display_context, [], pointer_type=pointer_type)
|
63
67
|
node_input_value_pointer_rules.extend(lhs_rules)
|
64
68
|
|
65
69
|
# Handle the right-hand side
|
66
70
|
if not isinstance(value.rhs, CoalesceExpression):
|
67
|
-
rhs_rules = create_node_input_value_pointer_rules(
|
71
|
+
rhs_rules = create_node_input_value_pointer_rules(
|
72
|
+
value.rhs, display_context, [], pointer_type=pointer_type
|
73
|
+
)
|
68
74
|
node_input_value_pointer_rules.extend(rhs_rules)
|
69
75
|
else:
|
70
76
|
# Non-CoalesceExpression case
|
71
77
|
node_input_value_pointer_rules.append(create_node_input_value_pointer_rule(value, display_context))
|
72
78
|
else:
|
73
|
-
|
74
|
-
node_input_value_pointer_rules.append(
|
79
|
+
pointer = create_pointer(value, pointer_type)
|
80
|
+
node_input_value_pointer_rules.append(pointer)
|
75
81
|
|
76
82
|
return node_input_value_pointer_rules
|
83
|
+
|
84
|
+
|
85
|
+
def create_pointer(
|
86
|
+
value: Any,
|
87
|
+
pointer_type: Optional[Type[NodeInputValuePointerRule]] = None,
|
88
|
+
) -> NodeInputValuePointerRule:
|
89
|
+
if value is None:
|
90
|
+
if pointer_type is WorkspaceSecretPointer:
|
91
|
+
return WorkspaceSecretPointer(
|
92
|
+
type="WORKSPACE_SECRET", data=WorkspaceSecretData(type="STRING", workspace_secret_id=None)
|
93
|
+
)
|
94
|
+
|
95
|
+
vellum_variable_value = primitive_to_vellum_value(value)
|
96
|
+
return ConstantValuePointer(type="CONSTANT_VALUE", data=vellum_variable_value)
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py
CHANGED
@@ -119,6 +119,16 @@ def test_serialize_workflow(vellum_client):
|
|
119
119
|
"combinator": "OR",
|
120
120
|
},
|
121
121
|
},
|
122
|
+
{
|
123
|
+
"id": "fee5e3c9-442a-4922-ba80-5ee07361cea7",
|
124
|
+
"key": "bearer_token_value",
|
125
|
+
"value": {
|
126
|
+
"rules": [
|
127
|
+
{"type": "WORKSPACE_SECRET", "data": {"type": "STRING", "workspace_secret_id": None}}
|
128
|
+
],
|
129
|
+
"combinator": "OR",
|
130
|
+
},
|
131
|
+
},
|
122
132
|
{
|
123
133
|
"id": "2fcdfbc3-8095-4277-bb4a-a201fd326b54",
|
124
134
|
"key": "api_key_header_key",
|
@@ -143,6 +153,24 @@ def test_serialize_workflow(vellum_client):
|
|
143
153
|
"combinator": "OR",
|
144
154
|
},
|
145
155
|
},
|
156
|
+
{
|
157
|
+
"id": "57c31247-998a-430d-bb62-bf50eca7df35",
|
158
|
+
"key": "additional_header_key",
|
159
|
+
"value": {
|
160
|
+
"rules": [{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "additional_header"}}],
|
161
|
+
"combinator": "OR",
|
162
|
+
},
|
163
|
+
},
|
164
|
+
{
|
165
|
+
"id": "47b32274-f19b-4c15-b788-55c069c311c5",
|
166
|
+
"key": "additional_header_value",
|
167
|
+
"value": {
|
168
|
+
"rules": [
|
169
|
+
{"type": "CONSTANT_VALUE", "data": {"type": "STRING", "value": "additional header value"}}
|
170
|
+
],
|
171
|
+
"combinator": "OR",
|
172
|
+
},
|
173
|
+
},
|
146
174
|
],
|
147
175
|
"data": {
|
148
176
|
"label": "Simple A P I Node",
|
@@ -153,7 +181,7 @@ def test_serialize_workflow(vellum_client):
|
|
153
181
|
"method_input_id": "fd61b5ac-39f9-4cfe-a839-f8ce78c202df",
|
154
182
|
"body_input_id": "c3a17ceb-e201-4025-b18a-9162aac7705e",
|
155
183
|
"authorization_type_input_id": "3092bf23-3202-4f3e-874c-9a33ccc73459",
|
156
|
-
"bearer_token_value_input_id":
|
184
|
+
"bearer_token_value_input_id": "fee5e3c9-442a-4922-ba80-5ee07361cea7",
|
157
185
|
"api_key_header_key_input_id": "2fcdfbc3-8095-4277-bb4a-a201fd326b54",
|
158
186
|
"api_key_header_value_input_id": "d794bb51-a419-4fd8-be63-dfaf4166e831",
|
159
187
|
"additional_headers": [
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py
CHANGED
@@ -218,7 +218,7 @@ def test_serialize_workflow__await_all():
|
|
218
218
|
"source_node_id": "59243c65-053f-4ea6-9157-3f3edb1477bf",
|
219
219
|
"source_handle_id": "b9c5f52b-b714-46e8-a09c-38b4e770dd36",
|
220
220
|
"target_node_id": "37c10e8a-771b-432b-a767-31f5007851f0",
|
221
|
-
"target_handle_id": "
|
221
|
+
"target_handle_id": "42eeb66c-9792-4609-8c71-3a56f668f4dc",
|
222
222
|
"type": "DEFAULT",
|
223
223
|
},
|
224
224
|
{
|
@@ -226,7 +226,7 @@ def test_serialize_workflow__await_all():
|
|
226
226
|
"source_node_id": "127ef456-91bc-43c6-bd8b-1772db5e3cb5",
|
227
227
|
"source_handle_id": "b0bd17f3-4ce6-4232-9666-ec8afa161bf2",
|
228
228
|
"target_node_id": "37c10e8a-771b-432b-a767-31f5007851f0",
|
229
|
-
"target_handle_id": "
|
229
|
+
"target_handle_id": "f40ff7fb-de1b-4aa4-ba3c-7630f7357cbf",
|
230
230
|
"type": "DEFAULT",
|
231
231
|
},
|
232
232
|
{
|
@@ -74,7 +74,9 @@ class WorkflowMetaVellumDisplay(WorkflowMetaVellumDisplayOverrides):
|
|
74
74
|
|
75
75
|
@dataclass
|
76
76
|
class WorkflowInputsVellumDisplayOverrides(WorkflowInputsDisplay, WorkflowInputsDisplayOverrides):
|
77
|
-
|
77
|
+
name: Optional[str] = None
|
78
|
+
required: Optional[bool] = None
|
79
|
+
color: Optional[str] = None
|
78
80
|
|
79
81
|
|
80
82
|
@dataclass
|
@@ -115,8 +117,6 @@ class WorkflowOutputVellumDisplayOverrides(WorkflowOutputDisplay, WorkflowOutput
|
|
115
117
|
target_handle_id: UUID
|
116
118
|
display_data: NodeDisplayData
|
117
119
|
edge_id: UUID
|
118
|
-
# source_node_id: Optional[UUID]
|
119
|
-
# source_handle_id: Optional[UUID]
|
120
120
|
|
121
121
|
|
122
122
|
@dataclass
|
@@ -202,7 +202,7 @@ class InputVariablePointer(UniversalBaseModel):
|
|
202
202
|
|
203
203
|
class WorkspaceSecretData(UniversalBaseModel):
|
204
204
|
type: VellumVariableType
|
205
|
-
workspace_secret_id: str
|
205
|
+
workspace_secret_id: Optional[str] = None
|
206
206
|
|
207
207
|
|
208
208
|
class WorkspaceSecretPointer(UniversalBaseModel):
|
@@ -12,9 +12,9 @@ from vellum.workflows.references import WorkflowInputReference
|
|
12
12
|
from vellum.workflows.references.output import OutputReference
|
13
13
|
from vellum.workflows.types.core import JsonArray, JsonObject
|
14
14
|
from vellum.workflows.types.generics import WorkflowType
|
15
|
+
from vellum_ee.workflows.display.nodes import BaseMergeNodeDisplay
|
15
16
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
16
17
|
from vellum_ee.workflows.display.nodes.types import PortDisplay
|
17
|
-
from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
|
18
18
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
19
19
|
from vellum_ee.workflows.display.utils.uuids import uuid4_from_hash
|
20
20
|
from vellum_ee.workflows.display.utils.vellum import infer_vellum_variable_type, primitive_to_vellum_value
|
@@ -57,17 +57,17 @@ class VellumWorkflowDisplay(
|
|
57
57
|
def serialize(self, raise_errors: bool = True) -> JsonObject:
|
58
58
|
input_variables: JsonArray = []
|
59
59
|
for workflow_input, workflow_input_display in self.display_context.workflow_input_displays.items():
|
60
|
-
default = (
|
61
|
-
|
62
|
-
|
63
|
-
|
60
|
+
default = primitive_to_vellum_value(workflow_input.instance) if workflow_input.instance else None
|
61
|
+
required = (
|
62
|
+
workflow_input_display.required
|
63
|
+
if workflow_input_display.required is not None
|
64
|
+
else type(None) not in workflow_input.types
|
64
65
|
)
|
65
|
-
required = type(None) not in workflow_input.types
|
66
66
|
|
67
67
|
input_variables.append(
|
68
68
|
{
|
69
69
|
"id": str(workflow_input_display.id),
|
70
|
-
"key": workflow_input.name,
|
70
|
+
"key": workflow_input_display.name or workflow_input.name,
|
71
71
|
"type": infer_vellum_variable_type(workflow_input),
|
72
72
|
"default": default.dict() if default else None,
|
73
73
|
"required": required,
|
@@ -270,12 +270,16 @@ class VellumWorkflowDisplay(
|
|
270
270
|
self, workflow_input: WorkflowInputReference, overrides: Optional[WorkflowInputsVellumDisplayOverrides] = None
|
271
271
|
) -> WorkflowInputsVellumDisplay:
|
272
272
|
workflow_input_id: UUID
|
273
|
+
required = None
|
274
|
+
color = None
|
273
275
|
if overrides:
|
274
276
|
workflow_input_id = overrides.id
|
277
|
+
required = overrides.required
|
278
|
+
color = overrides.color
|
275
279
|
else:
|
276
280
|
workflow_input_id = uuid4_from_hash(f"{self.workflow_id}|inputs|id|{workflow_input.name}")
|
277
281
|
|
278
|
-
return WorkflowInputsVellumDisplay(id=workflow_input_id)
|
282
|
+
return WorkflowInputsVellumDisplay(id=workflow_input_id, required=required, color=color)
|
279
283
|
|
280
284
|
def _generate_entrypoint_display(
|
281
285
|
self,
|
@@ -363,7 +367,12 @@ class VellumWorkflowDisplay(
|
|
363
367
|
|
364
368
|
target_node_display = node_displays[target_node]
|
365
369
|
target_node_id = target_node_display.node_id
|
366
|
-
|
370
|
+
|
371
|
+
target_handle_id: UUID
|
372
|
+
if isinstance(target_node_display, BaseMergeNodeDisplay):
|
373
|
+
target_handle_id = target_node_display.get_target_handle_id_by_source_node_id(source_node_id)
|
374
|
+
else:
|
375
|
+
target_handle_id = target_node_display.get_target_handle_id()
|
367
376
|
|
368
377
|
return self._generate_edge_display_from_source(
|
369
378
|
source_node_id, source_handle_id, target_node_id, target_handle_id, overrides
|
File without changes
|
File without changes
|
File without changes
|