vellum-ai 1.1.2__py3-none-any.whl → 1.1.3__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.
Files changed (84) hide show
  1. vellum/__init__.py +16 -0
  2. vellum/client/README.md +55 -0
  3. vellum/client/__init__.py +66 -507
  4. vellum/client/core/client_wrapper.py +2 -2
  5. vellum/client/raw_client.py +844 -0
  6. vellum/client/reference.md +692 -19
  7. vellum/client/resources/ad_hoc/client.py +23 -180
  8. vellum/client/resources/ad_hoc/raw_client.py +276 -0
  9. vellum/client/resources/container_images/client.py +10 -36
  10. vellum/client/resources/deployments/client.py +16 -62
  11. vellum/client/resources/document_indexes/client.py +16 -72
  12. vellum/client/resources/documents/client.py +8 -30
  13. vellum/client/resources/folder_entities/client.py +4 -8
  14. vellum/client/resources/metric_definitions/client.py +4 -14
  15. vellum/client/resources/ml_models/client.py +2 -8
  16. vellum/client/resources/organizations/client.py +2 -6
  17. vellum/client/resources/prompts/client.py +2 -10
  18. vellum/client/resources/sandboxes/client.py +4 -20
  19. vellum/client/resources/test_suite_runs/client.py +4 -18
  20. vellum/client/resources/test_suites/client.py +11 -86
  21. vellum/client/resources/test_suites/raw_client.py +136 -0
  22. vellum/client/resources/workflow_deployments/client.py +20 -78
  23. vellum/client/resources/workflow_executions/client.py +2 -6
  24. vellum/client/resources/workflow_sandboxes/client.py +2 -10
  25. vellum/client/resources/workflows/client.py +7 -6
  26. vellum/client/resources/workflows/raw_client.py +58 -47
  27. vellum/client/resources/workspace_secrets/client.py +4 -20
  28. vellum/client/resources/workspaces/client.py +2 -6
  29. vellum/client/types/__init__.py +16 -0
  30. vellum/client/types/array_chat_message_content_item.py +4 -2
  31. vellum/client/types/array_chat_message_content_item_request.py +4 -2
  32. vellum/client/types/chat_message_content.py +4 -2
  33. vellum/client/types/chat_message_content_request.py +4 -2
  34. vellum/client/types/node_execution_span.py +2 -0
  35. vellum/client/types/prompt_block.py +4 -2
  36. vellum/client/types/vellum_value.py +4 -2
  37. vellum/client/types/vellum_value_request.py +4 -2
  38. vellum/client/types/vellum_variable_type.py +2 -1
  39. vellum/client/types/vellum_video.py +24 -0
  40. vellum/client/types/vellum_video_request.py +24 -0
  41. vellum/client/types/video_chat_message_content.py +25 -0
  42. vellum/client/types/video_chat_message_content_request.py +25 -0
  43. vellum/client/types/video_prompt_block.py +29 -0
  44. vellum/client/types/video_vellum_value.py +25 -0
  45. vellum/client/types/video_vellum_value_request.py +25 -0
  46. vellum/client/types/workflow_execution_span.py +2 -0
  47. vellum/client/types/workflow_execution_usage_calculation_fulfilled_body.py +22 -0
  48. vellum/prompts/blocks/compilation.py +22 -10
  49. vellum/types/vellum_video.py +3 -0
  50. vellum/types/vellum_video_request.py +3 -0
  51. vellum/types/video_chat_message_content.py +3 -0
  52. vellum/types/video_chat_message_content_request.py +3 -0
  53. vellum/types/video_prompt_block.py +3 -0
  54. vellum/types/video_vellum_value.py +3 -0
  55. vellum/types/video_vellum_value_request.py +3 -0
  56. vellum/types/workflow_execution_usage_calculation_fulfilled_body.py +3 -0
  57. vellum/workflows/events/workflow.py +11 -0
  58. vellum/workflows/graph/graph.py +103 -1
  59. vellum/workflows/graph/tests/test_graph.py +99 -0
  60. vellum/workflows/nodes/bases/base.py +9 -1
  61. vellum/workflows/nodes/displayable/bases/utils.py +4 -2
  62. vellum/workflows/nodes/displayable/tool_calling_node/node.py +19 -18
  63. vellum/workflows/nodes/displayable/tool_calling_node/tests/test_node.py +17 -7
  64. vellum/workflows/nodes/displayable/tool_calling_node/tests/test_utils.py +7 -7
  65. vellum/workflows/nodes/displayable/tool_calling_node/utils.py +47 -80
  66. vellum/workflows/references/environment_variable.py +10 -0
  67. vellum/workflows/runner/runner.py +18 -2
  68. vellum/workflows/state/context.py +101 -12
  69. vellum/workflows/types/definition.py +11 -1
  70. vellum/workflows/types/tests/test_definition.py +19 -0
  71. vellum/workflows/utils/vellum_variables.py +9 -5
  72. vellum/workflows/workflows/base.py +12 -5
  73. {vellum_ai-1.1.2.dist-info → vellum_ai-1.1.3.dist-info}/METADATA +1 -1
  74. {vellum_ai-1.1.2.dist-info → vellum_ai-1.1.3.dist-info}/RECORD +84 -68
  75. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +1 -1
  76. vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py +55 -1
  77. vellum_ee/workflows/display/nodes/vellum/tests/test_tool_calling_node.py +15 -52
  78. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_mcp_serialization.py +15 -49
  79. vellum_ee/workflows/display/types.py +14 -1
  80. vellum_ee/workflows/display/utils/expressions.py +13 -4
  81. vellum_ee/workflows/display/workflows/base_workflow_display.py +6 -19
  82. {vellum_ai-1.1.2.dist-info → vellum_ai-1.1.3.dist-info}/LICENSE +0 -0
  83. {vellum_ai-1.1.2.dist-info → vellum_ai-1.1.3.dist-info}/WHEEL +0 -0
  84. {vellum_ai-1.1.2.dist-info → vellum_ai-1.1.3.dist-info}/entry_points.txt +0 -0
