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.
- vellum/__init__.py +10 -22
- vellum/client/__init__.py +8 -0
- vellum/client/core/client_wrapper.py +1 -1
- vellum/client/core/pydantic_utilities.py +5 -0
- vellum/client/resources/__init__.py +4 -0
- vellum/client/resources/organizations/__init__.py +2 -0
- vellum/client/resources/organizations/client.py +116 -0
- vellum/client/resources/workflows/client.py +8 -0
- vellum/client/resources/workspaces/__init__.py +2 -0
- vellum/client/resources/workspaces/client.py +114 -0
- vellum/client/types/__init__.py +6 -22
- vellum/client/types/logical_operator.py +2 -0
- vellum/client/types/new_member_join_behavior_enum.py +8 -0
- vellum/client/types/{function_call_variable_value.py → organization_read.py} +6 -4
- vellum/client/types/workflow_execution_workflow_result_event.py +0 -2
- vellum/client/types/workflow_result_event.py +0 -2
- vellum/client/types/workflow_result_event_output_data_array.py +4 -4
- vellum/client/types/{string_variable_value.py → workspace_read.py} +12 -5
- vellum/{types/json_variable_value.py → resources/organizations/__init__.py} +1 -1
- vellum/resources/organizations/client.py +3 -0
- vellum/{types/image_variable_value.py → resources/workspaces/__init__.py} +1 -1
- vellum/{types/array_variable_value.py → resources/workspaces/client.py} +1 -1
- vellum/types/{array_variable_value_item.py → new_member_join_behavior_enum.py} +1 -1
- vellum/types/{audio_variable_value.py → organization_read.py} +1 -1
- vellum/types/{error_variable_value.py → workspace_read.py} +1 -1
- 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 -32
- {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/METADATA +1 -1
- {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/RECORD +100 -97
- 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/base_node_display.py +17 -10
- vellum_ee/workflows/display/nodes/vellum/api_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/base_node.py +110 -2
- vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/conditional_node.py +5 -62
- vellum_ee/workflows/display/nodes/vellum/error_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/final_output_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +4 -0
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/map_node.py +2 -1
- vellum_ee/workflows/display/nodes/vellum/merge_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +15 -10
- vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -0
- vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py +2 -2
- vellum_ee/workflows/display/nodes/vellum/utils.py +71 -1
- vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +2 -5
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +18 -2
- 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 +1015 -0
- vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +37 -22
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +12 -56
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +43 -93
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +31 -151
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +8 -26
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +4 -15
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +9 -44
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +19 -101
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +19 -73
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +9 -44
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +9 -44
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +8 -6
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +11 -58
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +8 -11
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +7 -30
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -11
- vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +9 -44
- vellum_ee/workflows/display/utils/vellum.py +4 -42
- vellum_ee/workflows/display/vellum.py +9 -43
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py +7 -10
- vellum_ee/workflows/server/virtual_file_loader.py +3 -3
- vellum/client/types/array_variable_value.py +0 -27
- vellum/client/types/array_variable_value_item.py +0 -29
- vellum/client/types/audio_variable_value.py +0 -25
- vellum/client/types/chat_history_variable_value.py +0 -21
- vellum/client/types/error_variable_value.py +0 -21
- vellum/client/types/image_variable_value.py +0 -25
- vellum/client/types/json_variable_value.py +0 -20
- vellum/client/types/number_variable_value.py +0 -20
- vellum/client/types/search_results_variable_value.py +0 -21
- vellum/types/chat_history_variable_value.py +0 -3
- vellum/types/function_call_variable_value.py +0 -3
- vellum/types/number_variable_value.py +0 -3
- vellum/types/search_results_variable_value.py +0 -3
- vellum/types/string_variable_value.py +0 -3
- {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/LICENSE +0 -0
- {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/WHEEL +0 -0
- {vellum_ai-0.12.17.dist-info → vellum_ai-0.13.1.dist-info}/entry_points.txt +0 -0
@@ -188,6 +188,7 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
|
|
188
188
|
external_inputs: Optional[ExternalInputsArg] = None,
|
189
189
|
cancel_signal: Optional[ThreadingEvent] = None,
|
190
190
|
node_output_mocks: Optional[List[BaseOutputs]] = None,
|
191
|
+
max_concurrency: Optional[int] = None,
|
191
192
|
) -> TerminalWorkflowEvent:
|
192
193
|
"""
|
193
194
|
Invoke a Workflow, returning the last event emitted, which should be one of:
|
@@ -215,6 +216,11 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
|
|
215
216
|
|
216
217
|
node_output_mocks: Optional[List[Outputs]] = None
|
217
218
|
A list of Outputs to mock for Nodes during Workflow Execution.
|
219
|
+
|
220
|
+
max_concurrency: Optional[int] = None
|
221
|
+
The max number of concurrent threads to run the Workflow with. If not provided, the Workflow will run
|
222
|
+
without limiting concurrency. This configuration only applies to the current Workflow and not to any
|
223
|
+
subworkflows or nodes that utilizes threads.
|
218
224
|
"""
|
219
225
|
|
220
226
|
events = WorkflowRunner(
|
@@ -226,6 +232,7 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
|
|
226
232
|
cancel_signal=cancel_signal,
|
227
233
|
node_output_mocks=node_output_mocks,
|
228
234
|
parent_context=self._context.parent_context,
|
235
|
+
max_concurrency=max_concurrency,
|
229
236
|
).stream()
|
230
237
|
first_event: Optional[Union[WorkflowExecutionInitiatedEvent, WorkflowExecutionResumedEvent]] = None
|
231
238
|
last_event = None
|
@@ -289,6 +296,7 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
|
|
289
296
|
external_inputs: Optional[ExternalInputsArg] = None,
|
290
297
|
cancel_signal: Optional[ThreadingEvent] = None,
|
291
298
|
node_output_mocks: Optional[List[BaseOutputs]] = None,
|
299
|
+
max_concurrency: Optional[int] = None,
|
292
300
|
) -> WorkflowEventStream:
|
293
301
|
"""
|
294
302
|
Invoke a Workflow, yielding events as they are emitted.
|
@@ -317,6 +325,11 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
|
|
317
325
|
|
318
326
|
node_output_mocks: Optional[List[Outputs]] = None
|
319
327
|
A list of Outputs to mock for Nodes during Workflow Execution.
|
328
|
+
|
329
|
+
max_concurrency: Optional[int] = None
|
330
|
+
The max number of concurrent threads to run the Workflow with. If not provided, the Workflow will run
|
331
|
+
without limiting concurrency. This configuration only applies to the current Workflow and not to any
|
332
|
+
subworkflows or nodes that utilizes threads.
|
320
333
|
"""
|
321
334
|
|
322
335
|
should_yield = event_filter or workflow_event_filter
|
@@ -329,6 +342,7 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
|
|
329
342
|
cancel_signal=cancel_signal,
|
330
343
|
node_output_mocks=node_output_mocks,
|
331
344
|
parent_context=self.context.parent_context,
|
345
|
+
max_concurrency=max_concurrency,
|
332
346
|
).stream():
|
333
347
|
if should_yield(self.__class__, event):
|
334
348
|
yield event
|
@@ -437,40 +451,8 @@ class BaseWorkflow(Generic[WorkflowInputsType, StateType], metaclass=_BaseWorkfl
|
|
437
451
|
raise ValueError(f"No workflows found in {module_path}")
|
438
452
|
elif len(workflows) > 1:
|
439
453
|
raise ValueError(f"Multiple workflows found in {module_path}")
|
440
|
-
try:
|
441
|
-
BaseWorkflow.import_node_display(module_path)
|
442
|
-
except ModuleNotFoundError:
|
443
|
-
pass
|
444
|
-
|
445
454
|
return workflows[0]
|
446
455
|
|
447
|
-
@staticmethod
|
448
|
-
def import_node_display(module_path):
|
449
|
-
# Import the nodes package
|
450
|
-
nodes_package = importlib.import_module(f"{module_path}.display.nodes")
|
451
|
-
# Use the loader to get the code
|
452
|
-
if hasattr(nodes_package, "__spec__") and nodes_package.__spec__ and nodes_package.__spec__.loader:
|
453
|
-
loader = nodes_package.__spec__.loader
|
454
|
-
|
455
|
-
# Check if the loader has a code attribute
|
456
|
-
if hasattr(loader, "code"):
|
457
|
-
code = loader.code
|
458
|
-
|
459
|
-
# Parse the code to find import statements
|
460
|
-
import_lines = [line.strip() for line in code.splitlines() if line.startswith("from ")]
|
461
|
-
|
462
|
-
# Import each module specified in the code
|
463
|
-
for line in import_lines:
|
464
|
-
try:
|
465
|
-
# Extract module name from the import line
|
466
|
-
module_name = line.split(" ")[1]
|
467
|
-
full_module_path = f"{module_path}.display.nodes{module_name}"
|
468
|
-
importlib.import_module(full_module_path)
|
469
|
-
except Exception:
|
470
|
-
continue
|
471
|
-
# Also import from workflow.py
|
472
|
-
importlib.import_module(f"{module_path}.display.workflow")
|
473
|
-
|
474
456
|
|
475
457
|
WorkflowExecutionInitiatedBody.model_rebuild()
|
476
458
|
WorkflowExecutionFulfilledBody.model_rebuild()
|