vellum-ai 0.14.56__py3-none-any.whl → 0.14.58__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 +1 -1
- vellum/workflows/nodes/bases/base.py +19 -8
- vellum/workflows/nodes/core/retry_node/node.py +6 -0
- vellum/workflows/nodes/displayable/api_node/node.py +8 -1
- vellum/workflows/nodes/displayable/api_node/tests/test_api_node.py +66 -3
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +14 -10
- vellum/workflows/nodes/displayable/guardrail_node/node.py +13 -2
- vellum/workflows/nodes/displayable/guardrail_node/test_node.py +29 -0
- vellum/workflows/nodes/experimental/tool_calling_node/node.py +3 -1
- vellum/workflows/nodes/experimental/tool_calling_node/utils.py +46 -8
- vellum/workflows/runner/runner.py +14 -10
- vellum/workflows/state/base.py +28 -10
- vellum/workflows/state/encoder.py +5 -1
- vellum/workflows/utils/functions.py +42 -1
- vellum/workflows/utils/tests/test_functions.py +156 -1
- vellum/workflows/workflows/tests/test_base_workflow.py +4 -4
- {vellum_ai-0.14.56.dist-info → vellum_ai-0.14.58.dist-info}/METADATA +1 -1
- {vellum_ai-0.14.56.dist-info → vellum_ai-0.14.58.dist-info}/RECORD +24 -23
- vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +118 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py +265 -5
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py +2 -1
- {vellum_ai-0.14.56.dist-info → vellum_ai-0.14.58.dist-info}/LICENSE +0 -0
- {vellum_ai-0.14.56.dist-info → vellum_ai-0.14.58.dist-info}/WHEEL +0 -0
- {vellum_ai-0.14.56.dist-info → vellum_ai-0.14.58.dist-info}/entry_points.txt +0 -0
@@ -1,12 +1,16 @@
|
|
1
1
|
import dataclasses
|
2
2
|
import inspect
|
3
|
-
from typing import Any, Callable, Optional, Union, get_args, get_origin
|
3
|
+
from typing import TYPE_CHECKING, Any, Callable, Optional, Type, Union, get_args, get_origin
|
4
4
|
|
5
5
|
from pydantic import BaseModel
|
6
6
|
from pydantic_core import PydanticUndefined
|
7
|
+
from pydash import snake_case
|
7
8
|
|
8
9
|
from vellum.client.types.function_definition import FunctionDefinition
|
9
10
|
|
11
|
+
if TYPE_CHECKING:
|
12
|
+
from vellum.workflows.workflows.base import BaseWorkflow
|
13
|
+
|
10
14
|
type_map = {
|
11
15
|
str: "string",
|
12
16
|
int: "integer",
|
@@ -108,5 +112,42 @@ def compile_function_definition(function: Callable) -> FunctionDefinition:
|
|
108
112
|
|
109
113
|
return FunctionDefinition(
|
110
114
|
name=function.__name__,
|
115
|
+
description=function.__doc__,
|
116
|
+
parameters=parameters,
|
117
|
+
)
|
118
|
+
|
119
|
+
|
120
|
+
def compile_workflow_function_definition(workflow_class: Type["BaseWorkflow"]) -> FunctionDefinition:
|
121
|
+
"""
|
122
|
+
Converts a base workflow class into our Vellum-native FunctionDefinition type.
|
123
|
+
"""
|
124
|
+
# Get the inputs class for the workflow
|
125
|
+
inputs_class = workflow_class.get_inputs_class()
|
126
|
+
vars_inputs_class = vars(inputs_class)
|
127
|
+
|
128
|
+
properties = {}
|
129
|
+
required = []
|
130
|
+
defs: dict[str, Any] = {}
|
131
|
+
|
132
|
+
for name, field_type in inputs_class.__annotations__.items():
|
133
|
+
if name.startswith("__"):
|
134
|
+
continue
|
135
|
+
|
136
|
+
properties[name] = _compile_annotation(field_type, defs)
|
137
|
+
|
138
|
+
# Check if the field has a default value
|
139
|
+
if name not in vars_inputs_class:
|
140
|
+
required.append(name)
|
141
|
+
else:
|
142
|
+
# Field has a default value
|
143
|
+
properties[name]["default"] = vars_inputs_class[name]
|
144
|
+
|
145
|
+
parameters = {"type": "object", "properties": properties, "required": required}
|
146
|
+
if defs:
|
147
|
+
parameters["$defs"] = defs
|
148
|
+
|
149
|
+
return FunctionDefinition(
|
150
|
+
name=snake_case(workflow_class.__name__),
|
151
|
+
description=workflow_class.__doc__,
|
111
152
|
parameters=parameters,
|
112
153
|
)
|
@@ -4,7 +4,11 @@ from typing import Dict, List, Optional, Union
|
|
4
4
|
from pydantic import BaseModel
|
5
5
|
|
6
6
|
from vellum.client.types.function_definition import FunctionDefinition
|
7
|
-
from vellum.workflows
|
7
|
+
from vellum.workflows import BaseWorkflow
|
8
|
+
from vellum.workflows.inputs.base import BaseInputs
|
9
|
+
from vellum.workflows.nodes.bases.base import BaseNode
|
10
|
+
from vellum.workflows.state.base import BaseState
|
11
|
+
from vellum.workflows.utils.functions import compile_function_definition, compile_workflow_function_definition
|
8
12
|
|
9
13
|
|
10
14
|
def test_compile_function_definition__just_name():
|
@@ -22,6 +26,23 @@ def test_compile_function_definition__just_name():
|
|
22
26
|
)
|
23
27
|
|
24
28
|
|
29
|
+
def test_compile_function_definition__docstring():
|
30
|
+
# GIVEN a function with a docstring
|
31
|
+
def my_function():
|
32
|
+
"""This is a test function"""
|
33
|
+
pass
|
34
|
+
|
35
|
+
# WHEN compiling the function
|
36
|
+
compiled_function = compile_function_definition(my_function)
|
37
|
+
|
38
|
+
# THEN it should return the compiled function definition
|
39
|
+
assert compiled_function == FunctionDefinition(
|
40
|
+
name="my_function",
|
41
|
+
description="This is a test function",
|
42
|
+
parameters={"type": "object", "properties": {}, "required": []},
|
43
|
+
)
|
44
|
+
|
45
|
+
|
25
46
|
def test_compile_function_definition__all_args():
|
26
47
|
# GIVEN a function with args of all base types
|
27
48
|
def my_function(a: str, b: int, c: float, d: bool, e: list, f: dict):
|
@@ -276,3 +297,137 @@ def test_compile_function_definition__lambda():
|
|
276
297
|
name="<lambda>",
|
277
298
|
parameters={"type": "object", "properties": {"x": {"type": "null"}}, "required": ["x"]},
|
278
299
|
)
|
300
|
+
|
301
|
+
|
302
|
+
def test_compile_workflow_function_definition():
|
303
|
+
class MyNode(BaseNode):
|
304
|
+
pass
|
305
|
+
|
306
|
+
class MyWorkflow(BaseWorkflow):
|
307
|
+
graph = MyNode
|
308
|
+
|
309
|
+
# WHEN compiling the function
|
310
|
+
compiled_function = compile_workflow_function_definition(MyWorkflow)
|
311
|
+
|
312
|
+
# THEN it should return the compiled function definition
|
313
|
+
assert compiled_function == FunctionDefinition(
|
314
|
+
name="my_workflow",
|
315
|
+
parameters={"type": "object", "properties": {}, "required": []},
|
316
|
+
)
|
317
|
+
|
318
|
+
|
319
|
+
def test_compile_workflow_function_definition__docstring():
|
320
|
+
class MyNode(BaseNode):
|
321
|
+
pass
|
322
|
+
|
323
|
+
class MyWorkflow(BaseWorkflow):
|
324
|
+
"""
|
325
|
+
This is a test workflow
|
326
|
+
"""
|
327
|
+
|
328
|
+
graph = MyNode
|
329
|
+
|
330
|
+
# WHEN compiling the function
|
331
|
+
compiled_function = compile_workflow_function_definition(MyWorkflow)
|
332
|
+
|
333
|
+
# THEN it should return the compiled function definition
|
334
|
+
assert compiled_function == FunctionDefinition(
|
335
|
+
name="my_workflow",
|
336
|
+
description="\n This is a test workflow\n ",
|
337
|
+
parameters={"type": "object", "properties": {}, "required": []},
|
338
|
+
)
|
339
|
+
|
340
|
+
|
341
|
+
def test_compile_workflow_function_definition__all_args():
|
342
|
+
class MyInputs(BaseInputs):
|
343
|
+
a: str
|
344
|
+
b: int
|
345
|
+
c: float
|
346
|
+
d: bool
|
347
|
+
e: list
|
348
|
+
f: dict
|
349
|
+
|
350
|
+
class MyNode(BaseNode):
|
351
|
+
pass
|
352
|
+
|
353
|
+
class MyWorkflow(BaseWorkflow[MyInputs, BaseState]):
|
354
|
+
graph = MyNode
|
355
|
+
|
356
|
+
# WHEN compiling the workflow
|
357
|
+
compiled_function = compile_workflow_function_definition(MyWorkflow)
|
358
|
+
|
359
|
+
# THEN it should return the compiled function definition
|
360
|
+
assert compiled_function == FunctionDefinition(
|
361
|
+
name="my_workflow",
|
362
|
+
parameters={
|
363
|
+
"type": "object",
|
364
|
+
"properties": {
|
365
|
+
"a": {"type": "string"},
|
366
|
+
"b": {"type": "integer"},
|
367
|
+
"c": {"type": "number"},
|
368
|
+
"d": {"type": "boolean"},
|
369
|
+
"e": {"type": "array"},
|
370
|
+
"f": {"type": "object"},
|
371
|
+
},
|
372
|
+
"required": ["a", "b", "c", "d", "e", "f"],
|
373
|
+
},
|
374
|
+
)
|
375
|
+
|
376
|
+
|
377
|
+
def test_compile_workflow_function_definition__unions():
|
378
|
+
# GIVEN a workflow with a union
|
379
|
+
class MyInputs(BaseInputs):
|
380
|
+
a: Union[str, int]
|
381
|
+
|
382
|
+
class MyNode(BaseNode):
|
383
|
+
pass
|
384
|
+
|
385
|
+
class MyWorkflow(BaseWorkflow[MyInputs, BaseState]):
|
386
|
+
graph = MyNode
|
387
|
+
|
388
|
+
# WHEN compiling the workflow
|
389
|
+
compiled_function = compile_workflow_function_definition(MyWorkflow)
|
390
|
+
|
391
|
+
# THEN it should return the compiled function definition
|
392
|
+
assert compiled_function == FunctionDefinition(
|
393
|
+
name="my_workflow",
|
394
|
+
parameters={
|
395
|
+
"type": "object",
|
396
|
+
"properties": {"a": {"anyOf": [{"type": "string"}, {"type": "integer"}]}},
|
397
|
+
"required": ["a"],
|
398
|
+
},
|
399
|
+
)
|
400
|
+
|
401
|
+
|
402
|
+
def test_compile_workflow_function_definition__optionals():
|
403
|
+
class MyInputs(BaseInputs):
|
404
|
+
a: str
|
405
|
+
b: Optional[str]
|
406
|
+
c: None
|
407
|
+
d: str = "hello"
|
408
|
+
e: Optional[str] = None
|
409
|
+
|
410
|
+
class MyNode(BaseNode):
|
411
|
+
pass
|
412
|
+
|
413
|
+
class MyWorkflow(BaseWorkflow[MyInputs, BaseState]):
|
414
|
+
graph = MyNode
|
415
|
+
|
416
|
+
# WHEN compiling the workflow
|
417
|
+
compiled_function = compile_workflow_function_definition(MyWorkflow)
|
418
|
+
|
419
|
+
# THEN it should return the compiled function definition
|
420
|
+
assert compiled_function == FunctionDefinition(
|
421
|
+
name="my_workflow",
|
422
|
+
parameters={
|
423
|
+
"type": "object",
|
424
|
+
"properties": {
|
425
|
+
"a": {"type": "string"},
|
426
|
+
"b": {"anyOf": [{"type": "string"}, {"type": "null"}]},
|
427
|
+
"c": {"type": "null"},
|
428
|
+
"d": {"type": "string", "default": "hello"},
|
429
|
+
"e": {"anyOf": [{"type": "string"}, {"type": "null"}], "default": None},
|
430
|
+
},
|
431
|
+
"required": ["a", "b", "c"],
|
432
|
+
},
|
433
|
+
)
|
@@ -368,7 +368,7 @@ def test_base_workflow__deserialize_state():
|
|
368
368
|
},
|
369
369
|
"node_execution_cache": {
|
370
370
|
"dependencies_invoked": {
|
371
|
-
last_span_id: [
|
371
|
+
last_span_id: [],
|
372
372
|
},
|
373
373
|
"node_executions_initiated": {
|
374
374
|
str(node_a_id): [last_span_id],
|
@@ -396,7 +396,7 @@ def test_base_workflow__deserialize_state():
|
|
396
396
|
assert state.meta.node_execution_cache._node_executions_initiated == {NodeA: {UUID(last_span_id)}}
|
397
397
|
assert state.meta.node_execution_cache._node_executions_fulfilled == {NodeA: Stack.from_list([UUID(last_span_id)])}
|
398
398
|
assert state.meta.node_execution_cache._node_executions_queued == {NodeA: []}
|
399
|
-
assert state.meta.node_execution_cache._dependencies_invoked == {UUID(last_span_id):
|
399
|
+
assert state.meta.node_execution_cache._dependencies_invoked == {UUID(last_span_id): set()}
|
400
400
|
|
401
401
|
|
402
402
|
def test_base_workflow__deserialize_legacy_node_execution_cache():
|
@@ -422,7 +422,7 @@ def test_base_workflow__deserialize_legacy_node_execution_cache():
|
|
422
422
|
"meta": {
|
423
423
|
"node_execution_cache": {
|
424
424
|
"dependencies_invoked": {
|
425
|
-
last_span_id: [
|
425
|
+
last_span_id: [],
|
426
426
|
},
|
427
427
|
"node_executions_initiated": {
|
428
428
|
node_a_full_name: [last_span_id],
|
@@ -442,7 +442,7 @@ def test_base_workflow__deserialize_legacy_node_execution_cache():
|
|
442
442
|
assert state.meta.node_execution_cache._node_executions_initiated == {NodeA: {UUID(last_span_id)}}
|
443
443
|
assert state.meta.node_execution_cache._node_executions_fulfilled == {NodeA: Stack.from_list([UUID(last_span_id)])}
|
444
444
|
assert state.meta.node_execution_cache._node_executions_queued == {NodeA: []}
|
445
|
-
assert state.meta.node_execution_cache._dependencies_invoked == {UUID(last_span_id):
|
445
|
+
assert state.meta.node_execution_cache._dependencies_invoked == {UUID(last_span_id): set()}
|
446
446
|
|
447
447
|
|
448
448
|
def test_base_workflow__deserialize_legacy_node_outputs():
|
@@ -59,6 +59,7 @@ vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_node.py,sha256=7GGbGh
|
|
59
59
|
vellum_ee/workflows/display/nodes/vellum/tests/test_retry_node.py,sha256=h93ysolmbo2viisyhRnXKHPxiDK0I_dSAbYoHFYIoO4,1953
|
60
60
|
vellum_ee/workflows/display/nodes/vellum/tests/test_subworkflow_deployment_node.py,sha256=BUzHJgjdWnPeZxjFjHfDBKnbFjYjnbXPjc-1hne1B2Y,3965
|
61
61
|
vellum_ee/workflows/display/nodes/vellum/tests/test_templating_node.py,sha256=LSk2gx9TpGXbAqKe8dggQW8yJZqj-Cf0EGJFeGGlEcw,3321
|
62
|
+
vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py,sha256=DgpTmXP3GpOfc6QnUzwIASRyqEydOYv7CnXtv2o4EgU,4324
|
62
63
|
vellum_ee/workflows/display/nodes/vellum/tests/test_try_node.py,sha256=Khjsb53PKpZuyhKoRMgKAL45eGp5hZqXvHmVeQWRw4w,2289
|
63
64
|
vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py,sha256=3LS1O4DGPWit05oj_ubeW8AlHGnoBxdUMferGQuAiZs,4851
|
64
65
|
vellum_ee/workflows/display/nodes/vellum/try_node.py,sha256=z9Omo676RRc7mQjLoL7hjiHhUj0OWVLhrrb97YTN4QA,4086
|
@@ -80,7 +81,7 @@ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_default_stat
|
|
80
81
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py,sha256=MNnQ51ZWOQGVfBdpIqvr4OZF0tWdfrh2bsHP3xkTwQw,5841
|
81
82
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py,sha256=kLOnUNn-r1w1JXNQcVKe-Vp-fKhSfuDBuDqrjGkFZ3U,5544
|
82
83
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py,sha256=v07cILUzS5iFYDrSOAXK93yz50-FtxLaMYMwoaPOv20,7374
|
83
|
-
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py,sha256=
|
84
|
+
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_prompt_node_serialization.py,sha256=P6BZ8SanasxKCmDxwznh_EYmDoihi7BSGxA2SaXQYQw,11478
|
84
85
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py,sha256=u2nquKoO3o2xIkU_uFPOb_s5YoLmULiq09vb6Ee0Cqw,21415
|
85
86
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py,sha256=3gZuNM8sT6ovVaeoAvd2JoyKwuxokvowlhH8kwDUoZ8,16559
|
86
87
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py,sha256=IIJt7YZBzkhNtbmaMwCX4ENs58QtSIIoBHlMR6OwGU8,8342
|
@@ -89,7 +90,7 @@ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_
|
|
89
90
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py,sha256=KkYZc_bZuq1lmDcvUz3QxIqJLpQPCZioD1FHUNsMJY8,11211
|
90
91
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py,sha256=aZaqRDrkO3ytcmdM2eKJqHSt60MF070NMj6M2vgzOKc,7711
|
91
92
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py,sha256=r748dpS13HtwY7t_KQFExFssxRy0xI2d-wxmhiUHRe0,3850
|
92
|
-
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py,sha256=
|
93
|
+
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py,sha256=ai1f6fKJ7F9iY6PGyBa9b1dCFWEM8gO1WAkVzIhHMlw,8000
|
93
94
|
vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py,sha256=EL5kfakuoEcwD85dGjhMta-J-PpCHRSDoc80SdbBrQk,2769
|
94
95
|
vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py,sha256=RmFUDx8dYdfsOE2CGLvdXqNNRtLLpVzXDN8dqZyMcZ8,5822
|
95
96
|
vellum_ee/workflows/display/types.py,sha256=i4T7ElU5b5h-nA1i3scmEhO1BqmNDc4eJDHavATD88w,2821
|
@@ -133,7 +134,7 @@ vellum/client/README.md,sha256=qmaVIP42MnxAu8jV7u-CsgVFfs3-pHQODrXdZdFxtaw,4749
|
|
133
134
|
vellum/client/__init__.py,sha256=AYopGv2ZRVn3zsU8_km6KOvEHDbXiTPCVuYVI7bWvdA,120166
|
134
135
|
vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
|
135
136
|
vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
|
136
|
-
vellum/client/core/client_wrapper.py,sha256=
|
137
|
+
vellum/client/core/client_wrapper.py,sha256=R8Gd1E7CHopB46ObgpI6tGq-bCfkRm3SWdY8w8PzUQU,1869
|
137
138
|
vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
138
139
|
vellum/client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
139
140
|
vellum/client/core/http_client.py,sha256=Z77OIxIbL4OAB2IDqjRq_sYa5yNYAWfmdhdCSSvh6Y4,19552
|
@@ -1547,7 +1548,7 @@ vellum/workflows/inputs/tests/test_inputs.py,sha256=lioA8917mFLYq7Ml69UNkqUjcWbb
|
|
1547
1548
|
vellum/workflows/logging.py,sha256=_a217XogktV4Ncz6xKFz7WfYmZAzkfVRVuC0rWob8ls,437
|
1548
1549
|
vellum/workflows/nodes/__init__.py,sha256=aVdQVv7Y3Ro3JlqXGpxwaU2zrI06plDHD2aumH5WUIs,1157
|
1549
1550
|
vellum/workflows/nodes/bases/__init__.py,sha256=cniHuz_RXdJ4TQgD8CBzoiKDiPxg62ErdVpCbWICX64,58
|
1550
|
-
vellum/workflows/nodes/bases/base.py,sha256=
|
1551
|
+
vellum/workflows/nodes/bases/base.py,sha256=gXhhqD1DYRPyIDnkUkpLAqb5m2feWZBvxOm5PL3NUqA,17830
|
1551
1552
|
vellum/workflows/nodes/bases/base_adornment_node.py,sha256=Ao2opOW4kgNoYXFF9Pk7IMpVZdy6luwrjcqEwU5Q9V0,3404
|
1552
1553
|
vellum/workflows/nodes/bases/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1553
1554
|
vellum/workflows/nodes/bases/tests/test_base_adornment_node.py,sha256=fXZI9KqpS4XMBrBnIEkK3foHaBVvyHwYcQWWDKay7ic,1148
|
@@ -1564,7 +1565,7 @@ vellum/workflows/nodes/core/map_node/node.py,sha256=rbF7fLAU0vUDEpgtWqeQTZFlhWOh
|
|
1564
1565
|
vellum/workflows/nodes/core/map_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1565
1566
|
vellum/workflows/nodes/core/map_node/tests/test_node.py,sha256=rf7CCDtjHxoPKeEtm9a8v_MNvkvu5UThH4xRXYrdEl8,6904
|
1566
1567
|
vellum/workflows/nodes/core/retry_node/__init__.py,sha256=lN2bIy5a3Uzhs_FYCrooADyYU6ZGShtvLKFWpelwPvo,60
|
1567
|
-
vellum/workflows/nodes/core/retry_node/node.py,sha256=
|
1568
|
+
vellum/workflows/nodes/core/retry_node/node.py,sha256=EM4ya8Myr7ADllpjt9q-BAhB3hGrsF8MLZhp5eh4lyo,5590
|
1568
1569
|
vellum/workflows/nodes/core/retry_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1569
1570
|
vellum/workflows/nodes/core/retry_node/tests/test_node.py,sha256=RM_OHwxrHwyxvlQQBJPqVBxpedFuWQ9h2-Xa3kP75sc,4399
|
1570
1571
|
vellum/workflows/nodes/core/templating_node/__init__.py,sha256=GmyuYo81_A1_Bz6id69ozVFS6FKiuDsZTiA3I6MaL2U,70
|
@@ -1576,9 +1577,9 @@ vellum/workflows/nodes/core/try_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW
|
|
1576
1577
|
vellum/workflows/nodes/core/try_node/tests/test_node.py,sha256=h6eUc3SggvhzBWlOD0PrPUlkoCSQHwjqYn81VkxSIxU,4948
|
1577
1578
|
vellum/workflows/nodes/displayable/__init__.py,sha256=6F_4DlSwvHuilWnIalp8iDjjDXl0Nmz4QzJV2PYe5RI,1023
|
1578
1579
|
vellum/workflows/nodes/displayable/api_node/__init__.py,sha256=MoxdQSnidIj1Nf_d-hTxlOxcZXaZnsWFDbE-PkTK24o,56
|
1579
|
-
vellum/workflows/nodes/displayable/api_node/node.py,sha256=
|
1580
|
+
vellum/workflows/nodes/displayable/api_node/node.py,sha256=KOSEicUQScliWEnKyQdfuB-5Lw5ScG9PUd3WFP2nlSQ,2835
|
1580
1581
|
vellum/workflows/nodes/displayable/api_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1581
|
-
vellum/workflows/nodes/displayable/api_node/tests/test_api_node.py,sha256=
|
1582
|
+
vellum/workflows/nodes/displayable/api_node/tests/test_api_node.py,sha256=CDoFRRCOYwmoLU5Kvv9pRrxYYuk29Lm4DBt_bKYZHcE,5677
|
1582
1583
|
vellum/workflows/nodes/displayable/bases/__init__.py,sha256=0mWIx3qUrzllV7jqt7wN03vWGMuI1WrrLZeMLT2Cl2c,304
|
1583
1584
|
vellum/workflows/nodes/displayable/bases/api_node/__init__.py,sha256=1jwx4WC358CLA1jgzl_UD-rZmdMm2v9Mps39ndwCD7U,64
|
1584
1585
|
vellum/workflows/nodes/displayable/bases/api_node/node.py,sha256=70pLGU0UzWvSbKwNkx3YlUYrDSkl7MmhVHoI8bzN79c,4343
|
@@ -1586,7 +1587,7 @@ vellum/workflows/nodes/displayable/bases/base_prompt_node/__init__.py,sha256=Org
|
|
1586
1587
|
vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py,sha256=amBXi7Tv50AbGLhfWbwX83PlOdV1XyYRyQmpa6_afE4,3511
|
1587
1588
|
vellum/workflows/nodes/displayable/bases/inline_prompt_node/__init__.py,sha256=Hl35IAoepRpE-j4cALaXVJIYTYOF3qszyVbxTj4kS1s,82
|
1588
1589
|
vellum/workflows/nodes/displayable/bases/inline_prompt_node/constants.py,sha256=fnjiRWLoRlC4Puo5oQcpZD5Hd-EesxsAo9l5tGAkpZQ,270
|
1589
|
-
vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py,sha256=
|
1590
|
+
vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py,sha256=K2jwAjgG2Qaq7tfDlCckojhAjir962fcIT3eKgjTAEM,11555
|
1590
1591
|
vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1591
1592
|
vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py,sha256=5CNag1_aEFZbCL0nrOC5e1L-t90-4rp2xDwh0h52hVI,21407
|
1592
1593
|
vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py,sha256=T99UWACTD9ytVDVHa6W2go00V7HNwDxOyBFyMM2GnhQ,9567
|
@@ -1610,8 +1611,8 @@ vellum/workflows/nodes/displayable/final_output_node/node.py,sha256=PuQ0RvtAmoSI
|
|
1610
1611
|
vellum/workflows/nodes/displayable/final_output_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1611
1612
|
vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py,sha256=E6LQ74qZjY4Xi4avx2qdOCgGhF8pEcNLBh8cqYRkzMI,709
|
1612
1613
|
vellum/workflows/nodes/displayable/guardrail_node/__init__.py,sha256=Ab5eXmOoBhyV4dMWdzh32HLUmnPIBEK_zFCT38C4Fng,68
|
1613
|
-
vellum/workflows/nodes/displayable/guardrail_node/node.py,sha256=
|
1614
|
-
vellum/workflows/nodes/displayable/guardrail_node/test_node.py,sha256=
|
1614
|
+
vellum/workflows/nodes/displayable/guardrail_node/node.py,sha256=oBqQ0eAhALkGL64aAqEKP5lmQxvgYMJ2BeDD8cnLJE8,5813
|
1615
|
+
vellum/workflows/nodes/displayable/guardrail_node/test_node.py,sha256=SAGv6hSFcBwQkudn1VxtaKNsXSXWWELl3eK05zM6tS0,5410
|
1615
1616
|
vellum/workflows/nodes/displayable/guardrail_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1616
1617
|
vellum/workflows/nodes/displayable/guardrail_node/tests/test_node.py,sha256=X2pd6TI8miYxIa7rgvs1pHTEreyWcf77EyR0_Jsa700,2055
|
1617
1618
|
vellum/workflows/nodes/displayable/inline_prompt_node/__init__.py,sha256=gSUOoEZLlrx35-tQhSAd3An8WDwBqyiQh-sIebLU9wU,74
|
@@ -1643,9 +1644,9 @@ vellum/workflows/nodes/experimental/__init__.py,sha256=_tpZGWAZLydcKxfrj1-plrZeT
|
|
1643
1644
|
vellum/workflows/nodes/experimental/openai_chat_completion_node/__init__.py,sha256=lsyD9laR9p7kx5-BXGH2gUTM242UhKy8SMV0SR6S2iE,90
|
1644
1645
|
vellum/workflows/nodes/experimental/openai_chat_completion_node/node.py,sha256=cKI2Ls25L-JVt4z4a2ozQa-YBeVy21Z7BQ32Sj7iBPE,10460
|
1645
1646
|
vellum/workflows/nodes/experimental/tool_calling_node/__init__.py,sha256=S7OzT3I4cyOU5Beoz87nPwCejCMP2FsHBFL8OcVmxJ4,118
|
1646
|
-
vellum/workflows/nodes/experimental/tool_calling_node/node.py,sha256=
|
1647
|
+
vellum/workflows/nodes/experimental/tool_calling_node/node.py,sha256=4MUlTTAJdFDYA5ybRGaqAQX9XTaOsH48Sr8rJ49oatw,4892
|
1647
1648
|
vellum/workflows/nodes/experimental/tool_calling_node/tests/test_tool_calling_node.py,sha256=sxG26mOwt4N36RLoPJ-ngginPqC5qFzD_kGj9izdCFI,1833
|
1648
|
-
vellum/workflows/nodes/experimental/tool_calling_node/utils.py,sha256=
|
1649
|
+
vellum/workflows/nodes/experimental/tool_calling_node/utils.py,sha256=Z9zCnvZBE7tT4iwsiG5YgPLFhAKeDJjPs-8JYAi3n8o,7203
|
1649
1650
|
vellum/workflows/nodes/mocks.py,sha256=a1FjWEIocseMfjzM-i8DNozpUsaW0IONRpZmXBoWlyc,10455
|
1650
1651
|
vellum/workflows/nodes/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1651
1652
|
vellum/workflows/nodes/tests/test_mocks.py,sha256=mfPvrs75PKcsNsbJLQAN6PDFoVqs9TmQxpdyFKDdO60,7837
|
@@ -1673,12 +1674,12 @@ vellum/workflows/references/workflow_input.py,sha256=W3rOK1EPd2gYHb04WJwmNm1CUSd
|
|
1673
1674
|
vellum/workflows/resolvers/__init__.py,sha256=eH6hTvZO4IciDaf_cf7aM2vs-DkBDyJPycOQevJxQnI,82
|
1674
1675
|
vellum/workflows/resolvers/base.py,sha256=WHra9LRtlTuB1jmuNqkfVE2JUgB61Cyntn8f0b0WZg4,411
|
1675
1676
|
vellum/workflows/runner/__init__.py,sha256=i1iG5sAhtpdsrlvwgH6B-m49JsINkiWyPWs8vyT-bqM,72
|
1676
|
-
vellum/workflows/runner/runner.py,sha256=
|
1677
|
+
vellum/workflows/runner/runner.py,sha256=mPN9jKCB1G19OjabUEcC02KTvsALjI-ePfqbRxCT_QY,33043
|
1677
1678
|
vellum/workflows/sandbox.py,sha256=GVJzVjMuYzOBnSrboB0_6MMRZWBluAyQ2o7syeaeBd0,2235
|
1678
1679
|
vellum/workflows/state/__init__.py,sha256=yUUdR-_Vl7UiixNDYQZ-GEM_kJI9dnOia75TtuNEsnE,60
|
1679
|
-
vellum/workflows/state/base.py,sha256
|
1680
|
+
vellum/workflows/state/base.py,sha256=XO_lNgCpZBMfT-0VkP-PgWiGWDalGJGmh-6_9aHssWU,22159
|
1680
1681
|
vellum/workflows/state/context.py,sha256=KOAI1wEGn8dGmhmAemJaf4SZbitP3jpIBcwKfznQaRE,3076
|
1681
|
-
vellum/workflows/state/encoder.py,sha256=
|
1682
|
+
vellum/workflows/state/encoder.py,sha256=8NPQ8iz5qJeT5fafnZ2Pko98b-FtTjsgMNV4Zi3g2bE,2438
|
1682
1683
|
vellum/workflows/state/store.py,sha256=uVe-oN73KwGV6M6YLhwZMMUQhzTQomsVfVnb8V91gVo,1147
|
1683
1684
|
vellum/workflows/state/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1684
1685
|
vellum/workflows/state/tests/test_state.py,sha256=YOiC9qZAzkdiqb7nRarNWeDwxo7xHv3y3czlHl81ezg,6741
|
@@ -1695,10 +1696,10 @@ vellum/workflows/types/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NM
|
|
1695
1696
|
vellum/workflows/types/tests/test_utils.py,sha256=UnZog59tR577mVwqZRqqWn2fScoOU1H6up0EzS8zYhw,2536
|
1696
1697
|
vellum/workflows/types/utils.py,sha256=axxHbPLsnjhEOnMZrc5YarFd-P2bnsacBDQGNCvY8OY,6367
|
1697
1698
|
vellum/workflows/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1698
|
-
vellum/workflows/utils/functions.py,sha256=
|
1699
|
+
vellum/workflows/utils/functions.py,sha256=FmbOnwl8tLUzbssybZkWRHyUfuXarimYMMD3ZTiUcPE,5390
|
1699
1700
|
vellum/workflows/utils/names.py,sha256=QLUqfJ1tmSEeUwBKTTiv_Qk3QGbInC2RSmlXfGXc8Wo,380
|
1700
1701
|
vellum/workflows/utils/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1701
|
-
vellum/workflows/utils/tests/test_functions.py,sha256=
|
1702
|
+
vellum/workflows/utils/tests/test_functions.py,sha256=kw-HaYo9JAigFj6sfnAFAbBTLUzPMxB1DeEUY-o10AU,13143
|
1702
1703
|
vellum/workflows/utils/tests/test_names.py,sha256=aOqpyvMsOEK_9mg_-yaNxQDW7QQfwqsYs37PseyLhxw,402
|
1703
1704
|
vellum/workflows/utils/tests/test_uuids.py,sha256=i77ABQ0M3S-aFLzDXHJq_yr5FPkJEWCMBn1HJ3DObrE,437
|
1704
1705
|
vellum/workflows/utils/tests/test_vellum_variables.py,sha256=maI5e7Od7UlpMwlrOrcdlXqnFhonkXGnWq8G2-YQLi8,1155
|
@@ -1709,10 +1710,10 @@ vellum/workflows/workflows/__init__.py,sha256=KY45TqvavCCvXIkyCFMEc0dc6jTMOUci93
|
|
1709
1710
|
vellum/workflows/workflows/base.py,sha256=V60RZat8mG0XmMuIjprkHnacD_MpUdxGcN9t4TaP_Pg,24044
|
1710
1711
|
vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnadGsrSZGa7t7LpJA,2008
|
1711
1712
|
vellum/workflows/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1712
|
-
vellum/workflows/workflows/tests/test_base_workflow.py,sha256=
|
1713
|
+
vellum/workflows/workflows/tests/test_base_workflow.py,sha256=fROqff6AZpCIzaSwOKSdtYy4XR0UZQ6ejxL3RJOSJVs,20447
|
1713
1714
|
vellum/workflows/workflows/tests/test_context.py,sha256=VJBUcyWVtMa_lE5KxdhgMu0WYNYnUQUDvTF7qm89hJ0,2333
|
1714
|
-
vellum_ai-0.14.
|
1715
|
-
vellum_ai-0.14.
|
1716
|
-
vellum_ai-0.14.
|
1717
|
-
vellum_ai-0.14.
|
1718
|
-
vellum_ai-0.14.
|
1715
|
+
vellum_ai-0.14.58.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
|
1716
|
+
vellum_ai-0.14.58.dist-info/METADATA,sha256=0p-sltZKUHnvpKAUPJHAdhM6d_4LGg2R0z5PlgIb3Jg,5484
|
1717
|
+
vellum_ai-0.14.58.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
1718
|
+
vellum_ai-0.14.58.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
|
1719
|
+
vellum_ai-0.14.58.dist-info/RECORD,,
|
@@ -0,0 +1,118 @@
|
|
1
|
+
from vellum.workflows import BaseWorkflow
|
2
|
+
from vellum.workflows.inputs import BaseInputs
|
3
|
+
from vellum.workflows.nodes.displayable.inline_prompt_node.node import InlinePromptNode
|
4
|
+
from vellum.workflows.nodes.experimental.tool_calling_node.node import ToolCallingNode
|
5
|
+
from vellum.workflows.state.base import BaseState
|
6
|
+
from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
|
7
|
+
|
8
|
+
|
9
|
+
def test_serialize_node__prompt_inputs__constant_value():
|
10
|
+
# GIVEN a prompt node with constant value inputs
|
11
|
+
class MyPromptNode(ToolCallingNode):
|
12
|
+
prompt_inputs = {"foo": "bar"}
|
13
|
+
|
14
|
+
# AND a workflow with the prompt node
|
15
|
+
class Workflow(BaseWorkflow):
|
16
|
+
graph = MyPromptNode
|
17
|
+
|
18
|
+
# WHEN the workflow is serialized
|
19
|
+
workflow_display = get_workflow_display(workflow_class=Workflow)
|
20
|
+
serialized_workflow: dict = workflow_display.serialize()
|
21
|
+
|
22
|
+
# THEN the node should properly serialize the inputs
|
23
|
+
my_prompt_node = next(
|
24
|
+
node for node in serialized_workflow["workflow_raw_data"]["nodes"] if node["id"] == str(MyPromptNode.__id__)
|
25
|
+
)
|
26
|
+
|
27
|
+
prompt_inputs_attribute = next(
|
28
|
+
attribute for attribute in my_prompt_node["attributes"] if attribute["name"] == "prompt_inputs"
|
29
|
+
)
|
30
|
+
|
31
|
+
assert prompt_inputs_attribute == {
|
32
|
+
"id": "3d9a4d2e-c9bd-4417-8a0c-52f15efdbe30",
|
33
|
+
"name": "prompt_inputs",
|
34
|
+
"value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": {"foo": "bar"}}},
|
35
|
+
}
|
36
|
+
|
37
|
+
|
38
|
+
def test_serialize_node__prompt_inputs__input_reference():
|
39
|
+
# GIVEN a state definition
|
40
|
+
class MyInput(BaseInputs):
|
41
|
+
foo: str
|
42
|
+
|
43
|
+
# AND a prompt node with inputs
|
44
|
+
class MyPromptNode(InlinePromptNode):
|
45
|
+
prompt_inputs = {"foo": MyInput.foo}
|
46
|
+
|
47
|
+
# AND a workflow with the prompt node
|
48
|
+
class Workflow(BaseWorkflow[MyInput, BaseState]):
|
49
|
+
graph = MyPromptNode
|
50
|
+
|
51
|
+
# WHEN the workflow is serialized
|
52
|
+
workflow_display = get_workflow_display(workflow_class=Workflow)
|
53
|
+
serialized_workflow: dict = workflow_display.serialize()
|
54
|
+
|
55
|
+
# THEN the node should skip the state reference input rule
|
56
|
+
my_prompt_node = next(
|
57
|
+
node for node in serialized_workflow["workflow_raw_data"]["nodes"] if node["id"] == str(MyPromptNode.__id__)
|
58
|
+
)
|
59
|
+
|
60
|
+
prompt_inputs_attribute = next(
|
61
|
+
attribute for attribute in my_prompt_node["attributes"] if attribute["name"] == "prompt_inputs"
|
62
|
+
)
|
63
|
+
|
64
|
+
assert prompt_inputs_attribute == {
|
65
|
+
"id": "6cde4776-7f4a-411c-95a8-69c8b3a64b42",
|
66
|
+
"name": "prompt_inputs",
|
67
|
+
"value": {
|
68
|
+
"type": "DICTIONARY_REFERENCE",
|
69
|
+
"entries": [
|
70
|
+
{
|
71
|
+
"key": "foo",
|
72
|
+
"value": {"type": "WORKFLOW_INPUT", "input_variable_id": "e3657390-fd3c-4fea-8cdd-fc5ea79f3278"},
|
73
|
+
}
|
74
|
+
],
|
75
|
+
},
|
76
|
+
}
|
77
|
+
|
78
|
+
|
79
|
+
def test_serialize_node__prompt_inputs__mixed_values():
|
80
|
+
# GIVEN a prompt node with mixed values
|
81
|
+
class MyInput(BaseInputs):
|
82
|
+
foo: str
|
83
|
+
|
84
|
+
# AND a prompt node with mixed values
|
85
|
+
class MyPromptNode(InlinePromptNode):
|
86
|
+
prompt_inputs = {"foo": "bar", "baz": MyInput.foo}
|
87
|
+
|
88
|
+
# AND a workflow with the prompt node
|
89
|
+
class Workflow(BaseWorkflow[MyInput, BaseState]):
|
90
|
+
graph = MyPromptNode
|
91
|
+
|
92
|
+
# WHEN the workflow is serialized
|
93
|
+
workflow_display = get_workflow_display(workflow_class=Workflow)
|
94
|
+
serialized_workflow: dict = workflow_display.serialize()
|
95
|
+
|
96
|
+
# THEN the node should properly serialize the inputs
|
97
|
+
my_prompt_node = next(
|
98
|
+
node for node in serialized_workflow["workflow_raw_data"]["nodes"] if node["id"] == str(MyPromptNode.__id__)
|
99
|
+
)
|
100
|
+
|
101
|
+
prompt_inputs_attribute = next(
|
102
|
+
attribute for attribute in my_prompt_node["attributes"] if attribute["name"] == "prompt_inputs"
|
103
|
+
)
|
104
|
+
|
105
|
+
assert prompt_inputs_attribute == {
|
106
|
+
"id": "c4ca6e3d-0f71-4802-a618-1e87880cb7cf",
|
107
|
+
"name": "prompt_inputs",
|
108
|
+
"value": {
|
109
|
+
"type": "DICTIONARY_REFERENCE",
|
110
|
+
"entries": [
|
111
|
+
{"key": "foo", "value": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "bar"}}},
|
112
|
+
{
|
113
|
+
"key": "baz",
|
114
|
+
"value": {"type": "WORKFLOW_INPUT", "input_variable_id": "8d57cf1d-147c-427b-9a5e-e5f6ab76e2eb"},
|
115
|
+
},
|
116
|
+
],
|
117
|
+
},
|
118
|
+
}
|