vellum-ai 0.12.17__py3-none-any.whl → 0.13.1__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. vellum/__init__.py +10 -22
  2. vellum/client/__init__.py +8 -0
  3. vellum/client/core/client_wrapper.py +1 -1
  4. vellum/client/core/pydantic_utilities.py +5 -0
  5. vellum/client/resources/__init__.py +4 -0
  6. vellum/client/resources/organizations/__init__.py +2 -0
  7. vellum/client/resources/organizations/client.py +116 -0
  8. vellum/client/resources/workflows/client.py +8 -0
  9. vellum/client/resources/workspaces/__init__.py +2 -0
  10. vellum/client/resources/workspaces/client.py +114 -0
  11. vellum/client/types/__init__.py +6 -22
  12. vellum/client/types/logical_operator.py +2 -0
  13. vellum/client/types/new_member_join_behavior_enum.py +8 -0
  14. vellum/client/types/{function_call_variable_value.py → organization_read.py} +6 -4
  15. vellum/client/types/workflow_execution_workflow_result_event.py +0 -2
  16. vellum/client/types/workflow_result_event.py +0 -2
  17. vellum/client/types/workflow_result_event_output_data_array.py +4 -4
  18. vellum/client/types/{string_variable_value.py → workspace_read.py} +12 -5
  19. vellum/{types/json_variable_value.py → resources/organizations/__init__.py} +1 -1
  20. vellum/resources/organizations/client.py +3 -0
  21. vellum/{types/image_variable_value.py → resources/workspaces/__init__.py} +1 -1
  22. vellum/{types/array_variable_value.py → resources/workspaces/client.py} +1 -1
  23. vellum/types/{array_variable_value_item.py → new_member_join_behavior_enum.py} +1 -1
  24. vellum/types/{audio_variable_value.py → organization_read.py} +1 -1
  25. vellum/types/{error_variable_value.py → workspace_read.py} +1 -1
  26. vellum/workflows/descriptors/base.py +1 -1
  27. vellum/workflows/descriptors/tests/test_utils.py +3 -0
  28. vellum/workflows/expressions/accessor.py +8 -2
  29. vellum/workflows/nodes/core/map_node/node.py +49 -24
  30. vellum/workflows/nodes/core/map_node/tests/test_node.py +4 -4
  31. vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +1 -1
  32. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +5 -3
  33. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +3 -0
  34. vellum/workflows/nodes/displayable/bases/search_node.py +37 -2
  35. vellum/workflows/nodes/displayable/bases/tests/__init__.py +0 -0
  36. vellum/workflows/nodes/displayable/bases/tests/test_utils.py +61 -0
  37. vellum/workflows/nodes/displayable/bases/types.py +42 -0
  38. vellum/workflows/nodes/displayable/bases/utils.py +112 -0
  39. vellum/workflows/nodes/displayable/inline_prompt_node/tests/test_node.py +0 -1
  40. vellum/workflows/nodes/displayable/search_node/tests/__init__.py +0 -0
  41. vellum/workflows/nodes/displayable/search_node/tests/test_node.py +164 -0
  42. vellum/workflows/nodes/displayable/tests/test_inline_text_prompt_node.py +2 -3
  43. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +0 -1
  44. vellum/workflows/runner/runner.py +37 -4
  45. vellum/workflows/types/tests/test_utils.py +5 -2
  46. vellum/workflows/types/utils.py +4 -0
  47. vellum/workflows/workflows/base.py +14 -32
  48. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/METADATA +1 -1
  49. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/RECORD +100 -97
  50. vellum_cli/__init__.py +10 -0
  51. vellum_cli/ping.py +28 -0
  52. vellum_cli/tests/test_ping.py +47 -0
  53. vellum_ee/workflows/display/nodes/base_node_display.py +17 -10
  54. vellum_ee/workflows/display/nodes/vellum/api_node.py +1 -0
  55. vellum_ee/workflows/display/nodes/vellum/base_node.py +110 -2
  56. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +1 -0
  57. vellum_ee/workflows/display/nodes/vellum/conditional_node.py +5 -62
  58. vellum_ee/workflows/display/nodes/vellum/error_node.py +1 -0
  59. vellum_ee/workflows/display/nodes/vellum/final_output_node.py +1 -0
  60. vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -0
  61. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +4 -0
  62. vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +1 -0
  63. vellum_ee/workflows/display/nodes/vellum/map_node.py +2 -1
  64. vellum_ee/workflows/display/nodes/vellum/merge_node.py +1 -0
  65. vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -0
  66. vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +15 -10
  67. vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -0
  68. vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -0
  69. vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -0
  70. vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +2 -2
  71. vellum_ee/workflows/display/nodes/vellum/utils.py +71 -1
  72. vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +2 -5
  73. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +18 -2
  74. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_adornments_serialization.py +67 -0
  75. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_attributes_serialization.py +66 -0
  76. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +1015 -0
  77. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +37 -22
  78. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +12 -56
  79. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +43 -93
  80. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +31 -151
  81. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +8 -26
  82. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +4 -15
  83. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +9 -44
  84. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +19 -101
  85. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +19 -73
  86. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +9 -44
  87. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +9 -44
  88. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +8 -6
  89. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +11 -58
  90. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +8 -11
  91. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +7 -30
  92. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -11
  93. vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +9 -44
  94. vellum_ee/workflows/display/utils/vellum.py +4 -42
  95. vellum_ee/workflows/display/vellum.py +9 -43
  96. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +7 -10
  97. vellum_ee/workflows/server/virtual_file_loader.py +3 -3
  98. vellum/client/types/array_variable_value.py +0 -27
  99. vellum/client/types/array_variable_value_item.py +0 -29
  100. vellum/client/types/audio_variable_value.py +0 -25
  101. vellum/client/types/chat_history_variable_value.py +0 -21
  102. vellum/client/types/error_variable_value.py +0 -21
  103. vellum/client/types/image_variable_value.py +0 -25
  104. vellum/client/types/json_variable_value.py +0 -20
  105. vellum/client/types/number_variable_value.py +0 -20
  106. vellum/client/types/search_results_variable_value.py +0 -21
  107. vellum/types/chat_history_variable_value.py +0 -3
  108. vellum/types/function_call_variable_value.py +0 -3
  109. vellum/types/number_variable_value.py +0 -3
  110. vellum/types/search_results_variable_value.py +0 -3
  111. vellum/types/string_variable_value.py +0 -3
  112. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/LICENSE +0 -0
  113. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/WHEEL +0 -0
  114. {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/entry_points.txt +0 -0
@@ -60,7 +60,8 @@ def test_serialize_workflow():
60
60
  "inputs": [],
61
61
  "data": {"label": "Entrypoint Node", "source_handle_id": "34069190-0942-4e0c-8700-b33b9dea4ea0"},
62
62
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
63
- "definition": {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"], "bases": []},
63
+ "base": None,
64
+ "definition": None,
64
65
  }
65
66
 
66
67
  templating_node = workflow_raw_data["nodes"][1]
@@ -106,15 +107,13 @@ def test_serialize_workflow():
106
107
  "output_type": "JSON",
107
108
  },