@@ -45,54 +45,20 @@ def test_serialize_workflow():
45
45
  "id": "20adf593-c4f0-4c67-8e36-37eb66f28f66",
46
46
  "name": "functions",
47
47
  "value": {
48
- "type": "ARRAY_REFERENCE",
49
- "items": [
50
- {
51
- "type": "DICTIONARY_REFERENCE",
52
- "entries": [
53
- {
54
- "id": "bcf2713b-19fc-4b4b-8ff5-b45c8e63c665",
55
- "key": "type",
56
- "value": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "MCP_SERVER"}},
57
- },
58
- {
59
- "id": "5a3aef6f-b8a1-4f37-8688-b513da42a35a",
60
- "key": "name",
61
- "value": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "github"}},
62
- },
63
- {
64
- "id": "641decf3-79c5-4ef9-9fc8-06570d8a69af",
65
- "key": "url",
66
- "value": {
67
- "type": "CONSTANT_VALUE",
68
- "value": {"type": "STRING", "value": "https://api.githubcopilot.com/mcp/"},
69
- },
70
- },
71
- {
72
- "id": "801a74ca-7966-4ac3-b1b5-bebb71a7de07",
73
- "key": "authorization_type",
74
- "value": {"type": "CONSTANT_VALUE", "value": {"type": "STRING", "value": "BEARER_TOKEN"}},
75
- },
76
- {
77
- "id": "fcd70e2f-0fb2-4011-a73b-90d5d7643be4",
78
- "key": "bearer_token_value",
79
- "value": {
80
- "type": "ENVIRONMENT_VARIABLE",
81
- "environment_variable": "GITHUB_PERSONAL_ACCESS_TOKEN",
82
- },
83
- },
84
- {
85
- "id": "b2fa2900-0e09-44ff-99db-c5399fd76d28",
86
- "key": "api_key_header_key",
87
- "value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
88
- },
89
- {
90
- "id": "6ab23414-5f1b-49c1-a0bc-891bbba9124c",
91
- "key": "api_key_header_value",
92
- "value": {"type": "CONSTANT_VALUE", "value": {"type": "JSON", "value": None}},
93
- },
94
- ],
95
- }
96
- ],
48
+ "type": "CONSTANT_VALUE",
49
+ "value": {
50
+ "type": "JSON",
51
+ "value": [
52
+ {
53
+ "type": "MCP_SERVER",
54
+ "name": "github",
55
+ "url": "https://api.githubcopilot.com/mcp/",
56
+ "authorization_type": "BEARER_TOKEN",
57
+ "bearer_token_value": "GITHUB_PERSONAL_ACCESS_TOKEN",
58
+ "api_key_header_key": None,
59
+ "api_key_header_value": None,
60
+ }
61
+ ],
62
+ },
97
63
  },
98
64
  }
@@ -1,5 +1,5 @@
1
1
  from dataclasses import dataclass, field
2
- from typing import TYPE_CHECKING, Dict, Tuple, Type
2
+ from typing import TYPE_CHECKING, Dict, Iterator, List, Tuple, Type
3
3
 
4
4
  from vellum.client import Vellum as VellumClient
5
5
  from vellum.workflows.descriptors.base import BaseDescriptor
@@ -51,3 +51,16 @@ class WorkflowDisplayContext:
51
51
  workflow_output_displays: WorkflowOutputDisplays = field(default_factory=dict)
52
52
  edge_displays: EdgeDisplays = field(default_factory=dict)
53
53
  port_displays: PortDisplays = field(default_factory=dict)
54
+ _errors: List[Exception] = field(default_factory=list)
55
+ _dry_run: bool = False
56
+
57
+ def add_error(self, error: Exception) -> None:
58
+ if self._dry_run:
59
+ self._errors.append(error)
60
+ return
61
+
62
+ raise error
63
+
64
+ @property
65
+ def errors(self) -> Iterator[Exception]:
66
+ return iter(self._errors)
@@ -266,10 +266,19 @@ def serialize_value(display_context: "WorkflowDisplayContext", value: Any) -> Js
266
266
  }
