vellum-ai 0.13.0__py3-none-any.whl → 0.13.1__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/client/core/pydantic_utilities.py +5 -0
- vellum/client/resources/workflows/client.py +8 -0
- vellum/client/types/logical_operator.py +2 -0
- vellum/workflows/descriptors/base.py +1 -1
- vellum/workflows/descriptors/tests/test_utils.py +3 -0
- vellum/workflows/expressions/accessor.py +8 -2
- vellum/workflows/nodes/core/map_node/node.py +49 -24
- vellum/workflows/nodes/core/map_node/tests/test_node.py +4 -4
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +1 -1
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +5 -3
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +3 -0
- vellum/workflows/nodes/displayable/bases/search_node.py +37 -2
- vellum/workflows/nodes/displayable/bases/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/bases/tests/test_utils.py +61 -0
- vellum/workflows/nodes/displayable/bases/types.py +42 -0
- vellum/workflows/nodes/displayable/bases/utils.py +112 -0
- vellum/workflows/nodes/displayable/inline_prompt_node/tests/test_node.py +0 -1
- vellum/workflows/nodes/displayable/search_node/tests/__init__.py +0 -0
- vellum/workflows/nodes/displayable/search_node/tests/test_node.py +164 -0
- vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +2 -3
- vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +0 -1
- vellum/workflows/runner/runner.py +37 -4
- vellum/workflows/types/tests/test_utils.py +5 -2
- vellum/workflows/types/utils.py +4 -0
- vellum/workflows/workflows/base.py +14 -0
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.1.dist-info}/METADATA +1 -1
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.1.dist-info}/RECORD +46 -36
- vellum_cli/__init__.py +10 -0
- vellum_cli/ping.py +28 -0
- vellum_cli/tests/test_ping.py +47 -0
- vellum_ee/workflows/display/nodes/vellum/base_node.py +22 -9
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +3 -0
- vellum_ee/workflows/display/nodes/vellum/map_node.py +1 -1
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +14 -10
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/utils.py +8 -1
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +67 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +66 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +660 -0
- vellum_ee/workflows/display/utils/vellum.py +4 -42
- vellum_ee/workflows/display/vellum.py +7 -36
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +2 -1
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.1.dist-info}/LICENSE +0 -0
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.1.dist-info}/WHEEL +0 -0
- {vellum_ai-0.13.0.dist-info → vellum_ai-0.13.1.dist-info}/entry_points.txt +0 -0
@@ -1,10 +1,8 @@
|
|
1
|
-
import
|
2
|
-
import json
|
3
|
-
import typing
|
4
|
-
from typing import Any, List, Union, cast
|
1
|
+
from typing import Any, TypeVar
|
5
2
|
|
6
|
-
from vellum import
|
3
|
+
from vellum.client.types.vellum_variable_type import VellumVariableType
|
7
4
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
5
|
+
from vellum.workflows.nodes.displayable.bases.utils import primitive_to_vellum_value
|
8
6
|
from vellum.workflows.references import OutputReference, WorkflowInputReference
|
9
7
|
from vellum.workflows.references.execution_count import ExecutionCountReference
|
10
8
|
from vellum.workflows.references.node import NodeReference
|
@@ -13,25 +11,19 @@ from vellum.workflows.utils.vellum_variables import primitive_type_to_vellum_var
|
|
13
11
|
from vellum.workflows.vellum_client import create_vellum_client
|
14
12
|
from vellum_ee.workflows.display.types import WorkflowDisplayContext
|
15
13
|
from vellum_ee.workflows.display.vellum import (
|
16
|
-
ChatHistoryVellumValue,
|
17
14
|
ConstantValuePointer,
|
18
15
|
ExecutionCounterData,
|
19
16
|
ExecutionCounterPointer,
|
20
17
|
InputVariableData,
|
21
18
|
InputVariablePointer,
|
22
|
-
JsonVellumValue,
|
23
19
|
NodeInputValuePointerRule,
|
24
20
|
NodeOutputData,
|
25
21
|
NodeOutputPointer,
|
26
|
-
NumberVellumValue,
|
27
|
-
SearchResultsVellumValue,
|
28
|
-
StringVellumValue,
|
29
|
-
VellumValue,
|
30
22
|
WorkspaceSecretData,
|
31
23
|
WorkspaceSecretPointer,
|
32
24
|
)
|
33
25
|
|
34
|
-
_T =
|
26
|
+
_T = TypeVar("_T")
|
35
27
|
|
36
28
|
|
37
29
|
def infer_vellum_variable_type(value: Any) -> VellumVariableType:
|
@@ -90,33 +82,3 @@ def create_node_input_value_pointer_rule(
|
|
90
82
|
return ConstantValuePointer(type="CONSTANT_VALUE", data=vellum_value)
|
91
83
|
|
92
84
|
raise ValueError(f"Unsupported descriptor type: {value.__class__.__name__}")
|
93
|
-
|
94
|
-
|
95
|
-
def primitive_to_vellum_value(value: Any) -> VellumValue:
|
96
|
-
"""Converts a python primitive to a VellumVariableValue"""
|
97
|
-
|
98
|
-
if isinstance(value, str):
|
99
|
-
return StringVellumValue(value=value)
|
100
|
-
elif isinstance(value, enum.Enum):
|
101
|
-
return StringVellumValue(value=value.value)
|
102
|
-
elif isinstance(value, (int, float)):
|
103
|
-
return NumberVellumValue(value=value)
|
104
|
-
elif isinstance(value, list) and (
|
105
|
-
all(isinstance(message, ChatMessage) for message in value)
|
106
|
-
or all(isinstance(message, ChatMessage) for message in value)
|
107
|
-
):
|
108
|
-
chat_messages = cast(Union[List[ChatMessage], List[ChatMessage]], value)
|
109
|
-
return ChatHistoryVellumValue(value=chat_messages)
|
110
|
-
elif isinstance(value, list) and (
|
111
|
-
all(isinstance(search_result, SearchResultRequest) for search_result in value)
|
112
|
-
or all(isinstance(search_result, SearchResult) for search_result in value)
|
113
|
-
):
|
114
|
-
search_results = cast(Union[List[SearchResultRequest], List[SearchResult]], value)
|
115
|
-
return SearchResultsVellumValue(value=search_results)
|
116
|
-
|
117
|
-
try:
|
118
|
-
json_value = json.dumps(value)
|
119
|
-
except json.JSONDecodeError:
|
120
|
-
raise ValueError(f"Unsupported variable type: {value.__class__.__name__}")
|
121
|
-
|
122
|
-
return JsonVellumValue(value=json.loads(json_value))
|
@@ -1,11 +1,13 @@
|
|
1
1
|
from dataclasses import dataclass, field
|
2
2
|
from enum import Enum
|
3
3
|
from uuid import UUID
|
4
|
-
from typing import
|
4
|
+
from typing import List, Literal, Optional, Union
|
5
5
|
|
6
6
|
from pydantic import Field
|
7
7
|
|
8
|
-
from vellum import
|
8
|
+
from vellum import PromptParameters, VellumVariable, VellumVariableType
|
9
|
+
from vellum.client.types.array_vellum_value import ArrayVellumValue
|
10
|
+
from vellum.client.types.vellum_value import VellumValue
|
9
11
|
from vellum.core import UniversalBaseModel
|
10
12
|
from vellum_ee.workflows.display.base import (
|
11
13
|
EdgeDisplay,
|
@@ -140,45 +142,14 @@ class WorkflowNodeType(str, Enum):
|
|
140
142
|
ERROR = "ERROR"
|
141
143
|
|
142
144
|
|
143
|
-
class StringVellumValue(UniversalBaseModel):
|
144
|
-
type: Literal["STRING"] = "STRING"
|
145
|
-
value: str
|
146
|
-
|
147
|
-
|
148
|
-
class NumberVellumValue(UniversalBaseModel):
|
149
|
-
type: Literal["NUMBER"] = "NUMBER"
|
150
|
-
value: Union[int, float]
|
151
|
-
|
152
|
-
|
153
|
-
class ChatHistoryVellumValue(UniversalBaseModel):
|
154
|
-
type: Literal["CHAT_HISTORY"] = "CHAT_HISTORY"
|
155
|
-
value: Union[List[ChatMessage], List[ChatMessage]]
|
156
|
-
|
157
|
-
|
158
|
-
class SearchResultsVellumValue(UniversalBaseModel):
|
159
|
-
type: Literal["SEARCH_RESULTS"] = "SEARCH_RESULTS"
|
160
|
-
value: Union[List[SearchResultRequest], List[SearchResult]]
|
161
|
-
|
162
|
-
|
163
|
-
class JsonVellumValue(UniversalBaseModel):
|
164
|
-
type: Literal["JSON"] = "JSON"
|
165
|
-
value: Optional[Any] = None
|
166
|
-
|
167
|
-
|
168
|
-
VellumValue = Union[
|
169
|
-
StringVellumValue,
|
170
|
-
NumberVellumValue,
|
171
|
-
ChatHistoryVellumValue,
|
172
|
-
SearchResultsVellumValue,
|
173
|
-
JsonVellumValue,
|
174
|
-
]
|
175
|
-
|
176
|
-
|
177
145
|
class ConstantValuePointer(UniversalBaseModel):
|
178
146
|
type: Literal["CONSTANT_VALUE"] = "CONSTANT_VALUE"
|
179
147
|
data: VellumValue
|
180
148
|
|
181
149
|
|
150
|
+
ArrayVellumValue.model_rebuild()
|
151
|
+
|
152
|
+
|
182
153
|
class NodeOutputData(UniversalBaseModel):
|
183
154
|
node_id: str
|
184
155
|
output_id: str
|
@@ -5,6 +5,7 @@ from typing import Dict, List, Optional, Type, cast
|
|
5
5
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
6
6
|
from vellum.workflows.edges import Edge
|
7
7
|
from vellum.workflows.nodes.bases import BaseNode
|
8
|
+
from vellum.workflows.nodes.displayable.bases.utils import primitive_to_vellum_value
|
8
9
|
from vellum.workflows.nodes.displayable.final_output_node import FinalOutputNode
|
9
10
|
from vellum.workflows.nodes.utils import get_unadorned_node, get_unadorned_port, get_wrapped_node, has_wrapped_node
|
10
11
|
from vellum.workflows.ports import Port
|
@@ -16,7 +17,7 @@ from vellum.workflows.utils.uuids import uuid4_from_hash
|
|
16
17
|
from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
|
17
18
|
from vellum_ee.workflows.display.nodes.types import PortDisplay
|
18
19
|
from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
|
19
|
-
from vellum_ee.workflows.display.utils.vellum import infer_vellum_variable_type
|
20
|
+
from vellum_ee.workflows.display.utils.vellum import infer_vellum_variable_type
|
20
21
|
from vellum_ee.workflows.display.vellum import (
|
21
22
|
EdgeVellumDisplay,
|
22
23
|
EdgeVellumDisplayOverrides,
|
File without changes
|
File without changes
|
File without changes
|