108
109
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
110
+ "base": {
111
+ "name": "TemplatingNode",
112
+ "module": ["vellum", "workflows", "nodes", "core", "templating_node", "node"],
113
+ },
109
114
  "definition": {
110
115
  "name": "ExampleTemplatingNode",
111
116
  "module": ["tests", "workflows", "basic_templating_node", "workflow_with_json_input"],
112
- "bases": [
113
- {
114
- "name": "TemplatingNode",
115
- "module": ["vellum", "workflows", "nodes", "core", "templating_node", "node"],
116
- }
117
- ],
118
117
  },
119
118
  },
120
119
  templating_node,
@@ -152,13 +151,11 @@ def test_serialize_workflow():
152
151
  }
153
152
  ],
154
153
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
155
- "definition": {
154
+ "base": {
156
155
  "name": "FinalOutputNode",
157
156
  "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
158
- "bases": [
159
- {"name": "BaseNode", "module": ["vellum", "workflows", "nodes", "bases", "base"], "bases": []}
160
- ],
161
157
  },
158
+ "definition": None,
162
159
  },
163
160
  final_output_node,
164
161
  ignore_order=True,
@@ -58,17 +58,8 @@ def test_serialize_workflow():
58
58
  "inputs": [],
59
59
  "data": {"label": "Entrypoint Node", "source_handle_id": "8b8d52a2-844f-44fe-a6c4-142fa70d391b"},
60
60
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
61
- "definition": {
62
- "name": "BaseNode",
63
- "module": [
64
- "vellum",
65
- "workflows",
66
- "nodes",
67
- "bases",
68
- "base",
69
- ],
70
- "bases": [],
71
- },
61
+ "base": None,
62
+ "definition": None,
72
63
  }
73
64
 
74
65
  final_output_node = workflow_raw_data["nodes"][1]
@@ -99,26 +90,12 @@ def test_serialize_workflow():
99
90
  }
100
91
  ],
101
92
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
93
+ "base": {
94
+ "name": "FinalOutputNode",
95
+ "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
96
+ },
102
97
  "definition": {
103
98
  "name": "BasicFinalOutputNode",
104
- "module": [
105
- "tests",
106
- "workflows",
107
- "basic_final_output_node",
108
- "workflow",
109
- ],
110
- "bases": [
111
- {
112
- "name": "FinalOutputNode",
113
- "module": [
114
- "vellum",
115
- "workflows",
116
- "nodes",
117
- "displayable",
118
- "final_output_node",
119
- "node",
120
- ],
121
- }
122
- ],
99
+ "module": ["tests", "workflows", "basic_final_output_node", "workflow"],
123
100
  },
124
101
  }
@@ -55,17 +55,8 @@ def test_serialize_workflow():
55
55
  "id": "c238508d-85ab-4644-8cbb-88eae457fe12",
56
56
  "type": "ENTRYPOINT",
57
57
  "inputs": [],
58
- "definition": {
59
- "bases": [],
60
- "module": [
61
- "vellum",
62
- "workflows",
63
- "nodes",
64
- "bases",
65
- "base",
66
- ],
67
- "name": "BaseNode",
68
- },
58
+ "base": None,
59
+ "definition": None,
69
60
  "data": {
70
61
  "label": "Entrypoint Node",
71
62
  "source_handle_id": "04da0bb6-5b42-4dd1-a4e4-08f3ab03e1a3",
@@ -77,17 +77,8 @@ def test_serialize_workflow__missing_final_output_node():
77
77
  "inputs": [],
78
78
  "data": {"label": "Entrypoint Node", "source_handle_id": "943ac183-d107-4604-aed1-619bd7fef09c"},
79
79
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
80
- "definition": {
81
- "name": "BaseNode",
82
- "module": [
83
- "vellum",
84
- "workflows",
85
- "nodes",
86
- "bases",
87
- "base",
88
- ],
89
- "bases": [],
90
- },
80
+ "base": None,
81
+ "definition": None,
91
82
  }
92
83
 
93
84
  passthrough_node = next(node for node in workflow_raw_data["nodes"] if node["type"] == "GENERIC")
@@ -123,27 +114,13 @@ def test_serialize_workflow__missing_final_output_node():
123
114
  }
124
115
  ],
125
116
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
117
+ "base": {
118
+ "name": "FinalOutputNode",
119
+ "module": ["vellum", "workflows", "nodes", "displayable", "final_output_node", "node"],
120
+ },
126
121
  "definition": {
127
122
  "name": "FirstFinalOutputNode",
128
- "module": [
129
- "tests",
130
- "workflows",
131
- "complex_final_output_node",
132
- "missing_final_output_node",
133
- ],
134
- "bases": [
135
- {
136
- "name": "FinalOutputNode",
137
- "module": [
138
- "vellum",
139
- "workflows",
140
- "nodes",
141
- "displayable",
142
- "final_output_node",
143
- "node",
144
- ],
145
- }
146
- ],
123
+ "module": ["tests", "workflows", "complex_final_output_node", "missing_final_output_node"],
147
124
  },
148
125
  },
149
126
  {
@@ -176,7 +153,7 @@ def test_serialize_workflow__missing_final_output_node():
176
153
  }
177
154
  ],
178
155
  "display_data": {"position": {"x": 0.0, "y": 0.0}},
179
- "definition": {
156
+ "base": {
180
157
  "name": "FinalOutputNode",
181
158
  "module": [
182
159
  "vellum",
@@ -186,20 +163,8 @@ def test_serialize_workflow__missing_final_output_node():
186
163
  "final_output_node",
187
164
  "node",
188
165
  ],
189
- "bases": [
190
- {
191
- "name": "BaseNode",
192
- "module": [
193
- "vellum",
194
- "workflows",
195
- "nodes",
196
- "bases",
197
- "base",
198
- ],
199
- "bases": [],
200
- }
201
- ],
202
166
  },
167
+ "definition": None,
203
168
  },
