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
@@ -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
  ]
@@ -26,6 +26,8 @@ LogicalOperator = typing.Union[
26
26
  "notBlank",
27
27
  "coalesce",
28
28
  "accessField",
29
+ "and",
30
+ "or",
29
31
  ],
30
32
  typing.Any,
31
33
  ]
@@ -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
@@ -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 *
@@ -121,7 +121,7 @@ class BaseDescriptor(Generic[_T]):
121
121
 
122
122
  return CoalesceExpression(lhs=self, rhs=other)
123
123
 
124
- def __getitem__(self, field: str) -> "AccessorExpression":
124
+ def __getitem__(self, field: Union[str, int]) -> "AccessorExpression":
125
125
  from vellum.workflows.expressions.accessor import AccessorExpression
126
126
 
127
127
  return AccessorExpression(base=self, field=field)
@@ -19,6 +19,7 @@ class FixtureState(BaseState):
19
19
  }
20
20
 
21
21
  eta = None
22
+ theta = ["baz"]
22
23
 
23
24
 
24
25
  class DummyNode(BaseNode[FixtureState]):
@@ -75,6 +76,7 @@ class DummyNode(BaseNode[FixtureState]):
75
76
  ),
76
77
  (FixtureState.zeta["foo"], "bar"),
77
78
  (ConstantValueReference(1), 1),
79
+ (FixtureState.theta[0], "baz"),
78
80
  ],
79
81
  ids=[
80
82
  "or",
@@ -119,6 +121,7 @@ class DummyNode(BaseNode[FixtureState]):
119
121
  "or_and",
120
122
  "accessor",
121
123
  "constants",
124
+ "list_index",
122
125
  ],
123
126
  )
124
127
  def test_resolve_value__happy_path(descriptor, expected_value):
@@ -1,6 +1,6 @@
1
1
  from collections.abc import Mapping
2
2
  import dataclasses
3
- from typing import Any, Sequence, Type, TypeVar
3
+ from typing import Any, Sequence, Type, TypeVar, Union
4
4
 
5
5
  from pydantic import BaseModel, GetCoreSchemaHandler
6
6
  from pydantic_core import core_schema
@@ -17,7 +17,7 @@ class AccessorExpression(BaseDescriptor[Any]):
17
17
  self,
18
18
  *,
19
19
  base: BaseDescriptor[LHS],
20
- field: str,
20
+ field: Union[str, int],
21
21
  ) -> None:
22
22
  super().__init__(
23
23
  name=f"{base.name}.{field}",
@@ -31,9 +31,15 @@ class AccessorExpression(BaseDescriptor[Any]):
31
31
  base = resolve_value(self._base, state)
32
32
 
33
33
  if dataclasses.is_dataclass(base):
34
+ if isinstance(self._field, int):
35
+ raise ValueError("Cannot access field by index on a dataclass")
36
+
34
37
  return getattr(base, self._field)
35
38
 
36
39
  if isinstance(base, BaseModel):
40
+ if isinstance(self._field, int):
41
+ raise ValueError("Cannot access field by index on a BaseModel")
42
+
37
43
  return getattr(base, self._field)
38
44
 
39
45
  if isinstance(base, Mapping):
@@ -1,7 +1,20 @@
1
1
  from collections import defaultdict
2
2
  from queue import Empty, Queue
3
3
  from threading import Thread
4
- from typing import TYPE_CHECKING, Callable, Dict, Generic, List, Optional, Tuple, Type, TypeVar, Union, overload
4
+ from typing import (
5
+ TYPE_CHECKING,
6
+ Callable,
7
+ Dict,
8
+ Generic,
9
+ Iterator,
10
+ List,
11
+ Optional,
12
+ Tuple,
13
+ Type,
14
+ TypeVar,
15
+ Union,
16
+ overload,
17
+ )
5
18
 
6
19
  from vellum.workflows.context import execution_context, get_parent_context
7
20
  from vellum.workflows.descriptors.base import BaseDescriptor
@@ -12,6 +25,7 @@ from vellum.workflows.inputs.base import BaseInputs
12
25
  from vellum.workflows.nodes.bases.base_adornment_node import BaseAdornmentNode
13
26
  from vellum.workflows.nodes.utils import create_adornment
14
27
  from vellum.workflows.outputs import BaseOutputs
28
+ from vellum.workflows.outputs.base import BaseOutput
15
29
  from vellum.workflows.references.output import OutputReference
16
30
  from vellum.workflows.state.context import WorkflowContext
17
31
  from vellum.workflows.types.generics import StateType
@@ -29,11 +43,11 @@ class MapNode(BaseAdornmentNode[StateType], Generic[StateType, MapNodeItemType])
29
43
 
30
44
  items: List[MapNodeItemType] - The items to map over
31
45
  subworkflow: Type["BaseWorkflow[SubworkflowInputs, BaseState]"] - The Subworkflow to execute on each iteration
32
- concurrency: Optional[int] = None - The maximum number of concurrent subworkflow executions
46
+ max_concurrency: Optional[int] = None - The maximum number of concurrent subworkflow executions
33
47
  """
34
48
 
35
49
  items: List[MapNodeItemType]
36
- concurrency: Optional[int] = None
50
+ max_concurrency: Optional[int] = None
37
51
 
38
52
  class Outputs(BaseAdornmentNode.Outputs):
39
53
  pass
@@ -47,7 +61,7 @@ class MapNode(BaseAdornmentNode[StateType], Generic[StateType, MapNodeItemType])
47
61
  index: int
48
62
  all_items: List[MapNodeItemType] # type: ignore[valid-type]
49
63
 
50
- def run(self) -> Outputs:
64
+ def run(self) -> Iterator[BaseOutput]:
51
65
  mapped_items: Dict[str, List] = defaultdict(list)
52
66
  for output_descripter in self.subworkflow.Outputs:
53
67
  mapped_items[output_descripter.name] = [None] * len(self.items)
@@ -66,14 +80,14 @@ class MapNode(BaseAdornmentNode[StateType], Generic[StateType, MapNodeItemType])
66
80
  "parent_context": parent_context,
67
81
  },
68
82
  )
69
- if self.concurrency is None:
83
+ if self.max_concurrency is None:
70
84
  thread.start()
71
85
  else:
72
86
  self._concurrency_queue.put(thread)
73
87
 
74
- if self.concurrency is not None:
88
+ if self.max_concurrency is not None:
75
89
  concurrency_count = 0
76
- while concurrency_count < self.concurrency:
90
+ while concurrency_count < self.max_concurrency:
77
91
  is_empty = self._start_thread()
78
92
  if is_empty:
79
93
  break
@@ -83,40 +97,45 @@ class MapNode(BaseAdornmentNode[StateType], Generic[StateType, MapNodeItemType])
83
97
  try:
84
98
  while map_node_event := self._event_queue.get():
85
99
  index = map_node_event[0]
86
- terminal_event = map_node_event[1]
87
- self._context._emit_subworkflow_event(terminal_event)
100
+ subworkflow_event = map_node_event[1]
101
+ self._context._emit_subworkflow_event(subworkflow_event)
88
102
 
89
- if terminal_event.name == "workflow.execution.fulfilled":
90
- workflow_output_vars = vars(terminal_event.outputs)
103
+ if subworkflow_event.name == "workflow.execution.initiated":
104
+ for output_name in mapped_items.keys():
105
+ yield BaseOutput(name=output_name, delta=(None, index, "INITIATED"))
106
+
107
+ elif subworkflow_event.name == "workflow.execution.fulfilled":
108
+ workflow_output_vars = vars(subworkflow_event.outputs)
91
109
 
92
110
  for output_name in workflow_output_vars:
93
111
  output_mapped_items = mapped_items[output_name]
94
112
  output_mapped_items[index] = workflow_output_vars[output_name]
113
+ yield BaseOutput(
114
+ name=output_name,
115
+ delta=(output_mapped_items[index], index, "FULFILLED"),
116
+ )
95
117
 
96
118
  fulfilled_iterations[index] = True
97
119
  if all(fulfilled_iterations):
98
120
  break
99
121
 
100
- if self.concurrency is not None:
122
+ if self.max_concurrency is not None:
101
123
  self._start_thread()
102
- elif terminal_event.name == "workflow.execution.paused":
124
+ elif subworkflow_event.name == "workflow.execution.paused":
103
125
  raise NodeException(
104
126
  code=WorkflowErrorCode.INVALID_OUTPUTS,
105
127
  message=f"Subworkflow unexpectedly paused on iteration {index}",
106
128
  )
107
- elif terminal_event.name == "workflow.execution.rejected":
129
+ elif subworkflow_event.name == "workflow.execution.rejected":
108
130
  raise NodeException(
109
- f"Subworkflow failed on iteration {index} with error: {terminal_event.error.message}",
110
- code=terminal_event.error.code,
131
+ f"Subworkflow failed on iteration {index} with error: {subworkflow_event.error.message}",
132
+ code=subworkflow_event.error.code,
111
133
  )
112
134
  except Empty:
113
135
  pass
114
136
 
115
- outputs = self.Outputs()
116
137
  for output_name, output_list in mapped_items.items():
117
- setattr(outputs, output_name, output_list)
118
-
119
- return outputs
138
+ yield BaseOutput(name=output_name, value=output_list)
120
139
 
121
140
  def _context_run_subworkflow(
122
141
  self, *, item: MapNodeItemType, index: int, parent_context: Optional[ParentContext] = None
@@ -149,21 +168,27 @@ class MapNode(BaseAdornmentNode[StateType], Generic[StateType, MapNodeItemType])
149
168
 
150
169
  @overload
151
170
  @classmethod
152
- def wrap(cls, items: List[MapNodeItemType]) -> Callable[..., Type["MapNode[StateType, MapNodeItemType]"]]: ...
171
+ def wrap(
172
+ cls, items: List[MapNodeItemType], max_concurrency: Optional[int] = None
173
+ ) -> Callable[..., Type["MapNode[StateType, MapNodeItemType]"]]: ...
153
174
 
154
175
  # TODO: We should be able to do this overload automatically as we do with node attributes
155
176
  # https://app.shortcut.com/vellum/story/5289
156
177
  @overload
157
178
  @classmethod
158
179
  def wrap(
159
- cls, items: BaseDescriptor[List[MapNodeItemType]]
180
+ cls,
181
+ items: BaseDescriptor[List[MapNodeItemType]],
182
+ max_concurrency: Optional[int] = None,
160
183
  ) -> Callable[..., Type["MapNode[StateType, MapNodeItemType]"]]: ...
161
184
 
162
185
  @classmethod
163
186
  def wrap(
164
- cls, items: Union[List[MapNodeItemType], BaseDescriptor[List[MapNodeItemType]]]
187
+ cls,
188
+ items: Union[List[MapNodeItemType], BaseDescriptor[List[MapNodeItemType]]],
189
+ max_concurrency: Optional[int] = None,
165
190
  ) -> Callable[..., Type["MapNode[StateType, MapNodeItemType]"]]:
166
- return create_adornment(cls, attributes={"items": items})
191
+ return create_adornment(cls, attributes={"items": items, "max_concurrency": max_concurrency})
167
192
 
168
193
  @classmethod
169
194
  def __annotate_outputs_class__(cls, outputs_class: Type[BaseOutputs], reference: OutputReference) -> None:
@@ -3,7 +3,7 @@ import time
3
3
  from vellum.workflows.inputs.base import BaseInputs
4
4
  from vellum.workflows.nodes.bases import BaseNode
5
5
  from vellum.workflows.nodes.core.map_node.node import MapNode
6
- from vellum.workflows.outputs.base import BaseOutputs
6
+ from vellum.workflows.outputs.base import BaseOutput, BaseOutputs
7
7
  from vellum.workflows.state.base import BaseState, StateMeta
8
8
 
9
9
 
@@ -35,10 +35,10 @@ def test_map_node__use_parent_inputs_and_state():
35
35
  meta=StateMeta(workflow_inputs=Inputs(foo="foo")),
36
36
  )
37
37
  )
38
- outputs = node.run()
38
+ outputs = list(node.run())
39
39
 
40
40
  # THEN the data is used successfully
41
- assert outputs.value == ["foo bar 1", "foo bar 2", "foo bar 3"]
41
+ assert outputs[-1] == BaseOutput(name="value", value=["foo bar 1", "foo bar 2", "foo bar 3"])
42
42
 
43
43
 
44
44
  def test_map_node__use_parallelism():
@@ -62,4 +62,4 @@ def test_map_node__use_parallelism():
62
62
 
63
63
  # THEN the node should have ran in parallel
64
64
  run_time = (end_ts - start_ts) / 10**9
65
- assert run_time < 0.1
65
+ assert run_time < 0.2
@@ -13,7 +13,7 @@ from vellum.workflows.types.generics import StateType
13
13
 
14
14
  class BasePromptNode(BaseNode, Generic[StateType]):
15
15
  # Inputs that are passed to the Prompt
16
- prompt_inputs: ClassVar[EntityInputsInterface]
16
+ prompt_inputs: ClassVar[Optional[EntityInputsInterface]] = None
17
17
 
18
18
  request_options: Optional[RequestOptions] = None
19
19
 
@@ -53,8 +53,7 @@ class BaseInlinePromptNode(BasePromptNode[StateType], Generic[StateType]):
53
53
 
54
54
  def _get_prompt_event_stream(self) -> Iterator[AdHocExecutePromptEvent]:
55
55
  input_variables, input_values = self._compile_prompt_inputs()
56
- current_parent_context = get_parent_context()
57
- parent_context = current_parent_context.model_dump_json() if current_parent_context else None
56
+ parent_context = get_parent_context()
58
57
  request_options = self.request_options or RequestOptions()
59
58
  request_options["additional_body_parameters"] = {
60
59
  "execution_context": {"parent_context": parent_context},
@@ -77,13 +76,16 @@ class BaseInlinePromptNode(BasePromptNode[StateType], Generic[StateType]):
77
76
  blocks=self.blocks,
78
77
  functions=normalized_functions,
79
78
  expand_meta=self.expand_meta,
80
- request_options=self.request_options,
79
+ request_options=request_options,
81
80
  )
82
81
 
83
82
  def _compile_prompt_inputs(self) -> Tuple[List[VellumVariable], List[PromptRequestInput]]:
84
83
  input_variables: List[VellumVariable] = []
85
84
  input_values: List[PromptRequestInput] = []
86
85
 
86
+ if not self.prompt_inputs:
87
+ return input_variables, input_values
88
+
87
89
  for input_name, input_value in self.prompt_inputs.items():
88
90
  if isinstance(input_value, str):
89
91
  input_variables.append(