vellum-ai 1.8.1__py3-none-any.whl → 1.8.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.
- vellum/client/core/client_wrapper.py +2 -2
- vellum/workflows/nodes/displayable/final_output_node/node.py +7 -1
- vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py +28 -0
- {vellum_ai-1.8.1.dist-info → vellum_ai-1.8.2.dist-info}/METADATA +1 -1
- {vellum_ai-1.8.1.dist-info → vellum_ai-1.8.2.dist-info}/RECORD +10 -9
- vellum_ee/workflows/display/utils/expressions.py +4 -0
- vellum_ee/workflows/display/utils/tests/test_expressions.py +86 -0
- {vellum_ai-1.8.1.dist-info → vellum_ai-1.8.2.dist-info}/LICENSE +0 -0
- {vellum_ai-1.8.1.dist-info → vellum_ai-1.8.2.dist-info}/WHEEL +0 -0
- {vellum_ai-1.8.1.dist-info → vellum_ai-1.8.2.dist-info}/entry_points.txt +0 -0
|
@@ -27,10 +27,10 @@ class BaseClientWrapper:
|
|
|
27
27
|
|
|
28
28
|
def get_headers(self) -> typing.Dict[str, str]:
|
|
29
29
|
headers: typing.Dict[str, str] = {
|
|
30
|
-
"User-Agent": "vellum-ai/1.8.
|
|
30
|
+
"User-Agent": "vellum-ai/1.8.2",
|
|
31
31
|
"X-Fern-Language": "Python",
|
|
32
32
|
"X-Fern-SDK-Name": "vellum-ai",
|
|
33
|
-
"X-Fern-SDK-Version": "1.8.
|
|
33
|
+
"X-Fern-SDK-Version": "1.8.2",
|
|
34
34
|
**(self.get_custom_headers() or {}),
|
|
35
35
|
}
|
|
36
36
|
if self._api_version is not None:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any, Dict, Generic, Tuple, Type, TypeVar, get_args
|
|
1
|
+
from typing import Any, Dict, Generic, Tuple, Type, TypeVar, get_args, get_origin
|
|
2
2
|
|
|
3
3
|
from vellum.workflows.constants import undefined
|
|
4
4
|
from vellum.workflows.nodes.bases import BaseNode
|
|
@@ -74,6 +74,12 @@ class _FinalOutputNodeMeta(BaseNodeMeta):
|
|
|
74
74
|
if descriptor_type == declared_output_type:
|
|
75
75
|
type_mismatch = False
|
|
76
76
|
break
|
|
77
|
+
if (
|
|
78
|
+
get_origin(descriptor_type) == declared_output_type
|
|
79
|
+
or get_origin(declared_output_type) == descriptor_type
|
|
80
|
+
):
|
|
81
|
+
type_mismatch = False
|
|
82
|
+
break
|
|
77
83
|
try:
|
|
78
84
|
if issubclass(descriptor_type, declared_output_type) or issubclass(
|
|
79
85
|
declared_output_type, descriptor_type
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import pytest
|
|
2
|
+
from typing import Any, Dict
|
|
2
3
|
|
|
3
4
|
from vellum.workflows.exceptions import NodeException
|
|
4
5
|
from vellum.workflows.nodes.displayable.final_output_node import FinalOutputNode
|
|
5
6
|
from vellum.workflows.nodes.displayable.inline_prompt_node import InlinePromptNode
|
|
7
|
+
from vellum.workflows.references.output import OutputReference
|
|
6
8
|
from vellum.workflows.state.base import BaseState
|
|
7
9
|
|
|
8
10
|
|
|
@@ -57,3 +59,29 @@ def test_final_output_node__matching_output_type_should_pass_validation():
|
|
|
57
59
|
CorrectOutput.__validate__()
|
|
58
60
|
except ValueError:
|
|
59
61
|
pytest.fail("Validation should not raise an exception for correct type matching")
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_final_output_node__dict_and_Dict_should_be_compatible():
|
|
65
|
+
"""
|
|
66
|
+
Tests that FinalOutputNode validation recognizes dict and Dict[str, Any] as compatible types.
|
|
67
|
+
"""
|
|
68
|
+
|
|
69
|
+
# GIVEN a FinalOutputNode declared with dict output type
|
|
70
|
+
# AND the value descriptor has Dict[str, Any] type
|
|
71
|
+
class DictOutputNode(FinalOutputNode[BaseState, dict]):
|
|
72
|
+
"""Output with dict type."""
|
|
73
|
+
|
|
74
|
+
class Outputs(FinalOutputNode.Outputs):
|
|
75
|
+
value = OutputReference(
|
|
76
|
+
name="value",
|
|
77
|
+
types=(Dict[str, Any],),
|
|
78
|
+
instance=None,
|
|
79
|
+
outputs_class=FinalOutputNode.Outputs,
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
# WHEN attempting to validate the node class
|
|
83
|
+
# THEN validation should pass without raising an exception
|
|
84
|
+
try:
|
|
85
|
+
DictOutputNode.__validate__()
|
|
86
|
+
except ValueError as e:
|
|
87
|
+
pytest.fail(f"Validation should not raise an exception for dict/Dict compatibility: {e}")
|
|
@@ -121,11 +121,12 @@ vellum_ee/workflows/display/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeR
|
|
|
121
121
|
vellum_ee/workflows/display/utils/auto_layout.py,sha256=f4GiLn_LazweupfqTpubcdtdfE_vrOcmZudSsnYIY9E,3906
|
|
122
122
|
vellum_ee/workflows/display/utils/events.py,sha256=XcaQSfmk2s9ZNiU8__ZqH_zfp6KUVACczz9TBWVy7Jc,2208
|
|
123
123
|
vellum_ee/workflows/display/utils/exceptions.py,sha256=E8Lvo7LY1BoZ54M_NR_opDjJsAAiCUfow1HgoHcTHmg,989
|
|
124
|
-
vellum_ee/workflows/display/utils/expressions.py,sha256=
|
|
124
|
+
vellum_ee/workflows/display/utils/expressions.py,sha256=q6jgr13gET3rsAtz9XAPqtWQ2RKq_ZMq2OwrtyPhlRg,21345
|
|
125
125
|
vellum_ee/workflows/display/utils/registry.py,sha256=1qXiBTdsnro6FeCX0FGBEK7CIf6wa--Jt50iZ_nEp_M,3460
|
|
126
126
|
vellum_ee/workflows/display/utils/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
127
127
|
vellum_ee/workflows/display/utils/tests/test_auto_layout.py,sha256=vfXI769418s9vda5Gb5NFBH747WMOwSgHRXeLCTLVm8,2356
|
|
128
128
|
vellum_ee/workflows/display/utils/tests/test_events.py,sha256=CiBx4WxeNAf1WGfgRdJ_I-Hc12RDfza73CMLB5HkOFg,6688
|
|
129
|
+
vellum_ee/workflows/display/utils/tests/test_expressions.py,sha256=s8aHAwuuJS1_WI1B9geJCpTVKPk83XqrCI_ofVG80TI,4268
|
|
129
130
|
vellum_ee/workflows/display/utils/vellum.py,sha256=Bt7kdLdXoBsHn5dVEY2uKcF542VL09jwu8J_30rl2vk,6413
|
|
130
131
|
vellum_ee/workflows/display/vellum.py,sha256=J2mdJZ1sdLW535DDUkq_Vm8Z572vhuxHxVZF9deKSdk,391
|
|
131
132
|
vellum_ee/workflows/display/workflows/__init__.py,sha256=JTB9ObEV3l4gGGdtfBHwVJtTTKC22uj-a-XjTVwXCyA,148
|
|
@@ -163,7 +164,7 @@ vellum/client/README.md,sha256=flqu57ubZNTfpq60CdLtJC9gp4WEkyjb_n_eZ4OYf9w,6497
|
|
|
163
164
|
vellum/client/__init__.py,sha256=-nugZzQKoUJsStXe6PnOD__8kbDLKKokceDgpGxQ_q0,74576
|
|
164
165
|
vellum/client/core/__init__.py,sha256=lTcqUPXcx4112yLDd70RAPeqq6tu3eFMe1pKOqkW9JQ,1562
|
|
165
166
|
vellum/client/core/api_error.py,sha256=44vPoTyWN59gonCIZMdzw7M1uspygiLnr3GNFOoVL2Q,614
|
|
166
|
-
vellum/client/core/client_wrapper.py,sha256=
|
|
167
|
+
vellum/client/core/client_wrapper.py,sha256=R9FHIr5oH88cTW8SR-0nEW7PPcwHvfHMVIJ5NT-rUHM,2840
|
|
167
168
|
vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
|
168
169
|
vellum/client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
|
169
170
|
vellum/client/core/force_multipart.py,sha256=awxh5MtcRYe74ehY8U76jzv6fYM_w_D3Rur7KQQzSDk,429
|
|
@@ -1965,9 +1966,9 @@ vellum/workflows/nodes/displayable/conditional_node/__init__.py,sha256=AS_EIqFdU
|
|
|
1965
1966
|
vellum/workflows/nodes/displayable/conditional_node/node.py,sha256=2g32hWosE3zwVaK2UPFnVEer1Nbn04s3friF2rGztmE,1195
|
|
1966
1967
|
vellum/workflows/nodes/displayable/conftest.py,sha256=K2kLM2JGAfcrmmd92u8DXInUO5klFdggPWblg5RVcx4,5729
|
|
1967
1968
|
vellum/workflows/nodes/displayable/final_output_node/__init__.py,sha256=G7VXM4OWpubvSJtVkGmMNeqgb9GkM7qZT838eL18XU4,72
|
|
1968
|
-
vellum/workflows/nodes/displayable/final_output_node/node.py,sha256=
|
|
1969
|
+
vellum/workflows/nodes/displayable/final_output_node/node.py,sha256=ypetAGBaTjVozKqAos-C1LG5HHZ3iUekw7v2mnnUlOw,5175
|
|
1969
1970
|
vellum/workflows/nodes/displayable/final_output_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
1970
|
-
vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py,sha256=
|
|
1971
|
+
vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py,sha256=Drj7tMNEBDzHIYQ5iLkIK0zHHj-NxiswCtefVbfDFRo,3418
|
|
1971
1972
|
vellum/workflows/nodes/displayable/guardrail_node/__init__.py,sha256=Ab5eXmOoBhyV4dMWdzh32HLUmnPIBEK_zFCT38C4Fng,68
|
|
1972
1973
|
vellum/workflows/nodes/displayable/guardrail_node/node.py,sha256=axYUojar_kdB3gi4LG3g9euJ8VkOxNtiFxJNI46v-SQ,5869
|
|
1973
1974
|
vellum/workflows/nodes/displayable/guardrail_node/test_node.py,sha256=SAGv6hSFcBwQkudn1VxtaKNsXSXWWELl3eK05zM6tS0,5410
|
|
@@ -2098,8 +2099,8 @@ vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnad
|
|
|
2098
2099
|
vellum/workflows/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2099
2100
|
vellum/workflows/workflows/tests/test_base_workflow.py,sha256=Boa-_m9ii2Qsa1RvVM-VYniF7zCpzGgEGy-OnPZkrHg,23941
|
|
2100
2101
|
vellum/workflows/workflows/tests/test_context.py,sha256=VJBUcyWVtMa_lE5KxdhgMu0WYNYnUQUDvTF7qm89hJ0,2333
|
|
2101
|
-
vellum_ai-1.8.
|
|
2102
|
-
vellum_ai-1.8.
|
|
2103
|
-
vellum_ai-1.8.
|
|
2104
|
-
vellum_ai-1.8.
|
|
2105
|
-
vellum_ai-1.8.
|
|
2102
|
+
vellum_ai-1.8.2.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
|
|
2103
|
+
vellum_ai-1.8.2.dist-info/METADATA,sha256=nwlFb3WTY_gf483WFZdyHF2D8rUblIoUSF900h7Gn3o,5547
|
|
2104
|
+
vellum_ai-1.8.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
2105
|
+
vellum_ai-1.8.2.dist-info/entry_points.txt,sha256=xVavzAKN4iF_NbmhWOlOkHluka0YLkbN_pFQ9pW3gLI,117
|
|
2106
|
+
vellum_ai-1.8.2.dist-info/RECORD,,
|
|
@@ -27,6 +27,7 @@ from vellum.workflows.expressions.equals import EqualsExpression
|
|
|
27
27
|
from vellum.workflows.expressions.greater_than import GreaterThanExpression
|
|
28
28
|
from vellum.workflows.expressions.greater_than_or_equal_to import GreaterThanOrEqualToExpression
|
|
29
29
|
from vellum.workflows.expressions.in_ import InExpression
|
|
30
|
+
from vellum.workflows.expressions.is_error import IsErrorExpression
|
|
30
31
|
from vellum.workflows.expressions.is_nil import IsNilExpression
|
|
31
32
|
from vellum.workflows.expressions.is_not_nil import IsNotNilExpression
|
|
32
33
|
from vellum.workflows.expressions.is_not_null import IsNotNullExpression
|
|
@@ -105,6 +106,8 @@ def convert_descriptor_to_operator(descriptor: BaseDescriptor) -> LogicalOperato
|
|
|
105
106
|
return "doesNotBeginWith"
|
|
106
107
|
elif isinstance(descriptor, DoesNotEndWithExpression):
|
|
107
108
|
return "doesNotEndWith"
|
|
109
|
+
elif isinstance(descriptor, IsErrorExpression):
|
|
110
|
+
return "isError"
|
|
108
111
|
elif isinstance(descriptor, (IsNullExpression, IsNilExpression, IsUndefinedExpression)):
|
|
109
112
|
return "null"
|
|
110
113
|
elif isinstance(descriptor, (IsNotNullExpression, IsNotNilExpression, IsNotUndefinedExpression)):
|
|
@@ -166,6 +169,7 @@ def _serialize_condition(
|
|
|
166
169
|
if isinstance(
|
|
167
170
|
condition,
|
|
168
171
|
(
|
|
172
|
+
IsErrorExpression,
|
|
169
173
|
IsNullExpression,
|
|
170
174
|
IsNotNullExpression,
|
|
171
175
|
IsNilExpression,
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from vellum.workflows.expressions.begins_with import BeginsWithExpression
|
|
4
|
+
from vellum.workflows.expressions.between import BetweenExpression
|
|
5
|
+
from vellum.workflows.expressions.contains import ContainsExpression
|
|
6
|
+
from vellum.workflows.expressions.does_not_begin_with import DoesNotBeginWithExpression
|
|
7
|
+
from vellum.workflows.expressions.does_not_contain import DoesNotContainExpression
|
|
8
|
+
from vellum.workflows.expressions.does_not_end_with import DoesNotEndWithExpression
|
|
9
|
+
from vellum.workflows.expressions.does_not_equal import DoesNotEqualExpression
|
|
10
|
+
from vellum.workflows.expressions.ends_with import EndsWithExpression
|
|
11
|
+
from vellum.workflows.expressions.equals import EqualsExpression
|
|
12
|
+
from vellum.workflows.expressions.greater_than import GreaterThanExpression
|
|
13
|
+
from vellum.workflows.expressions.greater_than_or_equal_to import GreaterThanOrEqualToExpression
|
|
14
|
+
from vellum.workflows.expressions.in_ import InExpression
|
|
15
|
+
from vellum.workflows.expressions.is_error import IsErrorExpression
|
|
16
|
+
from vellum.workflows.expressions.is_not_null import IsNotNullExpression
|
|
17
|
+
from vellum.workflows.expressions.is_null import IsNullExpression
|
|
18
|
+
from vellum.workflows.expressions.less_than import LessThanExpression
|
|
19
|
+
from vellum.workflows.expressions.less_than_or_equal_to import LessThanOrEqualToExpression
|
|
20
|
+
from vellum.workflows.expressions.not_between import NotBetweenExpression
|
|
21
|
+
from vellum.workflows.expressions.not_in import NotInExpression
|
|
22
|
+
from vellum_ee.workflows.display.utils.expressions import convert_descriptor_to_operator
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def binary_expressions_with_lhs_and_rhs():
|
|
26
|
+
return [
|
|
27
|
+
(EqualsExpression(lhs="123", rhs="456"), "="),
|
|
28
|
+
(DoesNotEqualExpression(lhs="123", rhs="456"), "!="),
|
|
29
|
+
(LessThanExpression(lhs="123", rhs="456"), "<"),
|
|
30
|
+
(GreaterThanExpression(lhs="123", rhs="456"), ">"),
|
|
31
|
+
(LessThanOrEqualToExpression(lhs="123", rhs="456"), "<="),
|
|
32
|
+
(GreaterThanOrEqualToExpression(lhs="123", rhs="456"), ">="),
|
|
33
|
+
(ContainsExpression(lhs="123", rhs="456"), "contains"),
|
|
34
|
+
(BeginsWithExpression(lhs="123", rhs="456"), "beginsWith"),
|
|
35
|
+
(EndsWithExpression(lhs="123", rhs="456"), "endsWith"),
|
|
36
|
+
(DoesNotContainExpression(lhs="123", rhs="456"), "doesNotContain"),
|
|
37
|
+
(DoesNotBeginWithExpression(lhs="123", rhs="456"), "doesNotBeginWith"),
|
|
38
|
+
(DoesNotEndWithExpression(lhs="123", rhs="456"), "doesNotEndWith"),
|
|
39
|
+
(InExpression(lhs="123", rhs="456"), "in"),
|
|
40
|
+
(NotInExpression(lhs="123", rhs="456"), "notIn"),
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def unary_expressions_with_expression():
|
|
45
|
+
return [
|
|
46
|
+
(IsErrorExpression(expression="123"), "isError"),
|
|
47
|
+
(IsNullExpression(expression="123"), "null"),
|
|
48
|
+
(IsNotNullExpression(expression="123"), "notNull"),
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def ternary_expressions_with_value_and_start_and_end():
|
|
53
|
+
return [
|
|
54
|
+
(BetweenExpression(value="123", start="456", end="789"), "between"),
|
|
55
|
+
(NotBetweenExpression(value="123", start="456", end="789"), "notBetween"),
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@pytest.mark.parametrize("expression, expected_operator", binary_expressions_with_lhs_and_rhs())
|
|
60
|
+
def test_convert_descriptor_to_operator__binary_expressions(expression, expected_operator):
|
|
61
|
+
# GIVEN a binary expression descriptor
|
|
62
|
+
# WHEN we convert it to an operator string
|
|
63
|
+
result = convert_descriptor_to_operator(expression)
|
|
64
|
+
|
|
65
|
+
# THEN we should get the expected operator string
|
|
66
|
+
assert result == expected_operator
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@pytest.mark.parametrize("expression, expected_operator", unary_expressions_with_expression())
|
|
70
|
+
def test_convert_descriptor_to_operator__unary_expressions(expression, expected_operator):
|
|
71
|
+
# GIVEN a unary expression descriptor
|
|
72
|
+
# WHEN we convert it to an operator string
|
|
73
|
+
result = convert_descriptor_to_operator(expression)
|
|
74
|
+
|
|
75
|
+
# THEN we should get the expected operator string
|
|
76
|
+
assert result == expected_operator
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@pytest.mark.parametrize("expression, expected_operator", ternary_expressions_with_value_and_start_and_end())
|
|
80
|
+
def test_convert_descriptor_to_operator__ternary_expressions(expression, expected_operator):
|
|
81
|
+
# GIVEN a ternary expression descriptor
|
|
82
|
+
# WHEN we convert it to an operator string
|
|
83
|
+
result = convert_descriptor_to_operator(expression)
|
|
84
|
+
|
|
85
|
+
# THEN we should get the expected operator string
|
|
86
|
+
assert result == expected_operator
|
|
File without changes
|
|
File without changes
|
|
File without changes
|