204
169
  ],
205
170
  final_output_nodes,
@@ -1,10 +1,8 @@
1
- import enum
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 ChatMessage, SearchResult, SearchResultRequest, VellumVariableType
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 = typing.TypeVar("_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 Any, List, Literal, Optional, Union
4
+ from typing import List, Literal, Optional, Union
5
5
 
6
6
  from pydantic import Field
7
7
 
8
- from vellum import ChatMessage, PromptParameters, SearchResult, SearchResultRequest, VellumVariable, VellumVariableType
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,
@@ -47,12 +49,6 @@ class CodeResourceDefinition(UniversalBaseModel):
47
49
  module: List[str]
48
50
 
49
51
 
50
- class NodeDefinition(UniversalBaseModel):
51
- name: str
52
- module: List[str]
53
- bases: List[CodeResourceDefinition]
54
-
55
-
56
52
  class WorkflowDisplayDataViewport(UniversalBaseModel):
57
53
  x: float = 0.0
58
54
  y: float = 0.0
@@ -146,45 +142,14 @@ class WorkflowNodeType(str, Enum):
146
142
  ERROR = "ERROR"
147
143
 
148
144
 
149
- class StringVellumValue(UniversalBaseModel):
150
- type: Literal["STRING"] = "STRING"
151
- value: str
152
-
153
-
154
- class NumberVellumValue(UniversalBaseModel):
155
- type: Literal["NUMBER"] = "NUMBER"
156
- value: Union[int, float]
157
-
158
-
159
- class ChatHistoryVellumValue(UniversalBaseModel):
160
- type: Literal["CHAT_HISTORY"] = "CHAT_HISTORY"
161
- value: Union[List[ChatMessage], List[ChatMessage]]
162
-
163
-
164
- class SearchResultsVellumValue(UniversalBaseModel):
165
- type: Literal["SEARCH_RESULTS"] = "SEARCH_RESULTS"
166
- value: Union[List[SearchResultRequest], List[SearchResult]]
167
-
168
-
169
- class JsonVellumValue(UniversalBaseModel):
170
- type: Literal["JSON"] = "JSON"
171
- value: Optional[Any] = None
172
-
173
-
174
- VellumValue = Union[
175
- StringVellumValue,
176
- NumberVellumValue,
177
- ChatHistoryVellumValue,
178
- SearchResultsVellumValue,
179
- JsonVellumValue,
180
- ]
181
-
182
-
183
145
  class ConstantValuePointer(UniversalBaseModel):
184
146
  type: Literal["CONSTANT_VALUE"] = "CONSTANT_VALUE"
185
147
  data: VellumValue
186
148
 
187
149
 
150
+ ArrayVellumValue.model_rebuild()
151
+
152
+
188
153
  class NodeOutputData(UniversalBaseModel):
189
154
  node_id: str
190
155
  output_id: str
@@ -248,7 +213,8 @@ class BaseWorkflowNode(UniversalBaseModel):
248
213
  inputs: List[NodeInput]
249
214
  type: str
250
215
  display_data: Optional[NodeDisplayData] = None
251
- definition: Optional[NodeDefinition] = None
216
+ base: CodeResourceDefinition
217
+ definition: CodeResourceDefinition
252
218
 
253
219
 
254
220
  class EntrypointNodeData(UniversalBaseModel):
@@ -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, primitive_to_vellum_value
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,
@@ -78,11 +79,6 @@ class VellumWorkflowDisplay(
78
79
  edges: JsonArray = []
79
80
 
80
81
  # Add a single synthetic node for the workflow entrypoint
81
- base_node_definition: JsonObject = {
82
- "name": BaseNode.__name__,
83
- "module": cast(JsonArray, BaseNode.__module__.split(".")),
84
- "bases": [],
85
- }
86
82
  nodes.append(
87
83
  {
88
84
  "id": str(self.display_context.workflow_display.entrypoint_node_id),
@@ -93,7 +89,8 @@ class VellumWorkflowDisplay(
93
89
  "source_handle_id": str(self.display_context.workflow_display.entrypoint_node_source_handle_id),
94
90
  },
95
91
  "display_data": self.display_context.workflow_display.entrypoint_node_display.dict(),
96
- "definition": base_node_definition,
92
+ "base": None,
93
+ "definition": None,
97
94
  },
98
95
  )
99
96
 
@@ -119,10 +116,9 @@ class VellumWorkflowDisplay(
119
116
  ]
120
117
  final_output_node_outputs = {node.Outputs.value for node in final_output_nodes}
121
118
  unreferenced_final_output_node_outputs = final_output_node_outputs.copy()
122
- final_output_node_definition: JsonObject = {
119
+ final_output_node_base: JsonObject = {
123
120
  "name": FinalOutputNode.__name__,
124
121
  "module": cast(JsonArray, FinalOutputNode.__module__.split(".")),
125
- "bases": [base_node_definition],
126
122
  }
127
123
 
128
124
  # Add a synthetic Terminal Node and track the Workflow's output variables for each Workflow output
@@ -171,7 +167,8 @@ class VellumWorkflowDisplay(
171
167
  },
172
168
  "inputs": [node_input.dict()],
173
169
  "display_data": workflow_output_display.display_data.dict(),
174
- "definition": final_output_node_definition,
170
+ "base": final_output_node_base,
171
+ "definition": None,
175
172
  }
176
173
  )
177
174
 
@@ -10,7 +10,7 @@ class VirtualFileLoader(importlib.abc.Loader):
10
10
  return None # use default module creation
11
11
 
12
12
  def exec_module(self, module):
13
- if not self.is_package:
13
+ if not self.is_package or self.code:
14
14
  exec(self.code, module.__dict__)
15
15
 
16
16
 
@@ -26,13 +26,13 @@ class VirtualFileFinder(importlib.abc.MetaPathFinder, importlib.abc.Loader):
26
26
  key_name = "__init__" if fullname == self.namespace else fullname.replace(f"{self.namespace}.", "")
27
27
 
28
28
  files_key = f"{key_name.replace('.', '/')}.py"
29
- if not self.files.get(files_key):
29
+ if self.files.get(files_key) is None:
30
30
  files_key = f"{key_name.replace('.', '/')}/__init__.py"
31
31
 
32
32
  file = self.files.get(files_key)
33
33
  is_package = "__init__" in files_key
34
34
 
35
- if file:
35
+ if file is not None:
36
36
  return importlib.machinery.ModuleSpec(
37
37
  prefixed_name,
38
38
  VirtualFileLoader(file, is_package),
@@ -1,27 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from __future__ import annotations
4
- from ..core.pydantic_utilities import UniversalBaseModel
5
- import typing
6
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
- import pydantic
8
- from ..core.pydantic_utilities import update_forward_refs
9
-
10
-
11
- class ArrayVariableValue(UniversalBaseModel):
12
- type: typing.Literal["ARRAY"] = "ARRAY"
13
- value: typing.Optional[typing.List["ArrayVariableValueItem"]] = None
14
-
15
- if IS_PYDANTIC_V2:
16
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
17
- else:
18
-
19
- class Config:
20
- frozen = True
21
- smart_union = True
22
- extra = pydantic.Extra.allow
23
-
24
-
25
- from .array_variable_value_item import ArrayVariableValueItem # noqa: E402
26
-
27
- update_forward_refs(ArrayVariableValue)
@@ -1,29 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from __future__ import annotations
4
- import typing
5
- from .string_variable_value import StringVariableValue
6
- from .number_variable_value import NumberVariableValue
7
- from .json_variable_value import JsonVariableValue
8
- from .error_variable_value import ErrorVariableValue
9
- from .function_call_variable_value import FunctionCallVariableValue
10
- from .image_variable_value import ImageVariableValue
11
- from .audio_variable_value import AudioVariableValue
12
- from .chat_history_variable_value import ChatHistoryVariableValue
13
- from .search_results_variable_value import SearchResultsVariableValue
14
- import typing
15
-
16
- if typing.TYPE_CHECKING:
17
- from .array_variable_value import ArrayVariableValue
18
- ArrayVariableValueItem = typing.Union[
19
- StringVariableValue,
20
- NumberVariableValue,
21
- JsonVariableValue,
22
- ErrorVariableValue,
23
- FunctionCallVariableValue,
24
- ImageVariableValue,
25
- AudioVariableValue,
26
- ChatHistoryVariableValue,
27
- SearchResultsVariableValue,
28
- "ArrayVariableValue",
29
- ]
@@ -1,25 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.pydantic_utilities import UniversalBaseModel
4
- import typing
5
- from .vellum_audio import VellumAudio
6
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
- import pydantic
8
-
9
-
10
- class AudioVariableValue(UniversalBaseModel):
11
- """
12
- A base Vellum primitive value representing audio.
13
- """
14
-
15
- type: typing.Literal["AUDIO"] = "AUDIO"
16
- value: typing.Optional[VellumAudio] = None
17
-
18
- if IS_PYDANTIC_V2:
19
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
20
- else:
21
-
22
- class Config:
23
- frozen = True
24
- smart_union = True
25
- extra = pydantic.Extra.allow
@@ -1,21 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.pydantic_utilities import UniversalBaseModel
4
- import typing
5
- from .chat_message import ChatMessage
6
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
- import pydantic
8
-
9
-
10
- class ChatHistoryVariableValue(UniversalBaseModel):
11
- type: typing.Literal["CHAT_HISTORY"] = "CHAT_HISTORY"
12
- value: typing.Optional[typing.List[ChatMessage]] = None
13
-
14
- if IS_PYDANTIC_V2:
15
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16
- else:
17
-
18
- class Config:
19
- frozen = True
20
- smart_union = True
21
- extra = pydantic.Extra.allow
@@ -1,21 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.pydantic_utilities import UniversalBaseModel
4
- import typing
5
- from .vellum_error import VellumError
6
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
- import pydantic
8
-
9
-
10
- class ErrorVariableValue(UniversalBaseModel):
11
- type: typing.Literal["ERROR"] = "ERROR"
12
- value: typing.Optional[VellumError] = None
13
-
14
- if IS_PYDANTIC_V2:
15
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16
- else:
17
-
18
- class Config:
19
- frozen = True
20
- smart_union = True
21
- extra = pydantic.Extra.allow
@@ -1,25 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.pydantic_utilities import UniversalBaseModel
4
- import typing
5
- from .vellum_image import VellumImage
6
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
- import pydantic
8
-
9
-
10
- class ImageVariableValue(UniversalBaseModel):
11
- """
12
- A base Vellum primitive value representing an image.
13
- """
14
-
15
- type: typing.Literal["IMAGE"] = "IMAGE"
16
- value: typing.Optional[VellumImage] = None
17
-
18
- if IS_PYDANTIC_V2:
19
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
20
- else:
21
-
22
- class Config:
23
- frozen = True
24
- smart_union = True
25
- extra = pydantic.Extra.allow
@@ -1,20 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.pydantic_utilities import UniversalBaseModel
4
- import typing
5
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
- import pydantic
7
-
8
-
9
- class JsonVariableValue(UniversalBaseModel):
10
- type: typing.Literal["JSON"] = "JSON"
11
- value: typing.Optional[typing.Any] = None
12
-
13
- if IS_PYDANTIC_V2:
14
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
15
- else:
16
-
17
- class Config:
18
- frozen = True
19
- smart_union = True
20
- extra = pydantic.Extra.allow
@@ -1,20 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.pydantic_utilities import UniversalBaseModel
4
- import typing
5
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
- import pydantic
7
-
8
-
9
- class NumberVariableValue(UniversalBaseModel):
10
- type: typing.Literal["NUMBER"] = "NUMBER"
11
- value: typing.Optional[float] = None
12
-
13
- if IS_PYDANTIC_V2:
14
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
15
- else:
16
-
17
- class Config:
18
- frozen = True
19
- smart_union = True
20
- extra = pydantic.Extra.allow
@@ -1,21 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- from ..core.pydantic_utilities import UniversalBaseModel
4
- import typing
5
- from .search_result import SearchResult
6
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
- import pydantic
8
-
9
-
10
- class SearchResultsVariableValue(UniversalBaseModel):
11
- type: typing.Literal["SEARCH_RESULTS"] = "SEARCH_RESULTS"
12
- value: typing.Optional[typing.List[SearchResult]] = None
13
-
14
- if IS_PYDANTIC_V2:
15
- model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
16
- else:
17
-
18
- class Config:
19
- frozen = True
20
- smart_union = True
21
- extra = pydantic.Extra.allow