267
267
 
268
268
  if isinstance(value, EnvironmentVariableReference):
269
- return {
270
- "type": "ENVIRONMENT_VARIABLE",
271
- "environment_variable": value.name,
272
- }
269
+ if value.serialize_as_constant:
270
+ return {
271
+ "type": "CONSTANT_VALUE",
272
+ "value": {
273
+ "type": "STRING",
274
+ "value": value.name,
275
+ },
276
+ }
277
+ else:
278
+ return {
279
+ "type": "ENVIRONMENT_VARIABLE",
280
+ "environment_variable": value.name,
281
+ }
273
282
 
274
283
  if isinstance(value, ExecutionCountReference):
275
284
  node_class_display = display_context.global_node_displays[value.node_class]
@@ -6,7 +6,7 @@ import inspect
6
6
  import logging
7
7
  import os
8
8
  from uuid import UUID
9
- from typing import Any, Dict, ForwardRef, Generic, Iterator, List, Optional, Tuple, Type, TypeVar, Union, cast, get_args
9
+ from typing import Any, Dict, ForwardRef, Generic, List, Optional, Tuple, Type, TypeVar, Union, cast, get_args
10
10
 
11
11
  from vellum.client import Vellum as VellumClient
12
12
  from vellum.client.core.pydantic_utilities import UniversalBaseModel
@@ -96,8 +96,6 @@ class BaseWorkflowDisplay(Generic[WorkflowType]):
96
96
  # Used to explicitly specify display data for a workflow's ports.
97
97
  port_displays: PortDisplays = {}
98
98
 
99
- _errors: List[Exception]
100
-
101
99
  _serialized_files: List[str]
102
100
 
103
101
  _dry_run: bool
@@ -116,7 +114,6 @@ class BaseWorkflowDisplay(Generic[WorkflowType]):
116
114
  if self._parent_display_context
117
115
  else create_vellum_client()
118
116
  )
119
- self._errors = []
120
117
  self._serialized_files = []
121
118
  self._dry_run = dry_run
122
119
 
@@ -196,7 +193,7 @@ class BaseWorkflowDisplay(Generic[WorkflowType]):
196
193
  try:
197
194
  serialized_node = node_display.serialize(self.display_context)
198
195
  except (NotImplementedError, NodeValidationError) as e:
199
- self.add_error(e)
196
+ self.display_context.add_error(e)
200
197
  continue
201
198
 
202
199
  serialized_nodes[node_display.node_id] = serialized_node
@@ -315,7 +312,7 @@ class BaseWorkflowDisplay(Generic[WorkflowType]):
315
312
  # If there are terminal nodes with no workflow output reference,
316
313
  # raise a serialization error
317
314
  if len(unreferenced_final_output_node_outputs) > 0:
318
- self.add_error(
315
+ self.display_context.add_error(
319
316
  ValueError("Unable to serialize terminal nodes that are not referenced by workflow outputs.")
320
317
  )
321
318
 
@@ -375,7 +372,7 @@ class BaseWorkflowDisplay(Generic[WorkflowType]):
375
372
  try:
376
373
  self._apply_auto_layout(nodes_dict_list, edges)
377
374
  except Exception as e:
378
- self.add_error(e)
375
+ self.display_context.add_error(e)
379
376
 
380
377
  return {
381
378
  "workflow_raw_data": {
@@ -446,17 +443,6 @@ class BaseWorkflowDisplay(Generic[WorkflowType]):
446
443
  """Can be overridden as a class attribute to specify a custom workflow id."""
447
444
  return self._workflow.__id__
448
445
 
449
- def add_error(self, error: Exception) -> None:
450
- if self._dry_run:
451
- self._errors.append(error)
452
- return
453
-
454
- raise error
455
-
456
- @property
457
- def errors(self) -> Iterator[Exception]:
458
- return iter(self._errors)
459
-
460
446
  def _enrich_global_node_output_displays(
461
447
  self,
462
448
  node: Type[BaseNode],
@@ -606,6 +592,7 @@ class BaseWorkflowDisplay(Generic[WorkflowType]):
606
592
  edge_displays=edge_displays,
607
593
  port_displays=port_displays,
608
594
  workflow_display_class=self.__class__,
595
+ _dry_run=self._dry_run,
609
596
  )
610
597
 
611
598
  def _generate_workflow_meta_display(self) -> WorkflowMetaDisplay:
@@ -896,7 +883,7 @@ class BaseWorkflowDisplay(Generic[WorkflowType]):
896
883
 
897
884
  return WorkflowSerializationResult(
898
885
  exec_config=exec_config,
899
- errors=[str(error) for error in workflow_display.errors],
886
+ errors=[str(error) for error in workflow_display.display_context.errors],
900
887
  )
901
888
 
902
889
  def _gather_additional_module_files(self, module_path: str) -> Dict[str, str]: