vellum-ai 0.12.16__py3-none-any.whl → 0.13.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) 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/resources/__init__.py +4 -0
  5. vellum/client/resources/organizations/__init__.py +2 -0
  6. vellum/client/resources/organizations/client.py +116 -0
  7. vellum/client/resources/workspaces/__init__.py +2 -0
  8. vellum/client/resources/workspaces/client.py +114 -0
  9. vellum/client/types/__init__.py +6 -22
  10. vellum/client/types/new_member_join_behavior_enum.py +8 -0
  11. vellum/client/types/{function_call_variable_value.py → organization_read.py} +6 -4
  12. vellum/client/types/workflow_execution_workflow_result_event.py +0 -2
  13. vellum/client/types/workflow_result_event.py +0 -2
  14. vellum/client/types/workflow_result_event_output_data_array.py +4 -4
  15. vellum/client/types/{string_variable_value.py → workspace_read.py} +12 -5
  16. vellum/plugins/vellum_mypy.py +80 -11
  17. vellum/{types/json_variable_value.py → resources/organizations/__init__.py} +1 -1
  18. vellum/resources/organizations/client.py +3 -0
  19. vellum/{types/image_variable_value.py → resources/workspaces/__init__.py} +1 -1
  20. vellum/{types/array_variable_value.py → resources/workspaces/client.py} +1 -1
  21. vellum/types/{array_variable_value_item.py → new_member_join_behavior_enum.py} +1 -1
  22. vellum/types/{audio_variable_value.py → organization_read.py} +1 -1
  23. vellum/types/{error_variable_value.py → workspace_read.py} +1 -1
  24. vellum/utils/templating/render.py +3 -0
  25. vellum/workflows/nodes/bases/base.py +4 -0
  26. vellum/workflows/nodes/core/retry_node/node.py +24 -3
  27. vellum/workflows/nodes/core/retry_node/tests/test_node.py +40 -0
  28. vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +20 -1
  29. vellum/workflows/nodes/displayable/api_node/node.py +3 -3
  30. vellum/workflows/workflows/base.py +0 -32
  31. {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/METADATA +1 -1
  32. {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/RECORD +79 -86
  33. vellum_cli/pull.py +7 -4
  34. vellum_cli/tests/conftest.py +4 -2
  35. vellum_cli/tests/test_push.py +13 -5
  36. vellum_ee/workflows/display/nodes/base_node_display.py +17 -10
  37. vellum_ee/workflows/display/nodes/vellum/api_node.py +1 -0
  38. vellum_ee/workflows/display/nodes/vellum/base_node.py +97 -2
  39. vellum_ee/workflows/display/nodes/vellum/code_execution_node.py +1 -0
  40. vellum_ee/workflows/display/nodes/vellum/conditional_node.py +5 -62
  41. vellum_ee/workflows/display/nodes/vellum/error_node.py +1 -0
  42. vellum_ee/workflows/display/nodes/vellum/final_output_node.py +1 -0
  43. vellum_ee/workflows/display/nodes/vellum/guardrail_node.py +1 -0
  44. vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +1 -0
  45. vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py +1 -0
  46. vellum_ee/workflows/display/nodes/vellum/map_node.py +1 -0
  47. vellum_ee/workflows/display/nodes/vellum/merge_node.py +1 -0
  48. vellum_ee/workflows/display/nodes/vellum/note_node.py +1 -0
  49. vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py +1 -0
  50. vellum_ee/workflows/display/nodes/vellum/search_node.py +1 -0
  51. vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py +1 -0
  52. vellum_ee/workflows/display/nodes/vellum/templating_node.py +1 -0
  53. vellum_ee/workflows/display/nodes/vellum/utils.py +63 -0
  54. vellum_ee/workflows/display/tests/test_vellum_workflow_display.py +2 -5
  55. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/conftest.py +18 -2
  56. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_ports_serialization.py +355 -0
  57. vellum_ee/workflows/display/tests/workflow_serialization/generic_nodes/test_trigger_serialization.py +37 -22
  58. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +12 -56
  59. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_code_execution_node_serialization.py +43 -93
  60. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_conditional_node_serialization.py +31 -151
  61. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_serialization.py +8 -26
  62. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_generic_node_serialization.py +4 -15
  63. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py +9 -44
  64. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py +19 -101
  65. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py +19 -73
  66. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +9 -44
  67. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py +9 -44
  68. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_search_node_serialization.py +8 -6
  69. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py +11 -58
  70. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_node_serialization.py +8 -11
  71. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py +7 -30
  72. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py +2 -11
  73. vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py +9 -44
  74. vellum_ee/workflows/display/vellum.py +2 -7
  75. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +5 -9
  76. vellum_ee/workflows/server/virtual_file_loader.py +3 -3
  77. vellum/client/types/array_variable_value.py +0 -27
  78. vellum/client/types/array_variable_value_item.py +0 -29
  79. vellum/client/types/audio_variable_value.py +0 -25
  80. vellum/client/types/chat_history_variable_value.py +0 -21
  81. vellum/client/types/error_variable_value.py +0 -21
  82. vellum/client/types/image_variable_value.py +0 -25
  83. vellum/client/types/json_variable_value.py +0 -20
  84. vellum/client/types/number_variable_value.py +0 -20
  85. vellum/client/types/search_results_variable_value.py +0 -21
  86. vellum/types/chat_history_variable_value.py +0 -3
  87. vellum/types/function_call_variable_value.py +0 -3
  88. vellum/types/number_variable_value.py +0 -3
  89. vellum/types/search_results_variable_value.py +0 -3
  90. vellum/types/string_variable_value.py +0 -3
  91. {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/LICENSE +0 -0
  92. {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/WHEEL +0 -0
  93. {vellum_ai-0.12.16.dist-info → vellum_ai-0.13.0.dist-info}/entry_points.txt +0 -0
@@ -14,14 +14,11 @@ from .array_chat_message_content_item import ArrayChatMessageContentItem
14
14
  from .array_chat_message_content_item_request import ArrayChatMessageContentItemRequest
15
15
  from .array_chat_message_content_request import ArrayChatMessageContentRequest
16
16
  from .array_input import ArrayInput
17
- from .array_variable_value import ArrayVariableValue
18
- from .array_variable_value_item import ArrayVariableValueItem
19
17
  from .array_vellum_value import ArrayVellumValue
20
18
  from .array_vellum_value_request import ArrayVellumValueRequest
21
19
  from .audio_chat_message_content import AudioChatMessageContent
22
20
  from .audio_chat_message_content_request import AudioChatMessageContentRequest
23
21
  from .audio_prompt_block import AudioPromptBlock
24
- from .audio_variable_value import AudioVariableValue
25
22
  from .audio_vellum_value import AudioVellumValue
26
23
  from .audio_vellum_value_request import AudioVellumValueRequest
27
24
  from .basic_vectorizer_intfloat_multilingual_e_5_large import BasicVectorizerIntfloatMultilingualE5Large
@@ -40,7 +37,6 @@ from .basic_vectorizer_sentence_transformers_multi_qa_mpnet_base_dot_v_1_request
40
37
  )
41
38
  from .chat_history_input import ChatHistoryInput
42
39
  from .chat_history_input_request import ChatHistoryInputRequest
43
- from .chat_history_variable_value import ChatHistoryVariableValue
44
40
  from .chat_history_vellum_value import ChatHistoryVellumValue
45
41
  from .chat_history_vellum_value_request import ChatHistoryVellumValueRequest
46
42
  from .chat_message import ChatMessage
@@ -97,7 +93,6 @@ from .environment_enum import EnvironmentEnum
97
93
  from .ephemeral_prompt_cache_config import EphemeralPromptCacheConfig
98
94
  from .ephemeral_prompt_cache_config_type_enum import EphemeralPromptCacheConfigTypeEnum
99
95
  from .error_input import ErrorInput
100
- from .error_variable_value import ErrorVariableValue
101
96
  from .error_vellum_value import ErrorVellumValue
102
97
  from .error_vellum_value_request import ErrorVellumValueRequest
103
98
  from .execute_prompt_event import ExecutePromptEvent
@@ -141,7 +136,6 @@ from .function_call_chat_message_content_value_request import FunctionCallChatMe
141
136
  from .function_call_input import FunctionCallInput
142
137
  from .function_call_prompt_block import FunctionCallPromptBlock
143
138
  from .function_call_request import FunctionCallRequest
144
- from .function_call_variable_value import FunctionCallVariableValue
145
139
  from .function_call_vellum_value import FunctionCallVellumValue
146
140
  from .function_call_vellum_value_request import FunctionCallVellumValueRequest
147
141
  from .function_definition import FunctionDefinition
@@ -169,7 +163,6 @@ from .hkunlp_instructor_xl_vectorizer_request import HkunlpInstructorXlVectorize
169
163
  from .image_chat_message_content import ImageChatMessageContent
170
164
  from .image_chat_message_content_request import ImageChatMessageContentRequest
171
165
  from .image_prompt_block import ImagePromptBlock
172
- from .image_variable_value import ImageVariableValue
173
166
  from .image_vellum_value import ImageVellumValue
174
167
  from .image_vellum_value_request import ImageVellumValueRequest
175
168
  from .indexing_config_vectorizer import IndexingConfigVectorizer
@@ -185,7 +178,6 @@ from .iteration_state_enum import IterationStateEnum
185
178
  from .jinja_prompt_block import JinjaPromptBlock
186
179
  from .json_input import JsonInput
187
180
  from .json_input_request import JsonInputRequest
188
- from .json_variable_value import JsonVariableValue
189
181
  from .json_vellum_value import JsonVellumValue
190
182
  from .json_vellum_value_request import JsonVellumValueRequest
191
183
  from .logical_operator import LogicalOperator
@@ -226,6 +218,7 @@ from .named_test_case_string_variable_value import NamedTestCaseStringVariableVa
226
218
  from .named_test_case_string_variable_value_request import NamedTestCaseStringVariableValueRequest
227
219
  from .named_test_case_variable_value import NamedTestCaseVariableValue
228
220
  from .named_test_case_variable_value_request import NamedTestCaseVariableValueRequest
221
+ from .new_member_join_behavior_enum import NewMemberJoinBehaviorEnum
229
222
  from .node_input_compiled_array_value import NodeInputCompiledArrayValue
230
223
  from .node_input_compiled_chat_history_value import NodeInputCompiledChatHistoryValue
231
224
  from .node_input_compiled_error_value import NodeInputCompiledErrorValue
@@ -247,7 +240,6 @@ from .node_output_compiled_value import NodeOutputCompiledValue
247
240
  from .normalized_log_probs import NormalizedLogProbs
248
241
  from .normalized_token_log_probs import NormalizedTokenLogProbs
249
242
  from .number_input import NumberInput
250
- from .number_variable_value import NumberVariableValue
251
243
  from .number_vellum_value import NumberVellumValue
252
244
  from .number_vellum_value_request import NumberVellumValueRequest
253
245
  from .open_ai_vectorizer_config import OpenAiVectorizerConfig
@@ -258,6 +250,7 @@ from .open_ai_vectorizer_text_embedding_3_small import OpenAiVectorizerTextEmbed
258
250
  from .open_ai_vectorizer_text_embedding_3_small_request import OpenAiVectorizerTextEmbedding3SmallRequest
259
251
  from .open_ai_vectorizer_text_embedding_ada_002 import OpenAiVectorizerTextEmbeddingAda002
260
252
  from .open_ai_vectorizer_text_embedding_ada_002_request import OpenAiVectorizerTextEmbeddingAda002Request
253
+ from .organization_read import OrganizationRead
261
254
  from .paginated_container_image_read_list import PaginatedContainerImageReadList
262
255
  from .paginated_deployment_release_tag_read_list import PaginatedDeploymentReleaseTagReadList
263
256
  from .paginated_document_index_read_list import PaginatedDocumentIndexReadList
@@ -321,7 +314,6 @@ from .search_result_meta import SearchResultMeta
321
314
  from .search_result_meta_request import SearchResultMetaRequest
322
315
  from .search_result_request import SearchResultRequest
323
316
  from .search_results_input import SearchResultsInput
324
- from .search_results_variable_value import SearchResultsVariableValue
325
317
  from .search_results_vellum_value import SearchResultsVellumValue
326
318
  from .search_results_vellum_value_request import SearchResultsVellumValueRequest
327
319
  from .search_weights_request import SearchWeightsRequest
@@ -342,7 +334,6 @@ from .string_chat_message_content import StringChatMessageContent
342
334
  from .string_chat_message_content_request import StringChatMessageContentRequest
343
335
  from .string_input import StringInput
344
336
  from .string_input_request import StringInputRequest
345
- from .string_variable_value import StringVariableValue
346
337
  from .string_vellum_value import StringVellumValue
347
338
  from .string_vellum_value_request import StringVellumValueRequest
348
339
  from .submit_completion_actual_request import SubmitCompletionActualRequest
@@ -522,6 +513,7 @@ from .workflow_result_event_output_data_number import WorkflowResultEventOutputD
522
513
  from .workflow_result_event_output_data_search_results import WorkflowResultEventOutputDataSearchResults
523
514
  from .workflow_result_event_output_data_string import WorkflowResultEventOutputDataString
524
515
  from .workflow_stream_event import WorkflowStreamEvent
516
+ from .workspace_read import WorkspaceRead
525
517
  from .workspace_secret_read import WorkspaceSecretRead
526
518
 
527
519
  __all__ = [
@@ -539,14 +531,11 @@ __all__ = [
539
531
  "ArrayChatMessageContentItemRequest",
540
532
  "ArrayChatMessageContentRequest",
541
533
  "ArrayInput",
542
- "ArrayVariableValue",
543
- "ArrayVariableValueItem",
544
534
  "ArrayVellumValue",
545
535
  "ArrayVellumValueRequest",
546
536
  "AudioChatMessageContent",
547
537
  "AudioChatMessageContentRequest",
548
538
  "AudioPromptBlock",
549
- "AudioVariableValue",
550
539
  "AudioVellumValue",
551
540
  "AudioVellumValueRequest",
552
541
  "BasicVectorizerIntfloatMultilingualE5Large",
@@ -557,7 +546,6 @@ __all__ = [
557
546
  "BasicVectorizerSentenceTransformersMultiQaMpnetBaseDotV1Request",
558
547
  "ChatHistoryInput",
559
548
  "ChatHistoryInputRequest",
560
- "ChatHistoryVariableValue",
561
549
  "ChatHistoryVellumValue",
562
550
  "ChatHistoryVellumValueRequest",
563
551
  "ChatMessage",
@@ -614,7 +602,6 @@ __all__ = [
614
602
  "EphemeralPromptCacheConfig",
615
603
  "EphemeralPromptCacheConfigTypeEnum",
616
604
  "ErrorInput",
617
- "ErrorVariableValue",
618
605
  "ErrorVellumValue",
619
606
  "ErrorVellumValueRequest",
620
607
  "ExecutePromptEvent",
@@ -658,7 +645,6 @@ __all__ = [
658
645
  "FunctionCallInput",
659
646
  "FunctionCallPromptBlock",
660
647
  "FunctionCallRequest",
661
- "FunctionCallVariableValue",
662
648
  "FunctionCallVellumValue",
663
649
  "FunctionCallVellumValueRequest",
664
650
  "FunctionDefinition",
@@ -682,7 +668,6 @@ __all__ = [
682
668
  "ImageChatMessageContent",
683
669
  "ImageChatMessageContentRequest",
684
670
  "ImagePromptBlock",
685
- "ImageVariableValue",
686
671
  "ImageVellumValue",
687
672
  "ImageVellumValueRequest",
688
673
  "IndexingConfigVectorizer",
@@ -698,7 +683,6 @@ __all__ = [
698
683
  "JinjaPromptBlock",
699
684
  "JsonInput",
700
685
  "JsonInputRequest",
701
- "JsonVariableValue",
702
686
  "JsonVellumValue",
703
687
  "JsonVellumValueRequest",
704
688
  "LogicalOperator",
@@ -739,6 +723,7 @@ __all__ = [
739
723
  "NamedTestCaseStringVariableValueRequest",
740
724
  "NamedTestCaseVariableValue",
741
725
  "NamedTestCaseVariableValueRequest",
726
+ "NewMemberJoinBehaviorEnum",
742
727
  "NodeInputCompiledArrayValue",
743
728
  "NodeInputCompiledChatHistoryValue",
744
729
  "NodeInputCompiledErrorValue",
@@ -760,7 +745,6 @@ __all__ = [
760
745
  "NormalizedLogProbs",
761
746
  "NormalizedTokenLogProbs",
762
747
  "NumberInput",
763
- "NumberVariableValue",
764
748
  "NumberVellumValue",
765
749
  "NumberVellumValueRequest",
766
750
  "OpenAiVectorizerConfig",
@@ -771,6 +755,7 @@ __all__ = [
771
755
  "OpenAiVectorizerTextEmbedding3SmallRequest",
772
756
  "OpenAiVectorizerTextEmbeddingAda002",
773
757
  "OpenAiVectorizerTextEmbeddingAda002Request",
758
+ "OrganizationRead",
774
759
  "PaginatedContainerImageReadList",
775
760
  "PaginatedDeploymentReleaseTagReadList",
776
761
  "PaginatedDocumentIndexReadList",
@@ -834,7 +819,6 @@ __all__ = [
834
819
  "SearchResultMetaRequest",
835
820
  "SearchResultRequest",
836
821
  "SearchResultsInput",
837
- "SearchResultsVariableValue",
838
822
  "SearchResultsVellumValue",
839
823
  "SearchResultsVellumValueRequest",
840
824
  "SearchWeightsRequest",
@@ -855,7 +839,6 @@ __all__ = [
855
839
  "StringChatMessageContentRequest",
856
840
  "StringInput",
857
841
  "StringInputRequest",
858
- "StringVariableValue",
859
842
  "StringVellumValue",
860
843
  "StringVellumValueRequest",
861
844
  "SubmitCompletionActualRequest",
@@ -1019,5 +1002,6 @@ __all__ = [
1019
1002
  "WorkflowResultEventOutputDataSearchResults",
1020
1003
  "WorkflowResultEventOutputDataString",
1021
1004
  "WorkflowStreamEvent",
1005
+ "WorkspaceRead",
1022
1006
  "WorkspaceSecretRead",
1023
1007
  ]
@@ -0,0 +1,8 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ NewMemberJoinBehaviorEnum = typing.Union[
6
+ typing.Literal["AUTO_ACCEPT_FROM_SHARED_DOMAIN", "ALLOW_REQUESTS_FROM_SHARED_DOMAIN", "REQUIRE_EXPLICIT_INVITE"],
7
+ typing.Any,
8
+ ]
@@ -2,14 +2,16 @@
2
2
 
3
3
  from ..core.pydantic_utilities import UniversalBaseModel
4
4
  import typing
5
- from .function_call import FunctionCall
5
+ from .new_member_join_behavior_enum import NewMemberJoinBehaviorEnum
6
6
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
7
  import pydantic
8
8
 
9
9
 
10
- class FunctionCallVariableValue(UniversalBaseModel):
11
- type: typing.Literal["FUNCTION_CALL"] = "FUNCTION_CALL"
12
- value: typing.Optional[FunctionCall] = None
10
+ class OrganizationRead(UniversalBaseModel):
11
+ id: str
12
+ name: str
13
+ allow_staff_access: typing.Optional[bool] = None
14
+ new_member_join_behavior: NewMemberJoinBehaviorEnum
13
15
 
14
16
  if IS_PYDANTIC_V2:
15
17
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -2,7 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from ..core.pydantic_utilities import UniversalBaseModel
5
- from .array_variable_value import ArrayVariableValue
6
5
  from .array_vellum_value import ArrayVellumValue
7
6
  import typing
8
7
  from .workflow_result_event import WorkflowResultEvent
@@ -32,5 +31,4 @@ class WorkflowExecutionWorkflowResultEvent(UniversalBaseModel):
32
31
  extra = pydantic.Extra.allow
33
32
 
34
33
 
35
- update_forward_refs(ArrayVariableValue, WorkflowExecutionWorkflowResultEvent=WorkflowExecutionWorkflowResultEvent)
36
34
  update_forward_refs(ArrayVellumValue, WorkflowExecutionWorkflowResultEvent=WorkflowExecutionWorkflowResultEvent)
@@ -2,7 +2,6 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from ..core.pydantic_utilities import UniversalBaseModel
5
- from .array_variable_value import ArrayVariableValue
6
5
  from .array_vellum_value import ArrayVellumValue
7
6
  from .workflow_node_result_event_state import WorkflowNodeResultEventState
8
7
  import datetime as dt
@@ -35,5 +34,4 @@ class WorkflowResultEvent(UniversalBaseModel):
35
34
  extra = pydantic.Extra.allow
36
35
 
37
36
 
38
- update_forward_refs(ArrayVariableValue, WorkflowResultEvent=WorkflowResultEvent)
39
37
  update_forward_refs(ArrayVellumValue, WorkflowResultEvent=WorkflowResultEvent)
@@ -2,11 +2,11 @@
2
2
 
3
3
  from __future__ import annotations
4
4
  from ..core.pydantic_utilities import UniversalBaseModel
5
- from .array_variable_value import ArrayVariableValue
5
+ from .array_vellum_value import ArrayVellumValue
6
6
  import typing
7
7
  from .workflow_node_result_event_state import WorkflowNodeResultEventState
8
8
  import pydantic
9
- from .array_variable_value_item import ArrayVariableValueItem
9
+ from .vellum_value import VellumValue
10
10
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
11
11
  from ..core.pydantic_utilities import update_forward_refs
12
12
 
@@ -26,7 +26,7 @@ class WorkflowResultEventOutputDataArray(UniversalBaseModel):
26
26
  """
27
27
 
28
28
  type: typing.Literal["ARRAY"] = "ARRAY"
29
- value: typing.Optional[typing.List[ArrayVariableValueItem]] = None
29
+ value: typing.Optional[typing.List[VellumValue]] = None
30
30
 
31
31
  if IS_PYDANTIC_V2:
32
32
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -38,4 +38,4 @@ class WorkflowResultEventOutputDataArray(UniversalBaseModel):
38
38
  extra = pydantic.Extra.allow
39
39
 
40
40
 
41
- update_forward_refs(ArrayVariableValue, WorkflowResultEventOutputDataArray=WorkflowResultEventOutputDataArray)
41
+ update_forward_refs(ArrayVellumValue, WorkflowResultEventOutputDataArray=WorkflowResultEventOutputDataArray)
@@ -1,14 +1,21 @@
1
1
  # This file was auto-generated by Fern from our API Definition.
2
2
 
3
3
  from ..core.pydantic_utilities import UniversalBaseModel
4
- import typing
5
- from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
4
  import pydantic
5
+ import datetime as dt
6
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
7
+ import typing
8
+
7
9
 
10
+ class WorkspaceRead(UniversalBaseModel):
11
+ id: str
12
+ name: str = pydantic.Field()
13
+ """
14
+ The name of the Workspace.
15
+ """
8
16
 
9
- class StringVariableValue(UniversalBaseModel):
10
- type: typing.Literal["STRING"] = "STRING"
11
- value: typing.Optional[str] = None
17
+ label: str
18
+ created: dt.datetime
12
19
 
13
20
  if IS_PYDANTIC_V2:
14
21
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -4,6 +4,7 @@ from typing import Callable, Dict, List, Optional, Set, Type
4
4
  from mypy.nodes import (
5
5
  AssignmentStmt,
6
6
  CallExpr,
7
+ ClassDef,
7
8
  Decorator,
8
9
  MemberExpr,
9
10
  NameExpr,
@@ -198,13 +199,27 @@ class VellumMypyPlugin(Plugin):
198
199
  return
199
200
 
200
201
  current_node_outputs = node_info.names.get("Outputs")
201
- if not current_node_outputs:
202
+ if not current_node_outputs and isinstance(base_node_outputs.node, TypeInfo):
202
203
  node_info.names["Outputs"] = base_node_outputs.copy()
203
- new_outputs_sym = node_info.names["Outputs"].node
204
- if isinstance(new_outputs_sym, TypeInfo):
205
- result_sym = new_outputs_sym.names[attribute_name].node
206
- if isinstance(result_sym, Var):
207
- result_sym.type = base_node_resolved_type
204
+
205
+ new_outputs_fullname = f"{node_info.fullname}.Outputs"
206
+ new_outputs_defn_raw = base_node_outputs.node.defn.serialize()
207
+ new_outputs_defn_raw["fullname"] = new_outputs_fullname
208
+ new_outputs_defn = ClassDef.deserialize(new_outputs_defn_raw)
209
+ new_outputs_sym = TypeInfo(
210
+ names=base_node_outputs.node.names.copy(),
211
+ defn=new_outputs_defn,
212
+ module_name=node_info.module_name,
213
+ )
214
+
215
+ base_result_sym = base_node_outputs.node.names[attribute_name].node
216
+ if isinstance(base_result_sym, Var):
217
+ new_result_sym = Var.deserialize(base_result_sym.serialize())
218
+ new_result_sym._fullname = f"{new_outputs_fullname}.{attribute_name}"
219
+ new_result_sym.type = base_node_resolved_type
220
+ new_outputs_sym.names[attribute_name].node = new_result_sym
221
+ new_outputs_sym.bases.append(Instance(base_node_outputs.node, []))
222
+ node_info.names["Outputs"].node = new_outputs_sym
208
223
 
209
224
  def _base_node_class_hook(self, ctx: ClassDefContext) -> None:
210
225
  """
@@ -472,10 +487,22 @@ class VellumMypyPlugin(Plugin):
472
487
 
473
488
  def _run_method_hook(self, ctx: MethodContext) -> MypyType:
474
489
  """
475
- We use this to target `Workflow.run()` so that the WorkflowExecutionFulfilledEvent is properly typed
476
- using the `Outputs` class defined on the user-defined subclass of `Workflow`.
490
+ We use this to target:
491
+ - `BaseWorkflow.run()`, so that the WorkflowExecutionFulfilledEvent is properly typed
492
+ using the `Outputs` class defined on the user-defined subclass of `Workflow`.
493
+ - `BaseNode.run()`, so that the `Outputs` class defined on the user-defined subclass of `Node`
494
+ is properly typed.
477
495
  """
478
496
 
497
+ if isinstance(ctx.default_return_type, TypeAliasType):
498
+ return self._workflow_run_method_hook(ctx)
499
+
500
+ if isinstance(ctx.default_return_type, Instance):
501
+ return self._node_run_method_hook(ctx)
502
+
503
+ return ctx.default_return_type
504
+
505
+ def _workflow_run_method_hook(self, ctx: MethodContext) -> MypyType:
479
506
  if not isinstance(ctx.default_return_type, TypeAliasType):
480
507
  return ctx.default_return_type
481
508
 
@@ -494,7 +521,7 @@ class VellumMypyPlugin(Plugin):
494
521
  if fulfilled_event.type.fullname != "vellum.workflows.events.workflow.WorkflowExecutionFulfilledEvent":
495
522
  return ctx.default_return_type
496
523
 
497
- outputs_node = self._get_outputs_node(ctx)
524
+ outputs_node = self._get_workflow_outputs_type_info(ctx)
498
525
  if not outputs_node:
499
526
  return ctx.default_return_type
500
527
 
@@ -513,6 +540,19 @@ class VellumMypyPlugin(Plugin):
513
540
  column=ctx.default_return_type.column,
514
541
  )
515
542
 
543
+ def _node_run_method_hook(self, ctx: MethodContext) -> MypyType:
544
+ if not isinstance(ctx.default_return_type, Instance):
545
+ return ctx.default_return_type
546
+
547
+ if not _is_subclass(ctx.default_return_type.type, "vellum.workflows.nodes.bases.base.BaseNode.Outputs"):
548
+ return ctx.default_return_type
549
+
550
+ outputs_node = self._get_node_outputs_type_info(ctx)
551
+ if not outputs_node:
552
+ return ctx.default_return_type
553
+
554
+ return Instance(outputs_node, [])
555
+
516
556
  def _stream_method_hook(self, ctx: MethodContext) -> MypyType:
517
557
  """
518
558
  We use this to target `Workflow.stream()` so that the WorkflowExecutionFulfilledEvent is properly typed
@@ -557,7 +597,7 @@ class VellumMypyPlugin(Plugin):
557
597
  if fulfilled_event_index == -1 or not fulfilled_event:
558
598
  return ctx.default_return_type
559
599
 
560
- outputs_node = self._get_outputs_node(ctx)
600
+ outputs_node = self._get_workflow_outputs_type_info(ctx)
561
601
  if not outputs_node:
562
602
  return ctx.default_return_type
563
603
 
@@ -594,7 +634,7 @@ class VellumMypyPlugin(Plugin):
594
634
  column=ctx.default_return_type.column,
595
635
  )
596
636
 
597
- def _get_outputs_node(self, ctx: MethodContext) -> Optional[TypeInfo]:
637
+ def _get_workflow_outputs_type_info(self, ctx: MethodContext) -> Optional[TypeInfo]:
598
638
  if not isinstance(ctx.context, CallExpr):
599
639
  return None
600
640
 
@@ -624,6 +664,35 @@ class VellumMypyPlugin(Plugin):
624
664
 
625
665
  return resolved_outputs_node.node
626
666
 
667
+ def _get_node_outputs_type_info(self, ctx: MethodContext) -> Optional[TypeInfo]:
668
+ if not isinstance(ctx.context, CallExpr):
669
+ return None
670
+
671
+ if not isinstance(ctx.context.callee, MemberExpr):
672
+ return None
673
+
674
+ expr = ctx.context.callee.expr
675
+ instance = ctx.api.get_expression_type(expr)
676
+ if not isinstance(instance, Instance) or not _is_subclass(
677
+ instance.type, "vellum.workflows.nodes.bases.base.BaseNode"
678
+ ):
679
+ return None
680
+
681
+ outputs_node = instance.type.names.get("Outputs")
682
+
683
+ if (
684
+ not outputs_node
685
+ or not isinstance(outputs_node.node, TypeInfo)
686
+ or not _is_subclass(outputs_node.node, "vellum.workflows.outputs.base.BaseOutputs")
687
+ ):
688
+ return None
689
+
690
+ # TODO: For some reason, returning the correct Outputs type info is causing `result` to not
691
+ # be found. `test_templating_node.py` is the best place to test this.
692
+ # https://app.shortcut.com/vellum/story/6132
693
+ # return outputs_node.node
694
+ return None
695
+
627
696
  def _resolve_descriptors_in_outputs(self, type_info: SymbolTableNode) -> SymbolTableNode:
628
697
  new_type_info = type_info.copy()
629
698
  if not isinstance(new_type_info.node, TypeInfo):
@@ -1,3 +1,3 @@
1
1
  # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
2
 
3
- from vellum.client.types.json_variable_value import *
3
+ from vellum.client.resources.organizations import *
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.resources.organizations.client import *
@@ -1,3 +1,3 @@
1
1
  # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
2
 
3
- from vellum.client.types.image_variable_value import *
3
+ from vellum.client.resources.workspaces import *
@@ -1,3 +1,3 @@
1
1
  # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
2
 
3
- from vellum.client.types.array_variable_value import *
3
+ from vellum.client.resources.workspaces.client import *
@@ -1,3 +1,3 @@
1
1
  # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
2
 
3
- from vellum.client.types.array_variable_value_item import *
3
+ from vellum.client.types.new_member_join_behavior_enum import *
@@ -1,3 +1,3 @@
1
1
  # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
2
 
3
- from vellum.client.types.audio_variable_value import *
3
+ from vellum.client.types.organization_read import *
@@ -1,3 +1,3 @@
1
1
  # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
2
 
3
- from vellum.client.types.error_variable_value import *
3
+ from vellum.client.types.workspace_read import *
@@ -28,6 +28,9 @@ def render_sandboxed_jinja_template(
28
28
  keep_trailing_newline=True,
29
29
  finalize=finalize,
30
30
  )
31
+ environment.policies["json.dumps_kwargs"] = {
32
+ "cls": DefaultStateEncoder,
33
+ }
31
34
 
32
35
  if jinja_custom_filters:
33
36
  environment.filters.update(jinja_custom_filters)
@@ -324,6 +324,10 @@ class BaseNode(Generic[StateType], metaclass=BaseNodeMeta):
324
324
  if not descriptor.instance:
325
325
  continue
326
326
 
327
+ if any(isinstance(t, type) and issubclass(t, BaseDescriptor) for t in descriptor.types):
328
+ # We don't want to resolve attributes that are _meant_ to be descriptors
329
+ continue
330
+
327
331
  resolved_value = resolve_value(descriptor.instance, self.state, path=descriptor.name, memo=inputs)
328
332
  setattr(self, descriptor.name, resolved_value)
329
333
 
@@ -1,5 +1,7 @@
1
1
  from typing import Callable, Generic, Optional, Type
2
2
 
3
+ from vellum.workflows.descriptors.base import BaseDescriptor
4
+ from vellum.workflows.descriptors.utils import resolve_value
3
5
  from vellum.workflows.errors.types import WorkflowErrorCode
4
6
  from vellum.workflows.exceptions import NodeException
5
7
  from vellum.workflows.inputs.base import BaseInputs
@@ -21,6 +23,7 @@ class RetryNode(BaseAdornmentNode[StateType], Generic[StateType]):
21
23
 
22
24
  max_attempts: int
23
25
  retry_on_error_code: Optional[WorkflowErrorCode] = None
26
+ retry_on_condition: Optional[BaseDescriptor] = None
24
27
 
25
28
  class SubworkflowInputs(BaseInputs):
26
29
  attempt_number: int
@@ -55,18 +58,36 @@ class RetryNode(BaseAdornmentNode[StateType], Generic[StateType]):
55
58
  last_exception = NodeException(
56
59
  code=WorkflowErrorCode.INVALID_OUTPUTS,
57
60
  message=f"""Unexpected rejection on attempt {attempt_number}: {terminal_event.error.code.value}.
61
+ Message: {terminal_event.error.message}""",
62
+ )
63
+ break
64
+ elif self.retry_on_condition and not resolve_value(self.retry_on_condition, self.state):
65
+ last_exception = NodeException(
66
+ code=WorkflowErrorCode.INVALID_OUTPUTS,
67
+ message=f"""Rejection failed on attempt {attempt_number}: {terminal_event.error.code.value}.
58
68
  Message: {terminal_event.error.message}""",
59
69
  )
60
70
  break
61
71
  else:
62
- last_exception = Exception(terminal_event.error.message)
72
+ last_exception = NodeException(
73
+ terminal_event.error.message,
74
+ code=terminal_event.error.code,
75
+ )
63
76
 
64
77
  raise last_exception
65
78
 
66
79
  @classmethod
67
80
  def wrap(
68
- cls, max_attempts: int, retry_on_error_code: Optional[WorkflowErrorCode] = None
81
+ cls,
82
+ max_attempts: int,
83
+ retry_on_error_code: Optional[WorkflowErrorCode] = None,
84
+ retry_on_condition: Optional[BaseDescriptor] = None,
69
85
  ) -> Callable[..., Type["RetryNode"]]:
70
86
  return create_adornment(
71
- cls, attributes={"max_attempts": max_attempts, "retry_on_error_code": retry_on_error_code}
87
+ cls,
88
+ attributes={
89
+ "max_attempts": max_attempts,
90
+ "retry_on_error_code": retry_on_error_code,
91
+ "retry_on_condition": retry_on_condition,
92
+ },
72
93
  )
@@ -6,6 +6,7 @@ from vellum.workflows.inputs.base import BaseInputs
6
6
  from vellum.workflows.nodes.bases import BaseNode
7
7
  from vellum.workflows.nodes.core.retry_node.node import RetryNode
8
8
  from vellum.workflows.outputs import BaseOutputs
9
+ from vellum.workflows.references.lazy import LazyReference
9
10
  from vellum.workflows.state.base import BaseState, StateMeta
10
11
 
11
12
 
@@ -91,3 +92,42 @@ def test_retry_node__use_parent_inputs_and_state():
91
92
 
92
93
  # THEN the data is used successfully
93
94
  assert outputs.value == "foo bar"
95
+
96
+
97
+ def test_retry_node__condition_arg_successfully_retries():
98
+ # GIVEN workflow Inputs and State
99
+ class State(BaseState):
100
+ count = 0
101
+
102
+ # AND a retry node that retries on a condition
103
+ @RetryNode.wrap(
104
+ max_attempts=5,
105
+ retry_on_condition=LazyReference(lambda: State.count.less_than(3)),
106
+ )
107
+ class TestNode(BaseNode[State]):
108
+ attempt_number = RetryNode.SubworkflowInputs.attempt_number
109
+
110
+ class Outputs(BaseOutputs):
111
+ value: str
112
+
113
+ def run(self) -> Outputs:
114
+ if not isinstance(self.state.meta.parent, State):
115
+ raise NodeException(message="Failed to resolve parent state")
116
+
117
+ self.state.meta.parent.count += 1
118
+ raise NodeException(message=f"This is failure attempt {self.attempt_number}")
119
+
120
+ # WHEN the node is run
121
+ node = TestNode(state=State())
122
+ with pytest.raises(NodeException) as exc_info:
123
+ node.run()
124
+
125
+ # THEN the exception raised is the last one
126
+ assert (
127
+ exc_info.value.message
128
+ == """Rejection failed on attempt 3: INTERNAL_ERROR.
129
+ Message: This is failure attempt 3"""
130
+ )
131
+
132
+ # AND the state was updated each time
133
+ assert node.state.count == 3