vellum-ai 0.10.8__py3-none-any.whl → 0.11.0__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/types/logical_operator.py +2 -0
- vellum/evaluations/resources.py +7 -12
- vellum/evaluations/utils/env.py +1 -3
- vellum/evaluations/utils/paginator.py +0 -1
- vellum/evaluations/utils/typing.py +1 -1
- vellum/evaluations/utils/uuid.py +1 -1
- vellum/plugins/vellum_mypy.py +3 -1
- vellum/workflows/descriptors/utils.py +27 -0
- vellum/workflows/events/__init__.py +0 -2
- vellum/workflows/events/node.py +7 -6
- vellum/workflows/events/tests/test_event.py +2 -2
- vellum/workflows/events/types.py +35 -30
- vellum/workflows/events/workflow.py +33 -8
- vellum/workflows/nodes/bases/base.py +49 -26
- vellum/workflows/nodes/bases/tests/test_base_node.py +0 -1
- vellum/workflows/nodes/core/templating_node/node.py +1 -0
- vellum/workflows/nodes/core/try_node/node.py +22 -4
- vellum/workflows/nodes/core/try_node/tests/test_node.py +16 -3
- vellum/workflows/nodes/displayable/bases/api_node/node.py +1 -1
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +0 -1
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +0 -1
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +2 -1
- vellum/workflows/nodes/displayable/bases/search_node.py +0 -1
- vellum/workflows/nodes/displayable/code_execution_node/tests/test_code_execution_node.py +0 -1
- vellum/workflows/nodes/displayable/code_execution_node/utils.py +3 -2
- vellum/workflows/nodes/displayable/conditional_node/node.py +1 -1
- vellum/workflows/nodes/displayable/guardrail_node/node.py +0 -1
- vellum/workflows/nodes/displayable/inline_prompt_node/node.py +1 -0
- vellum/workflows/nodes/displayable/prompt_deployment_node/node.py +3 -1
- vellum/workflows/nodes/displayable/search_node/node.py +1 -0
- vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +3 -2
- vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +10 -7
- vellum/workflows/nodes/displayable/tests/test_search_node_wth_text_output.py +0 -1
- vellum/workflows/outputs/base.py +2 -4
- vellum/workflows/ports/node_ports.py +1 -1
- vellum/workflows/runner/runner.py +185 -157
- vellum/workflows/state/base.py +55 -23
- vellum/workflows/state/context.py +26 -3
- vellum/workflows/types/core.py +1 -0
- vellum/workflows/types/tests/test_utils.py +1 -0
- vellum/workflows/types/utils.py +0 -1
- vellum/workflows/utils/functions.py +74 -0
- vellum/workflows/utils/tests/test_functions.py +171 -0
- vellum/workflows/utils/tests/test_vellum_variables.py +0 -1
- vellum/workflows/utils/vellum_variables.py +2 -2
- vellum/workflows/workflows/base.py +84 -10
- vellum/workflows/workflows/event_filters.py +53 -0
- {vellum_ai-0.10.8.dist-info → vellum_ai-0.11.0.dist-info}/METADATA +1 -1
- {vellum_ai-0.10.8.dist-info → vellum_ai-0.11.0.dist-info}/RECORD +101 -93
- vellum_cli/__init__.py +147 -13
- vellum_cli/config.py +0 -1
- vellum_cli/image_push.py +1 -1
- vellum_cli/pull.py +29 -19
- vellum_cli/push.py +9 -10
- vellum_cli/tests/__init__.py +0 -0
- vellum_cli/tests/conftest.py +40 -0
- vellum_cli/tests/test_main.py +11 -0
- vellum_cli/tests/test_pull.py +125 -71
- vellum_cli/tests/test_push.py +173 -0
- vellum_ee/workflows/display/nodes/base_node_display.py +3 -2
- vellum_ee/workflows/display/nodes/base_node_vellum_display.py +2 -2
- vellum_ee/workflows/display/nodes/get_node_display_class.py +1 -1
- vellum_ee/workflows/display/nodes/tests/test_base_node_display.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/__init__.py +5 -3
- vellum_ee/workflows/display/nodes/vellum/api_node.py +4 -7
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +39 -22
- vellum_ee/workflows/display/nodes/vellum/error_node.py +49 -0
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +0 -2
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +4 -2
- vellum_ee/workflows/display/nodes/vellum/map_node.py +11 -5
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -3
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +5 -5
- vellum_ee/workflows/display/nodes/vellum/utils.py +4 -4
- vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +45 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +13 -24
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +13 -39
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +203 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +62 -58
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +25 -4
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +2 -2
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +1 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -1
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +2 -2
- vellum_ee/workflows/display/types.py +4 -4
- vellum_ee/workflows/display/utils/vellum.py +2 -6
- vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py +4 -1
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +6 -2
- vellum/workflows/events/utils.py +0 -5
- vellum/workflows/runner/types.py +0 -16
- {vellum_ai-0.10.8.dist-info → vellum_ai-0.11.0.dist-info}/LICENSE +0 -0
- {vellum_ai-0.10.8.dist-info → vellum_ai-0.11.0.dist-info}/WHEEL +0 -0
- {vellum_ai-0.10.8.dist-info → vellum_ai-0.11.0.dist-info}/entry_points.txt +0 -0
@@ -30,9 +30,7 @@ def test_try_node__on_error_code__successfully_caught():
|
|
30
30
|
assert len(outputs) == 2
|
31
31
|
assert set(outputs) == {
|
32
32
|
BaseOutput(name="value"),
|
33
|
-
BaseOutput(
|
34
|
-
name="error", value=VellumError(message="This will be caught", code=VellumErrorCode.PROVIDER_ERROR)
|
35
|
-
),
|
33
|
+
BaseOutput(name="error", value=VellumError(message="This will be caught", code=VellumErrorCode.PROVIDER_ERROR)),
|
36
34
|
}
|
37
35
|
|
38
36
|
|
@@ -111,3 +109,18 @@ def test_try_node__use_parent_execution_context():
|
|
111
109
|
# THEN the inner node had access to the key
|
112
110
|
assert len(outputs) == 1
|
113
111
|
assert outputs[-1] == BaseOutput(name="key", value="test-key")
|
112
|
+
|
113
|
+
|
114
|
+
def test_try_node__resolved_inputs():
|
115
|
+
"""
|
116
|
+
This test ensures that node attributes of TryNodes are correctly resolved.
|
117
|
+
"""
|
118
|
+
|
119
|
+
class State(BaseState):
|
120
|
+
counter = 3.0
|
121
|
+
|
122
|
+
@TryNode.wrap()
|
123
|
+
class MyNode(BaseNode[State]):
|
124
|
+
foo = State.counter
|
125
|
+
|
126
|
+
assert MyNode.foo.types == (float,)
|
@@ -8,7 +8,7 @@ from vellum.workflows.errors.types import VellumErrorCode
|
|
8
8
|
from vellum.workflows.exceptions import NodeException
|
9
9
|
from vellum.workflows.nodes.bases import BaseNode
|
10
10
|
from vellum.workflows.outputs import BaseOutputs
|
11
|
-
from vellum.workflows.types.core import Json,
|
11
|
+
from vellum.workflows.types.core import Json, VellumSecret
|
12
12
|
from vellum.workflows.types.generics import StateType
|
13
13
|
|
14
14
|
|
@@ -3,7 +3,6 @@ from typing import ClassVar, Generator, Generic, Iterator, List, Optional, Union
|
|
3
3
|
|
4
4
|
from vellum import AdHocExecutePromptEvent, ExecutePromptEvent, PromptOutput
|
5
5
|
from vellum.core import RequestOptions
|
6
|
-
|
7
6
|
from vellum.workflows.errors.types import VellumErrorCode
|
8
7
|
from vellum.workflows.exceptions import NodeException
|
9
8
|
from vellum.workflows.nodes.bases import BaseNode
|
@@ -25,7 +25,8 @@ class BasePromptDeploymentNode(BasePromptNode, Generic[StateType]):
|
|
25
25
|
prompt_inputs: EntityInputsInterface - The inputs for the Prompt
|
26
26
|
deployment: Union[UUID, str] - Either the Prompt Deployment's UUID or its name.
|
27
27
|
release_tag: str - The release tag to use for the Prompt Execution
|
28
|
-
external_id: Optional[str] - Optionally include a unique identifier for tracking purposes.
|
28
|
+
external_id: Optional[str] - Optionally include a unique identifier for tracking purposes.
|
29
|
+
Must be unique within a given Prompt Deployment.
|
29
30
|
expand_meta: Optional[PromptDeploymentExpandMetaRequest] - Expandable execution fields to include in the response
|
30
31
|
raw_overrides: Optional[RawPromptExecutionOverridesRequest] - The raw overrides to use for the Prompt Execution
|
31
32
|
expand_raw: Optional[Sequence[str]] - Expandable raw fields to include in the response
|
@@ -12,7 +12,6 @@ from vellum import (
|
|
12
12
|
SearchWeightsRequest,
|
13
13
|
)
|
14
14
|
from vellum.core import ApiError, RequestOptions
|
15
|
-
|
16
15
|
from vellum.workflows.errors import VellumErrorCode
|
17
16
|
from vellum.workflows.exceptions import NodeException
|
18
17
|
from vellum.workflows.nodes.bases import BaseNode
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import os
|
2
2
|
|
3
3
|
from vellum import CodeExecutorResponse, NumberVellumValue, StringInput
|
4
|
-
|
5
4
|
from vellum.workflows.inputs.base import BaseInputs
|
6
5
|
from vellum.workflows.nodes.displayable.code_execution_node import CodeExecutionNode
|
7
6
|
from vellum.workflows.references.vellum_secret import VellumSecretReference
|
@@ -4,12 +4,13 @@ from typing import Union
|
|
4
4
|
|
5
5
|
def get_project_root() -> str:
|
6
6
|
current_dir = os.getcwd()
|
7
|
-
while current_dir !=
|
7
|
+
while current_dir != "/":
|
8
8
|
if ".git" in os.listdir(current_dir):
|
9
9
|
return current_dir
|
10
10
|
current_dir = os.path.dirname(current_dir)
|
11
11
|
raise FileNotFoundError("Project root not found.")
|
12
12
|
|
13
|
+
|
13
14
|
def read_file_from_path(filepath: str) -> Union[str, None]:
|
14
15
|
project_root = get_project_root()
|
15
16
|
relative_filepath = os.path.join(project_root, filepath)
|
@@ -17,5 +18,5 @@ def read_file_from_path(filepath: str) -> Union[str, None]:
|
|
17
18
|
if not os.path.exists(relative_filepath):
|
18
19
|
return None
|
19
20
|
|
20
|
-
with open(relative_filepath
|
21
|
+
with open(relative_filepath) as file:
|
21
22
|
return file.read()
|
@@ -15,7 +15,7 @@ class ConditionalNode(BaseNode):
|
|
15
15
|
"""
|
16
16
|
|
17
17
|
class Ports(NodePorts):
|
18
|
-
def __call__(self, outputs: BaseOutputs, state: BaseState) -> Set[Port]:
|
18
|
+
def __call__(self, outputs: BaseOutputs, state: BaseState) -> Set[Port]:
|
19
19
|
all_ports = [port for port in self.__class__]
|
20
20
|
enforce_single_invoked_port = validate_ports(all_ports)
|
21
21
|
|
@@ -3,7 +3,6 @@ from typing import Any, ClassVar, Dict, Generic, List, Optional, Union, cast
|
|
3
3
|
|
4
4
|
from vellum import ChatHistoryInput, ChatMessage, JsonInput, MetricDefinitionInput, NumberInput, StringInput
|
5
5
|
from vellum.core import RequestOptions
|
6
|
-
|
7
6
|
from vellum.workflows.constants import LATEST_RELEASE_TAG
|
8
7
|
from vellum.workflows.errors.types import VellumErrorCode
|
9
8
|
from vellum.workflows.exceptions import NodeException
|
@@ -14,7 +14,8 @@ class PromptDeploymentNode(BasePromptDeploymentNode[StateType]):
|
|
14
14
|
prompt_inputs: EntityInputsInterface - The inputs for the Prompt
|
15
15
|
deployment: Union[UUID, str] - Either the Prompt Deployment's UUID or its name.
|
16
16
|
release_tag: str - The release tag to use for the Prompt Execution
|
17
|
-
external_id: Optional[str] - Optionally include a unique identifier for tracking purposes.
|
17
|
+
external_id: Optional[str] - Optionally include a unique identifier for tracking purposes.
|
18
|
+
Must be unique within a given Prompt Deployment.
|
18
19
|
expand_meta: Optional[PromptDeploymentExpandMetaRequest] - Expandable execution fields to include in the response
|
19
20
|
raw_overrides: Optional[RawPromptExecutionOverridesRequest] - The raw overrides to use for the Prompt Execution
|
20
21
|
expand_raw: Optional[Sequence[str]] - Expandable raw fields to include in the response
|
@@ -28,6 +29,7 @@ class PromptDeploymentNode(BasePromptDeploymentNode[StateType]):
|
|
28
29
|
|
29
30
|
text: str - The result of the Prompt Execution
|
30
31
|
"""
|
32
|
+
|
31
33
|
text: str
|
32
34
|
|
33
35
|
def run(self) -> Iterator[BaseOutput]:
|
@@ -27,8 +27,9 @@ class SubworkflowDeploymentNode(BaseSubworkflowNode[StateType], Generic[StateTyp
|
|
27
27
|
subworkflow_inputs: EntityInputsInterface - The inputs for the Subworkflow
|
28
28
|
deployment: Union[UUID, str] - Either the Workflow Deployment's UUID or its name.
|
29
29
|
release_tag: str = LATEST_RELEASE_TAG - The release tag to use for the Workflow Execution
|
30
|
-
external_id: Optional[str] = OMIT - Optionally include a unique identifier for tracking purposes.
|
31
|
-
|
30
|
+
external_id: Optional[str] = OMIT - Optionally include a unique identifier for tracking purposes.
|
31
|
+
Must be unique within a given Workflow Deployment.
|
32
|
+
expand_meta: Optional[WorkflowExpandMetaRequest] = OMIT - Expandable execution fields to include in the response
|
32
33
|
metadata: Optional[Dict[str, Optional[Any]]] = OMIT - The metadata to use for the Workflow Execution
|
33
34
|
request_options: Optional[RequestOptions] = None - The request options to use for the Workflow Execution
|
34
35
|
"""
|
@@ -138,10 +138,13 @@ def test_inline_text_prompt_node__catch_provider_error(vellum_adhoc_prompt_clien
|
|
138
138
|
outputs = list(node.run())
|
139
139
|
|
140
140
|
# THEN the node should have produced the outputs we expect
|
141
|
-
assert
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
141
|
+
assert (
|
142
|
+
BaseOutput(
|
143
|
+
name="error",
|
144
|
+
value=SdkVellumError(
|
145
|
+
message="OpenAI failed",
|
146
|
+
code=VellumErrorCode.PROVIDER_ERROR,
|
147
|
+
),
|
148
|
+
)
|
149
|
+
in outputs
|
150
|
+
)
|
@@ -11,7 +11,6 @@ from vellum import (
|
|
11
11
|
SearchResultMergingRequest,
|
12
12
|
SearchWeightsRequest,
|
13
13
|
)
|
14
|
-
|
15
14
|
from vellum.workflows.inputs import BaseInputs
|
16
15
|
from vellum.workflows.nodes.displayable.search_node import SearchNode as BaseSearchNode
|
17
16
|
from vellum.workflows.state import BaseState
|
vellum/workflows/outputs/base.py
CHANGED
@@ -90,7 +90,7 @@ class BaseOutput(Generic[_Delta, _Accumulated]):
|
|
90
90
|
return False
|
91
91
|
|
92
92
|
return self.name == other.name and self.value == other.value and self.delta == other.delta
|
93
|
-
|
93
|
+
|
94
94
|
def __hash__(self) -> int:
|
95
95
|
return hash((self._name, self._value, self._value))
|
96
96
|
|
@@ -193,9 +193,7 @@ class BaseOutputs(metaclass=_BaseOutputsMeta):
|
|
193
193
|
if not isinstance(other, dict):
|
194
194
|
return super().__eq__(other)
|
195
195
|
|
196
|
-
outputs = {
|
197
|
-
name: value for name, value in vars(self).items() if not name.startswith("_") and value is not UNDEF
|
198
|
-
}
|
196
|
+
outputs = {name: value for name, value in vars(self).items() if not name.startswith("_") and value is not UNDEF}
|
199
197
|
return outputs == other
|
200
198
|
|
201
199
|
def __repr__(self) -> str:
|