vellum-ai 0.12.2__py3-none-any.whl → 0.12.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,11 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
- from ..environment import VellumEnvironment
4
3
  import typing
4
+
5
5
  import httpx
6
- from .http_client import HttpClient
7
- from .http_client import AsyncHttpClient
6
+
7
+ from ..environment import VellumEnvironment
8
+ from .http_client import AsyncHttpClient, HttpClient
8
9
 
9
10
 
10
11
  class BaseClientWrapper:
@@ -17,7 +18,7 @@ class BaseClientWrapper:
17
18
  headers: typing.Dict[str, str] = {
18
19
  "X-Fern-Language": "Python",
19
20
  "X-Fern-SDK-Name": "vellum-ai",
20
- "X-Fern-SDK-Version": "0.12.2",
21
+ "X-Fern-SDK-Version": "0.12.3",
21
22
  }
22
23
  headers["X_API_KEY"] = self.api_key
23
24
  return headers
@@ -13,7 +13,7 @@ class PromptRequestJsonInput(UniversalBaseModel):
13
13
  """
14
14
 
15
15
  type: typing.Literal["JSON"] = "JSON"
16
- value: typing.Dict[str, typing.Optional[typing.Any]]
16
+ value: typing.Optional[typing.Any] = None
17
17
 
18
18
  if IS_PYDANTIC_V2:
19
19
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -17,7 +17,9 @@ if TYPE_CHECKING:
17
17
  from vellum.workflows.expressions.greater_than_or_equal_to import GreaterThanOrEqualToExpression
18
18
  from vellum.workflows.expressions.in_ import InExpression
19
19
  from vellum.workflows.expressions.is_blank import IsBlankExpression
20
+ from vellum.workflows.expressions.is_nil import IsNilExpression
20
21
  from vellum.workflows.expressions.is_not_blank import IsNotBlankExpression
22
+ from vellum.workflows.expressions.is_not_nil import IsNotNilExpression
21
23
  from vellum.workflows.expressions.is_not_null import IsNotNullExpression
22
24
  from vellum.workflows.expressions.is_not_undefined import IsNotUndefinedExpression
23
25
  from vellum.workflows.expressions.is_null import IsNullExpression
@@ -268,6 +270,16 @@ class BaseDescriptor(Generic[_T]):
268
270
 
269
271
  return IsNotNullExpression(expression=self)
270
272
 
273
+ def is_nil(self) -> "IsNilExpression":
274
+ from vellum.workflows.expressions.is_nil import IsNilExpression
275
+
276
+ return IsNilExpression(expression=self)
277
+
278
+ def is_not_nil(self) -> "IsNotNilExpression":
279
+ from vellum.workflows.expressions.is_not_nil import IsNotNilExpression
280
+
281
+ return IsNotNilExpression(expression=self)
282
+
271
283
  def is_undefined(self) -> "IsUndefinedExpression":
272
284
  from vellum.workflows.expressions.is_undefined import IsUndefinedExpression
273
285
 
@@ -1,6 +1,7 @@
1
1
  import pytest
2
2
 
3
3
  from vellum.workflows.descriptors.utils import resolve_value
4
+ from vellum.workflows.nodes.bases.base import BaseNode
4
5
  from vellum.workflows.state.base import BaseState
5
6
 
6
7
 
@@ -16,6 +17,13 @@ class FixtureState(BaseState):
16
17
  "foo": "bar",
17
18
  }
18
19
 
20
+ eta = None
21
+
22
+
23
+ class DummyNode(BaseNode[FixtureState]):
24
+ class Outputs(BaseNode.Outputs):
25
+ empty: str
26
+
19
27
 
20
28
  @pytest.mark.parametrize(
21
29
  ["descriptor", "expected_value"],
@@ -36,7 +44,23 @@ class FixtureState(BaseState):
36
44
  (FixtureState.gamma.does_not_begin_with(FixtureState.delta), True),
37
45
  (FixtureState.gamma.does_not_end_with(FixtureState.delta), True),
38
46
  (FixtureState.alpha.is_null(), False),
47
+ (FixtureState.eta.is_null(), True),
48
+ (DummyNode.Outputs.empty.is_null(), False),
39
49
  (FixtureState.alpha.is_not_null(), True),
50
+ (FixtureState.eta.is_not_null(), False),
51
+ (DummyNode.Outputs.empty.is_not_null(), True),
52
+ (FixtureState.alpha.is_nil(), False),
53
+ (FixtureState.eta.is_nil(), True),
54
+ (DummyNode.Outputs.empty.is_nil(), True),
55
+ (FixtureState.alpha.is_not_nil(), True),
56
+ (FixtureState.eta.is_not_nil(), False),
57
+ (DummyNode.Outputs.empty.is_not_nil(), False),
58
+ (FixtureState.alpha.is_undefined(), False),
59
+ (FixtureState.eta.is_undefined(), False),
60
+ (DummyNode.Outputs.empty.is_undefined(), True),
61
+ (FixtureState.alpha.is_not_undefined(), True),
62
+ (FixtureState.eta.is_not_undefined(), True),
63
+ (DummyNode.Outputs.empty.is_not_undefined(), False),
40
64
  (FixtureState.delta.in_(FixtureState.gamma), True),
41
65
  (FixtureState.delta.not_in(FixtureState.gamma), False),
42
66
  (FixtureState.alpha.between(FixtureState.beta, FixtureState.epsilon), False),
@@ -66,8 +90,24 @@ class FixtureState(BaseState):
66
90
  "does_not_contain",
67
91
  "does_not_begin_with",
68
92
  "does_not_end_with",
69
- "is_null",
70
- "is_not_null",
93
+ "is_null_on_value",
94
+ "is_null_on_null",
95
+ "is_null_on_undefined",
96
+ "is_not_null_on_value",
97
+ "is_not_null_on_null",
98
+ "is_not_null_on_undefined",
99
+ "is_nil_on_value",
100
+ "is_nil_on_null",
101
+ "is_nil_on_undefined",
102
+ "is_not_nil_on_value",
103
+ "is_not_nil_on_null",
104
+ "is_not_nil_on_undefined",
105
+ "is_undefined_on_value",
106
+ "is_undefined_on_null",
107
+ "is_undefined_on_undefined",
108
+ "is_not_undefined_on_value",
109
+ "is_not_undefined_on_null",
110
+ "is_not_undefined_on_undefined",
71
111
  "in_",
72
112
  "not_in",
73
113
  "between",
@@ -0,0 +1,22 @@
1
+ from typing import Generic, TypeVar, Union
2
+
3
+ from vellum.workflows.constants import UNDEF
4
+ from vellum.workflows.descriptors.base import BaseDescriptor
5
+ from vellum.workflows.descriptors.utils import resolve_value
6
+ from vellum.workflows.state.base import BaseState
7
+
8
+ _T = TypeVar("_T")
9
+
10
+
11
+ class IsNilExpression(BaseDescriptor[bool], Generic[_T]):
12
+ def __init__(
13
+ self,
14
+ *,
15
+ expression: Union[BaseDescriptor[_T], _T],
16
+ ) -> None:
17
+ super().__init__(name=f"{expression} is null or undefined", types=(bool,))
18
+ self._expression = expression
19
+
20
+ def resolve(self, state: "BaseState") -> bool:
21
+ expression = resolve_value(self._expression, state)
22
+ return expression is None or expression is UNDEF
@@ -0,0 +1,22 @@
1
+ from typing import Generic, TypeVar, Union
2
+
3
+ from vellum.workflows.constants import UNDEF
4
+ from vellum.workflows.descriptors.base import BaseDescriptor
5
+ from vellum.workflows.descriptors.utils import resolve_value
6
+ from vellum.workflows.state.base import BaseState
7
+
8
+ _T = TypeVar("_T")
9
+
10
+
11
+ class IsNotNilExpression(BaseDescriptor[bool], Generic[_T]):
12
+ def __init__(
13
+ self,
14
+ *,
15
+ expression: Union[BaseDescriptor[_T], _T],
16
+ ) -> None:
17
+ super().__init__(name=f"{expression} is not null and not undefined", types=(bool,))
18
+ self._expression = expression
19
+
20
+ def resolve(self, state: "BaseState") -> bool:
21
+ expression = resolve_value(self._expression, state)
22
+ return expression is not None and expression is not UNDEF
@@ -13,7 +13,7 @@ class IsNotNullExpression(BaseDescriptor[bool], Generic[_T]):
13
13
  *,
14
14
  expression: Union[BaseDescriptor[_T], _T],
15
15
  ) -> None:
16
- super().__init__(name=f"{expression} is not None", types=(bool,))
16
+ super().__init__(name=f"{expression} is not null", types=(bool,))
17
17
  self._expression = expression
18
18
 
19
19
  def resolve(self, state: "BaseState") -> bool:
@@ -13,7 +13,7 @@ class IsNullExpression(BaseDescriptor[bool], Generic[_T]):
13
13
  *,
14
14
  expression: Union[BaseDescriptor[_T], _T],
15
15
  ) -> None:
16
- super().__init__(name=f"{expression} is None", types=(bool,))
16
+ super().__init__(name=f"{expression} is null", types=(bool,))
17
17
  self._expression = expression
18
18
 
19
19
  def resolve(self, state: "BaseState") -> bool:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vellum-ai
3
- Version: 0.12.2
3
+ Version: 0.12.3
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.9,<4.0
@@ -29,7 +29,7 @@ vellum_ee/workflows/display/nodes/utils.py,sha256=sloya5TpXsnot1HURc9L51INwflRqU
29
29
  vellum_ee/workflows/display/nodes/vellum/__init__.py,sha256=nmPLj8vkbVCS46XQqmHq8Xj8Mr36wCK_vWf26A9KIkw,1505
30
30
  vellum_ee/workflows/display/nodes/vellum/api_node.py,sha256=4SSQGecKWHuoGy5YIGJeOZVHGKwTs_8Y-gf3GvsHb0M,8506
31
31
  vellum_ee/workflows/display/nodes/vellum/code_execution_node.py,sha256=_sdLmmOa1ZqZQZXzw0GMoUpgnV1sdOfc_19LJCBS_Xc,4288
32
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py,sha256=9JjtXTpyC14X5e1ntue2BcDif-jJA-wyDBd3hE6_gv4,13282
32
+ vellum_ee/workflows/display/nodes/vellum/conditional_node.py,sha256=TP7ItMeEXbVbkGr5Qwjv8vl9V0Fi9QBE04d3kdJH4JE,13666
33
33
  vellum_ee/workflows/display/nodes/vellum/error_node.py,sha256=ygTjSjYDI4DtkxADWub5rhBnRWItMKWF6fezBrgpOKA,1979
34
34
  vellum_ee/workflows/display/nodes/vellum/final_output_node.py,sha256=t5iJQVoRT5g-v2IiUb4kFYdvUVKch0zn27016pzDZoo,2761
35
35
  vellum_ee/workflows/display/nodes/vellum/guardrail_node.py,sha256=3TJvHX_Uuf_gr94VkYc_zmNH8I5p71ChIeoAbJZ3ddY,2158
@@ -76,7 +76,7 @@ vellum/client/README.md,sha256=JkCJjmMZl4jrPj46pkmL9dpK4gSzQQmP5I7z4aME4LY,4749
76
76
  vellum/client/__init__.py,sha256=o4m7iRZWEV8rP3GkdaztHAjNmjxjWERlarviFoHzuKI,110927
77
77
  vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
78
78
  vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
79
- vellum/client/core/client_wrapper.py,sha256=3AlZG0Q4dIs1dgMiXCS_tnLozbk0PAelt6J52g8Tm3k,1890
79
+ vellum/client/core/client_wrapper.py,sha256=V6KKyJKYfRUGFN1-YsTg1jmCrvWiVWYEgcetm7xdB2U,1868
80
80
  vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
81
81
  vellum/client/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
82
82
  vellum/client/core/http_client.py,sha256=R0pQpCppnEtxccGvXl4uJ76s7ro_65Fo_erlNNLp_AI,19228
@@ -407,7 +407,7 @@ vellum/client/types/prompt_output.py,sha256=NpDGJNIYIivzQJnBeoJLpJlCk7gqBESLwv5Q
407
407
  vellum/client/types/prompt_parameters.py,sha256=Vkwh4zI9gX1DuGQxrWiUUa1TshTfnPlS7_yRrziD5qg,1046
408
408
  vellum/client/types/prompt_request_chat_history_input.py,sha256=DB2io5piMSyA89f5lnIVYO4MLZoNALNSufx8Y-oOwOE,790
409
409
  vellum/client/types/prompt_request_input.py,sha256=brEdYhYm74Ac8XjK9wF0rKOLgnqd_Cg19yMS7VfB4qQ,400
410
- vellum/client/types/prompt_request_json_input.py,sha256=6qLOPsNtDTIz43qJdZSgLwO9SWLe_plSJDH11xWGS6A,750
410
+ vellum/client/types/prompt_request_json_input.py,sha256=vLhwvCWL_yjVfDzT4921xK4Ql92OkvG-ruvOC_uppFI,739
411
411
  vellum/client/types/prompt_request_string_input.py,sha256=8GSFhtN3HeYssbDRY7B5SCh5Qrp67340D9c3oINpCmw,714
412
412
  vellum/client/types/prompt_settings.py,sha256=lSQeNofj9EzOncr81hGRE2ZBhgRCqDYMT5e3a66PuqA,586
413
413
  vellum/client/types/raw_prompt_execution_overrides_request.py,sha256=x4Chkm_NxXySOEyA6s6J_mhhiM91KCcQbu6pQETB8RI,927
@@ -1203,8 +1203,8 @@ vellum/workflows/__init__.py,sha256=CssPsbNvN6rDhoLuqpEv7MMKGa51vE6dvAh6U31Pcio,
1203
1203
  vellum/workflows/constants.py,sha256=Z0W4YlqfSlSgWC11PrVUPs6ZOBeIaQ78E_90J1hohiw,789
1204
1204
  vellum/workflows/context.py,sha256=R8qdsFbD_0p7B6PWnyvSrZ_aOgMtGw-_uk0P0UAmwLA,1230
1205
1205
  vellum/workflows/descriptors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1206
- vellum/workflows/descriptors/base.py,sha256=yLfr5qW5o7B2tLVvxEGeh-f6qiAQ735-9xrKOZ3HMc4,13830
1207
- vellum/workflows/descriptors/tests/test_utils.py,sha256=Ct8ZRdK3TghVzuqv3a4pWk6p04szt5KOaizzk9LhY5Y,2849
1206
+ vellum/workflows/descriptors/base.py,sha256=BhYd5O9_3fjS_Vet9Q2_kyUJCySHGVM_HWaOBtctkNA,14320
1207
+ vellum/workflows/descriptors/tests/test_utils.py,sha256=bjWNlmyCmtpDZmIzwYmS1Yh7kulmMO6LgNJFYVFCg4o,4377
1208
1208
  vellum/workflows/descriptors/utils.py,sha256=lO_dbr5g3PXpHPtVBkdguAK4-1qayZ7RXjl3BgAhrMM,3795
1209
1209
  vellum/workflows/edges/__init__.py,sha256=wSkmAnz9xyi4vZwtDbKxwlplt2skD7n3NsxkvR_pUus,50
1210
1210
  vellum/workflows/edges/edge.py,sha256=N0SnY3gKVuxImPAdCbPMPlHJIXbkQ3fwq_LbJRvVMFc,677
@@ -1238,10 +1238,12 @@ vellum/workflows/expressions/greater_than.py,sha256=nMi6iAo0vi2hM3JeKfQSCy7DnXbd
1238
1238
  vellum/workflows/expressions/greater_than_or_equal_to.py,sha256=xUDjfsOrJdoWm9K7OafGDGsuyvYS3xbMjyV4umvA50Q,1164
1239
1239
  vellum/workflows/expressions/in_.py,sha256=tdDTvePdG4WyRkwmSaA4hsUdFJNiIMlrEG6oRrUskjI,1028
1240
1240
  vellum/workflows/expressions/is_blank.py,sha256=u8mGreoZb5t_q2mhhmpD7ytAfFCFUAW9APsDapqUsDY,809
1241
+ vellum/workflows/expressions/is_nil.py,sha256=dtgY9Czm3slk45weARspwtfhQmVh0BIUsPOECrATLrA,740
1241
1242
  vellum/workflows/expressions/is_not_blank.py,sha256=npXK9KSUm0nWeT6WJ5LLKB3owgBXHr7SpH8j4W0WapI,816
1242
- vellum/workflows/expressions/is_not_null.py,sha256=_vIwikSUnk6F3NVukV3-9FwoX38qUpTyvaY2oIBwURg,671
1243
+ vellum/workflows/expressions/is_not_nil.py,sha256=M5Qhtp_H07PORjFN2WapwA1Njp_KaANmLWbfckSSscM,761
1244
+ vellum/workflows/expressions/is_not_null.py,sha256=EoHXFgZScKP_BM2a5Z7YFQN6l7RMEtzs5x5nlvaSST8,671
1243
1245
  vellum/workflows/expressions/is_not_undefined.py,sha256=8NGwA0wZP_aHRy5qJOtaNhRCJyXKekwBNJalSk6Rdmo,727
1244
- vellum/workflows/expressions/is_null.py,sha256=5hj3WcFTxGS9ULcPP5BNJu683l0f5gq85Gvj2Nz6Utg,660
1246
+ vellum/workflows/expressions/is_null.py,sha256=C75ALGlG_sTGcxI46tm9HtgPVfJ7DwTIyKzX8qtEiDU,660
1245
1247
  vellum/workflows/expressions/is_undefined.py,sha256=c9Oc1fdp911fQQ8WMG2L-TeUSqz1wF8cOTuLutJKbe8,716
1246
1248
  vellum/workflows/expressions/less_than.py,sha256=DTWjbhaegnsCWnFSLNldTQr94Dqg3rqWOgMWI7IVsII,1149
1247
1249
  vellum/workflows/expressions/less_than_or_equal_to.py,sha256=IxP1VeXAzXrccdIWT2hm6Fj3Sr-7rPW-DKOHl6MrHjo,1161
@@ -1377,8 +1379,8 @@ vellum/workflows/vellum_client.py,sha256=ODrq_TSl-drX2aezXegf7pizpWDVJuTXH-j6528
1377
1379
  vellum/workflows/workflows/__init__.py,sha256=KY45TqvavCCvXIkyCFMEc0dc6jTMOUci93U2DUrlZYc,66
1378
1380
  vellum/workflows/workflows/base.py,sha256=zpspOEdO5Ye_0ZvN-Wkzv9iQSiF1sD201ba8lhbnPbs,17086
1379
1381
  vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnadGsrSZGa7t7LpJA,2008
1380
- vellum_ai-0.12.2.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1381
- vellum_ai-0.12.2.dist-info/METADATA,sha256=alKUy1QGixY3flPix2H1o-GW9kh_xrF5CKtOm5EhJ6I,5128
1382
- vellum_ai-0.12.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1383
- vellum_ai-0.12.2.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1384
- vellum_ai-0.12.2.dist-info/RECORD,,
1382
+ vellum_ai-0.12.3.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1383
+ vellum_ai-0.12.3.dist-info/METADATA,sha256=2LiLS000opig2vlfeENocV4Y7ekElNjRgEXVR9ddQIY,5128
1384
+ vellum_ai-0.12.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1385
+ vellum_ai-0.12.3.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1386
+ vellum_ai-0.12.3.dist-info/RECORD,,
@@ -16,8 +16,12 @@ from vellum.workflows.expressions.equals import EqualsExpression
16
16
  from vellum.workflows.expressions.greater_than import GreaterThanExpression
17
17
  from vellum.workflows.expressions.greater_than_or_equal_to import GreaterThanOrEqualToExpression
18
18
  from vellum.workflows.expressions.in_ import InExpression
19
+ from vellum.workflows.expressions.is_nil import IsNilExpression
20
+ from vellum.workflows.expressions.is_not_nil import IsNotNilExpression
19
21
  from vellum.workflows.expressions.is_not_null import IsNotNullExpression
22
+ from vellum.workflows.expressions.is_not_undefined import IsNotUndefinedExpression
20
23
  from vellum.workflows.expressions.is_null import IsNullExpression
24
+ from vellum.workflows.expressions.is_undefined import IsUndefinedExpression
21
25
  from vellum.workflows.expressions.less_than import LessThanExpression
22
26
  from vellum.workflows.expressions.less_than_or_equal_to import LessThanOrEqualToExpression
23
27
  from vellum.workflows.expressions.not_between import NotBetweenExpression
@@ -242,9 +246,9 @@ but the defined conditions have length {len(condition_ids)}"""
242
246
  return "doesNotBeginWith"
243
247
  elif isinstance(descriptor, DoesNotEndWithExpression):
244
248
  return "doesNotEndWith"
245
- elif isinstance(descriptor, IsNullExpression):
249
+ elif isinstance(descriptor, (IsNullExpression, IsNilExpression, IsUndefinedExpression)):
246
250
  return "null"
247
- elif isinstance(descriptor, IsNotNullExpression):
251
+ elif isinstance(descriptor, (IsNotNullExpression, IsNotNilExpression, IsNotUndefinedExpression)):
248
252
  return "notNull"
249
253
  elif isinstance(descriptor, InExpression):
250
254
  return "in"