vellum-ai 0.11.0__py3-none-any.whl → 0.11.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. vellum/__init__.py +18 -0
  2. vellum/client/core/client_wrapper.py +1 -1
  3. vellum/client/types/__init__.py +30 -0
  4. vellum/client/types/document_document_to_document_index.py +6 -0
  5. vellum/client/types/slim_document.py +2 -2
  6. vellum/client/types/slim_document_document_to_document_index.py +43 -0
  7. vellum/client/types/test_suite_run_exec_config.py +7 -1
  8. vellum/client/types/test_suite_run_exec_config_request.py +8 -0
  9. vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +31 -0
  10. vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +27 -0
  11. vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +27 -0
  12. vellum/client/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +31 -0
  13. vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +31 -0
  14. vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +27 -0
  15. vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +27 -0
  16. vellum/client/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +31 -0
  17. vellum/types/slim_document_document_to_document_index.py +3 -0
  18. vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config.py +3 -0
  19. vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data.py +3 -0
  20. vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_data_request.py +3 -0
  21. vellum/types/test_suite_run_prompt_sandbox_history_item_exec_config_request.py +3 -0
  22. vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config.py +3 -0
  23. vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data.py +3 -0
  24. vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_data_request.py +3 -0
  25. vellum/types/test_suite_run_workflow_sandbox_history_item_exec_config_request.py +3 -0
  26. vellum/workflows/context.py +42 -0
  27. vellum/workflows/descriptors/base.py +1 -1
  28. vellum/workflows/nodes/bases/tests/test_base_node.py +1 -1
  29. vellum/workflows/nodes/core/inline_subworkflow_node/node.py +13 -7
  30. vellum/workflows/nodes/core/map_node/node.py +27 -4
  31. vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py +21 -0
  32. vellum/workflows/nodes/displayable/api_node/node.py +3 -2
  33. vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +9 -0
  34. vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +10 -1
  35. vellum/workflows/nodes/displayable/subworkflow_deployment_node/node.py +10 -1
  36. vellum/workflows/nodes/displayable/tests/test_text_prompt_deployment_node.py +1 -1
  37. vellum/workflows/runner/runner.py +74 -70
  38. vellum/workflows/workflows/event_filters.py +4 -1
  39. {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/METADATA +1 -1
  40. {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/RECORD +54 -35
  41. vellum_cli/pull.py +3 -1
  42. vellum_cli/tests/test_pull.py +18 -0
  43. vellum_ee/workflows/display/base.py +1 -2
  44. vellum_ee/workflows/display/nodes/vellum/api_node.py +53 -54
  45. vellum_ee/workflows/display/nodes/vellum/merge_node.py +20 -1
  46. vellum_ee/workflows/display/nodes/vellum/templating_node.py +15 -4
  47. vellum_ee/workflows/display/nodes/vellum/utils.py +26 -6
  48. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_api_node_serialization.py +29 -1
  49. vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py +2 -2
  50. vellum_ee/workflows/display/vellum.py +4 -4
  51. vellum_ee/workflows/display/workflows/vellum_workflow_display.py +18 -9
  52. {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/LICENSE +0 -0
  53. {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/WHEEL +0 -0
  54. {vellum_ai-0.11.0.dist-info → vellum_ai-0.11.3.dist-info}/entry_points.txt +0 -0
vellum/__init__.py CHANGED
@@ -319,6 +319,7 @@ from .types import (
319
319
  SentenceChunkingRequest,
320
320
  SlimDeploymentRead,
321
321
  SlimDocument,
322
+ SlimDocumentDocumentToDocumentIndex,
322
323
  SlimWorkflowDeployment,
323
324
  StreamingAdHocExecutePromptEvent,
324
325
  StreamingExecutePromptEvent,
@@ -393,6 +394,10 @@ from .types import (
393
394
  TestSuiteRunMetricNumberOutput,
394
395
  TestSuiteRunMetricOutput,
395
396
  TestSuiteRunMetricStringOutput,
397
+ TestSuiteRunPromptSandboxHistoryItemExecConfig,
398
+ TestSuiteRunPromptSandboxHistoryItemExecConfigData,
399
+ TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest,
400
+ TestSuiteRunPromptSandboxHistoryItemExecConfigRequest,
396
401
  TestSuiteRunRead,
397
402
  TestSuiteRunState,
398
403
  TestSuiteRunTestSuite,
@@ -400,6 +405,10 @@ from .types import (
400
405
  TestSuiteRunWorkflowReleaseTagExecConfigData,
401
406
  TestSuiteRunWorkflowReleaseTagExecConfigDataRequest,
402
407
  TestSuiteRunWorkflowReleaseTagExecConfigRequest,
408
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfig,
409
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigData,
410
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest,
411
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest,
403
412
  TestSuiteTestCase,
404
413
  TestSuiteTestCaseBulkOperationRequest,
405
414
  TestSuiteTestCaseBulkResult,
@@ -843,6 +852,7 @@ __all__ = [
843
852
  "SentenceChunkingRequest",
844
853
  "SlimDeploymentRead",
845
854
  "SlimDocument",
855
+ "SlimDocumentDocumentToDocumentIndex",
846
856
  "SlimWorkflowDeployment",
847
857
  "StreamingAdHocExecutePromptEvent",
848
858
  "StreamingExecutePromptEvent",
@@ -917,6 +927,10 @@ __all__ = [
917
927
  "TestSuiteRunMetricNumberOutput",
918
928
  "TestSuiteRunMetricOutput",
919
929
  "TestSuiteRunMetricStringOutput",
930
+ "TestSuiteRunPromptSandboxHistoryItemExecConfig",
931
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigData",
932
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest",
933
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigRequest",
920
934
  "TestSuiteRunRead",
921
935
  "TestSuiteRunState",
922
936
  "TestSuiteRunTestSuite",
@@ -924,6 +938,10 @@ __all__ = [
924
938
  "TestSuiteRunWorkflowReleaseTagExecConfigData",
925
939
  "TestSuiteRunWorkflowReleaseTagExecConfigDataRequest",
926
940
  "TestSuiteRunWorkflowReleaseTagExecConfigRequest",
941
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfig",
942
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigData",
943
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest",
944
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest",
927
945
  "TestSuiteTestCase",
928
946
  "TestSuiteTestCaseBulkOperationRequest",
929
947
  "TestSuiteTestCaseBulkResult",
@@ -17,7 +17,7 @@ class BaseClientWrapper:
17
17
  headers: typing.Dict[str, str] = {
18
18
  "X-Fern-Language": "Python",
19
19
  "X-Fern-SDK-Name": "vellum-ai",
20
- "X-Fern-SDK-Version": "0.11.0",
20
+ "X-Fern-SDK-Version": "0.11.2",
21
21
  }
22
22
  headers["X_API_KEY"] = self.api_key
23
23
  return headers
@@ -330,6 +330,7 @@ from .sentence_chunking import SentenceChunking
330
330
  from .sentence_chunking_request import SentenceChunkingRequest
331
331
  from .slim_deployment_read import SlimDeploymentRead
332
332
  from .slim_document import SlimDocument
333
+ from .slim_document_document_to_document_index import SlimDocumentDocumentToDocumentIndex
333
334
  from .slim_workflow_deployment import SlimWorkflowDeployment
334
335
  from .streaming_ad_hoc_execute_prompt_event import StreamingAdHocExecutePromptEvent
335
336
  from .streaming_execute_prompt_event import StreamingExecutePromptEvent
@@ -406,6 +407,16 @@ from .test_suite_run_metric_json_output import TestSuiteRunMetricJsonOutput
406
407
  from .test_suite_run_metric_number_output import TestSuiteRunMetricNumberOutput
407
408
  from .test_suite_run_metric_output import TestSuiteRunMetricOutput
408
409
  from .test_suite_run_metric_string_output import TestSuiteRunMetricStringOutput
410
+ from .test_suite_run_prompt_sandbox_history_item_exec_config import TestSuiteRunPromptSandboxHistoryItemExecConfig
411
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_data import (
412
+ TestSuiteRunPromptSandboxHistoryItemExecConfigData,
413
+ )
414
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_data_request import (
415
+ TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest,
416
+ )
417
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_request import (
418
+ TestSuiteRunPromptSandboxHistoryItemExecConfigRequest,
419
+ )
409
420
  from .test_suite_run_read import TestSuiteRunRead
410
421
  from .test_suite_run_state import TestSuiteRunState
411
422
  from .test_suite_run_test_suite import TestSuiteRunTestSuite
@@ -415,6 +426,16 @@ from .test_suite_run_workflow_release_tag_exec_config_data_request import (
415
426
  TestSuiteRunWorkflowReleaseTagExecConfigDataRequest,
416
427
  )
417
428
  from .test_suite_run_workflow_release_tag_exec_config_request import TestSuiteRunWorkflowReleaseTagExecConfigRequest
429
+ from .test_suite_run_workflow_sandbox_history_item_exec_config import TestSuiteRunWorkflowSandboxHistoryItemExecConfig
430
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_data import (
431
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigData,
432
+ )
433
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_data_request import (
434
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest,
435
+ )
436
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_request import (
437
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest,
438
+ )
418
439
  from .test_suite_test_case import TestSuiteTestCase
419
440
  from .test_suite_test_case_bulk_operation_request import TestSuiteTestCaseBulkOperationRequest
420
441
  from .test_suite_test_case_bulk_result import TestSuiteTestCaseBulkResult
@@ -819,6 +840,7 @@ __all__ = [
819
840
  "SentenceChunkingRequest",
820
841
  "SlimDeploymentRead",
821
842
  "SlimDocument",
843
+ "SlimDocumentDocumentToDocumentIndex",
822
844
  "SlimWorkflowDeployment",
823
845
  "StreamingAdHocExecutePromptEvent",
824
846
  "StreamingExecutePromptEvent",
@@ -893,6 +915,10 @@ __all__ = [
893
915
  "TestSuiteRunMetricNumberOutput",
894
916
  "TestSuiteRunMetricOutput",
895
917
  "TestSuiteRunMetricStringOutput",
918
+ "TestSuiteRunPromptSandboxHistoryItemExecConfig",
919
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigData",
920
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest",
921
+ "TestSuiteRunPromptSandboxHistoryItemExecConfigRequest",
896
922
  "TestSuiteRunRead",
897
923
  "TestSuiteRunState",
898
924
  "TestSuiteRunTestSuite",
@@ -900,6 +926,10 @@ __all__ = [
900
926
  "TestSuiteRunWorkflowReleaseTagExecConfigData",
901
927
  "TestSuiteRunWorkflowReleaseTagExecConfigDataRequest",
902
928
  "TestSuiteRunWorkflowReleaseTagExecConfigRequest",
929
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfig",
930
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigData",
931
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest",
932
+ "TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest",
903
933
  "TestSuiteTestCase",
904
934
  "TestSuiteTestCaseBulkOperationRequest",
905
935
  "TestSuiteTestCaseBulkResult",
@@ -8,6 +8,10 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
8
 
9
9
 
10
10
  class DocumentDocumentToDocumentIndex(UniversalBaseModel):
11
+ """
12
+ A detailed representation of the link between a Document and a Document Index it's a member of.
13
+ """
14
+
11
15
  id: str = pydantic.Field()
12
16
  """
13
17
  Vellum-generated ID that uniquely identifies this link.
@@ -29,6 +33,8 @@ class DocumentDocumentToDocumentIndex(UniversalBaseModel):
29
33
  - `FAILED` - Failed
30
34
  """
31
35
 
36
+ extracted_text_file_url: typing.Optional[str] = None
37
+
32
38
  if IS_PYDANTIC_V2:
33
39
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
34
40
  else:
@@ -7,7 +7,7 @@ import datetime as dt
7
7
  from .document_processing_state import DocumentProcessingState
8
8
  from .processing_failure_reason_enum import ProcessingFailureReasonEnum
9
9
  from .document_status import DocumentStatus
10
- from .document_document_to_document_index import DocumentDocumentToDocumentIndex
10
+ from .slim_document_document_to_document_index import SlimDocumentDocumentToDocumentIndex
11
11
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
12
12
 
13
13
 
@@ -58,7 +58,7 @@ class SlimDocument(UniversalBaseModel):
58
58
  A previously supplied JSON object containing metadata that can be filtered on when searching.
59
59
  """
60
60
 
61
- document_to_document_indexes: typing.List[DocumentDocumentToDocumentIndex]
61
+ document_to_document_indexes: typing.List[SlimDocumentDocumentToDocumentIndex]
62
62
 
63
63
  if IS_PYDANTIC_V2:
64
64
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,43 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ import typing
6
+ from .indexing_state_enum import IndexingStateEnum
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+
9
+
10
+ class SlimDocumentDocumentToDocumentIndex(UniversalBaseModel):
11
+ """
12
+ A slim representation of the link between a Document and a Document Index it's a member of.
13
+ """
14
+
15
+ id: str = pydantic.Field()
16
+ """
17
+ Vellum-generated ID that uniquely identifies this link.
18
+ """
19
+
20
+ document_index_id: str = pydantic.Field()
21
+ """
22
+ Vellum-generated ID that uniquely identifies the index this document is included in.
23
+ """
24
+
25
+ indexing_state: typing.Optional[IndexingStateEnum] = pydantic.Field(default=None)
26
+ """
27
+ An enum value representing where this document is along its indexing lifecycle for this index.
28
+
29
+ - `AWAITING_PROCESSING` - Awaiting Processing
30
+ - `QUEUED` - Queued
31
+ - `INDEXING` - Indexing
32
+ - `INDEXED` - Indexed
33
+ - `FAILED` - Failed
34
+ """
35
+
36
+ if IS_PYDANTIC_V2:
37
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
38
+ else:
39
+
40
+ class Config:
41
+ frozen = True
42
+ smart_union = True
43
+ extra = pydantic.Extra.allow
@@ -2,9 +2,15 @@
2
2
 
3
3
  import typing
4
4
  from .test_suite_run_deployment_release_tag_exec_config import TestSuiteRunDeploymentReleaseTagExecConfig
5
+ from .test_suite_run_prompt_sandbox_history_item_exec_config import TestSuiteRunPromptSandboxHistoryItemExecConfig
5
6
  from .test_suite_run_workflow_release_tag_exec_config import TestSuiteRunWorkflowReleaseTagExecConfig
7
+ from .test_suite_run_workflow_sandbox_history_item_exec_config import TestSuiteRunWorkflowSandboxHistoryItemExecConfig
6
8
  from .test_suite_run_external_exec_config import TestSuiteRunExternalExecConfig
7
9
 
8
10
  TestSuiteRunExecConfig = typing.Union[
9
- TestSuiteRunDeploymentReleaseTagExecConfig, TestSuiteRunWorkflowReleaseTagExecConfig, TestSuiteRunExternalExecConfig
11
+ TestSuiteRunDeploymentReleaseTagExecConfig,
12
+ TestSuiteRunPromptSandboxHistoryItemExecConfig,
13
+ TestSuiteRunWorkflowReleaseTagExecConfig,
14
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfig,
15
+ TestSuiteRunExternalExecConfig,
10
16
  ]
@@ -2,11 +2,19 @@
2
2
 
3
3
  import typing
4
4
  from .test_suite_run_deployment_release_tag_exec_config_request import TestSuiteRunDeploymentReleaseTagExecConfigRequest
5
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_request import (
6
+ TestSuiteRunPromptSandboxHistoryItemExecConfigRequest,
7
+ )
5
8
  from .test_suite_run_workflow_release_tag_exec_config_request import TestSuiteRunWorkflowReleaseTagExecConfigRequest
9
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_request import (
10
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest,
11
+ )
6
12
  from .test_suite_run_external_exec_config_request import TestSuiteRunExternalExecConfigRequest
7
13
 
8
14
  TestSuiteRunExecConfigRequest = typing.Union[
9
15
  TestSuiteRunDeploymentReleaseTagExecConfigRequest,
16
+ TestSuiteRunPromptSandboxHistoryItemExecConfigRequest,
10
17
  TestSuiteRunWorkflowReleaseTagExecConfigRequest,
18
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest,
11
19
  TestSuiteRunExternalExecConfigRequest,
12
20
  ]
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_data import (
6
+ TestSuiteRunPromptSandboxHistoryItemExecConfigData,
7
+ )
8
+ import pydantic
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TestSuiteRunPromptSandboxHistoryItemExecConfig(UniversalBaseModel):
13
+ """
14
+ Execution configuration for running a Test Suite against a Prompt Sandbox History Item
15
+ """
16
+
17
+ type: typing.Literal["PROMPT_SANDBOX_HISTORY_ITEM"] = "PROMPT_SANDBOX_HISTORY_ITEM"
18
+ data: TestSuiteRunPromptSandboxHistoryItemExecConfigData
19
+ test_case_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
20
+ """
21
+ Optionally specify a subset of test case ids to run. If not provided, all test cases within the test suite will be run by default.
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class TestSuiteRunPromptSandboxHistoryItemExecConfigData(UniversalBaseModel):
10
+ history_item_id: str = pydantic.Field()
11
+ """
12
+ The ID of the Prompt Sandbox History Item that the Test Suite will run against.
13
+ """
14
+
15
+ prompt_variant_id: str = pydantic.Field()
16
+ """
17
+ The ID of the Prompt Variant within the Prompt Sandbox History Item that you'd like to run the Test Suite against.
18
+ """
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest(UniversalBaseModel):
10
+ history_item_id: str = pydantic.Field()
11
+ """
12
+ The ID of the Prompt Sandbox History Item that the Test Suite will run against.
13
+ """
14
+
15
+ prompt_variant_id: str = pydantic.Field()
16
+ """
17
+ The ID of the Prompt Variant within the Prompt Sandbox History Item that you'd like to run the Test Suite against.
18
+ """
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .test_suite_run_prompt_sandbox_history_item_exec_config_data_request import (
6
+ TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest,
7
+ )
8
+ import pydantic
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TestSuiteRunPromptSandboxHistoryItemExecConfigRequest(UniversalBaseModel):
13
+ """
14
+ Execution configuration for running a Test Suite against a Prompt Sandbox History Item
15
+ """
16
+
17
+ type: typing.Literal["PROMPT_SANDBOX_HISTORY_ITEM"] = "PROMPT_SANDBOX_HISTORY_ITEM"
18
+ data: TestSuiteRunPromptSandboxHistoryItemExecConfigDataRequest
19
+ test_case_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
20
+ """
21
+ Optionally specify a subset of test case ids to run. If not provided, all test cases within the test suite will be run by default.
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_data import (
6
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigData,
7
+ )
8
+ import pydantic
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TestSuiteRunWorkflowSandboxHistoryItemExecConfig(UniversalBaseModel):
13
+ """
14
+ Execution configuration for running a Test Suite against a Workflow Sandbox History Item
15
+ """
16
+
17
+ type: typing.Literal["WORKFLOW_SANDBOX_HISTORY_ITEM"] = "WORKFLOW_SANDBOX_HISTORY_ITEM"
18
+ data: TestSuiteRunWorkflowSandboxHistoryItemExecConfigData
19
+ test_case_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
20
+ """
21
+ Optionally specify a subset of test case ids to run. If not provided, all test cases within the test suite will be run by default.
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class TestSuiteRunWorkflowSandboxHistoryItemExecConfigData(UniversalBaseModel):
10
+ history_item_id: str = pydantic.Field()
11
+ """
12
+ The ID of the Workflow Sandbox History Item that the Test Suite will run against.
13
+ """
14
+
15
+ workflow_variant_id: str = pydantic.Field()
16
+ """
17
+ The ID of the Workflow Variant within the Workflow Sandbox History Item that you'd like to run the Test Suite against.
18
+ """
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,27 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
6
+ import typing
7
+
8
+
9
+ class TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest(UniversalBaseModel):
10
+ history_item_id: str = pydantic.Field()
11
+ """
12
+ The ID of the Workflow Sandbox History Item that the Test Suite will run against.
13
+ """
14
+
15
+ workflow_variant_id: str = pydantic.Field()
16
+ """
17
+ The ID of the Workflow Variant within the Workflow Sandbox History Item that you'd like to run the Test Suite against.
18
+ """
19
+
20
+ if IS_PYDANTIC_V2:
21
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
22
+ else:
23
+
24
+ class Config:
25
+ frozen = True
26
+ smart_union = True
27
+ extra = pydantic.Extra.allow
@@ -0,0 +1,31 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import typing
5
+ from .test_suite_run_workflow_sandbox_history_item_exec_config_data_request import (
6
+ TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest,
7
+ )
8
+ import pydantic
9
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
10
+
11
+
12
+ class TestSuiteRunWorkflowSandboxHistoryItemExecConfigRequest(UniversalBaseModel):
13
+ """
14
+ Execution configuration for running a Test Suite against a Workflow Sandbox History Item
15
+ """
16
+
17
+ type: typing.Literal["WORKFLOW_SANDBOX_HISTORY_ITEM"] = "WORKFLOW_SANDBOX_HISTORY_ITEM"
18
+ data: TestSuiteRunWorkflowSandboxHistoryItemExecConfigDataRequest
19
+ test_case_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
20
+ """
21
+ Optionally specify a subset of test case ids to run. If not provided, all test cases within the test suite will be run by default.
22
+ """
23
+
24
+ if IS_PYDANTIC_V2:
25
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
26
+ else:
27
+
28
+ class Config:
29
+ frozen = True
30
+ smart_union = True
31
+ extra = pydantic.Extra.allow
@@ -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.types.slim_document_document_to_document_index 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.types.test_suite_run_prompt_sandbox_history_item_exec_config 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.types.test_suite_run_prompt_sandbox_history_item_exec_config_data 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.types.test_suite_run_prompt_sandbox_history_item_exec_config_data_request 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.types.test_suite_run_prompt_sandbox_history_item_exec_config_request 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.types.test_suite_run_workflow_sandbox_history_item_exec_config 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.types.test_suite_run_workflow_sandbox_history_item_exec_config_data 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.types.test_suite_run_workflow_sandbox_history_item_exec_config_data_request 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.types.test_suite_run_workflow_sandbox_history_item_exec_config_request import *
@@ -0,0 +1,42 @@
1
+ from contextlib import contextmanager
2
+ import threading
3
+ from typing import Iterator, Optional, cast
4
+
5
+ from vellum.client.core import UniversalBaseModel
6
+ from vellum.workflows.events.types import ParentContext
7
+
8
+
9
+ class ExecutionContext(UniversalBaseModel):
10
+ parent_context: Optional[ParentContext] = None
11
+
12
+
13
+ _CONTEXT_KEY = "_execution_context"
14
+
15
+ local = threading.local()
16
+
17
+
18
+ def get_execution_context() -> ExecutionContext:
19
+ """Retrieve the current execution context."""
20
+ return getattr(local, _CONTEXT_KEY, ExecutionContext())
21
+
22
+
23
+ def set_execution_context(context: ExecutionContext) -> None:
24
+ """Set the current execution context."""
25
+ setattr(local, _CONTEXT_KEY, context)
26
+
27
+
28
+ def get_parent_context() -> ParentContext:
29
+ return cast(ParentContext, get_execution_context().parent_context)
30
+
31
+
32
+ @contextmanager
33
+ def execution_context(parent_context: Optional[ParentContext] = None) -> Iterator[None]:
34
+ """Context manager for handling execution context."""
35
+ prev_context = get_execution_context()
36
+ set_context = ExecutionContext(parent_context=parent_context) if parent_context else prev_context
37
+
38
+ try:
39
+ set_execution_context(set_context)
40
+ yield
41
+ finally:
42
+ set_execution_context(prev_context)
@@ -30,7 +30,7 @@ if TYPE_CHECKING:
30
30
  from vellum.workflows.nodes.bases import BaseNode
31
31
  from vellum.workflows.state.base import BaseState
32
32
 
33
- _T = TypeVar("_T")
33
+ _T = TypeVar("_T", covariant=True)
34
34
  _O = TypeVar("_O")
35
35
  _O2 = TypeVar("_O2")
36
36
 
@@ -25,7 +25,7 @@ def test_base_node__node_resolution__unset_pydantic_fields():
25
25
  assert node.data.dict() == my_data.dict()
26
26
 
27
27
 
28
- def test_base_node__node_resolution__descriptor_in_dict():
28
+ def test_base_node__node_resolution__descriptors_in_dict():
29
29
  # GIVEN an Input and State class
30
30
  class Inputs(BaseInputs):
31
31
  hello: str
@@ -1,10 +1,12 @@
1
1
  from typing import TYPE_CHECKING, Generic, Iterator, Optional, Set, Type, TypeVar
2
2
 
3
+ from vellum.workflows.context import execution_context, get_parent_context
3
4
  from vellum.workflows.errors.types import VellumErrorCode
4
5
  from vellum.workflows.exceptions import NodeException
5
6
  from vellum.workflows.nodes.bases.base_subworkflow_node import BaseSubworkflowNode
6
7
  from vellum.workflows.outputs.base import BaseOutput, BaseOutputs
7
8
  from vellum.workflows.state.base import BaseState
9
+ from vellum.workflows.state.context import WorkflowContext
8
10
  from vellum.workflows.types.generics import StateType, WorkflowInputsType
9
11
 
10
12
  if TYPE_CHECKING:
@@ -24,18 +26,22 @@ class InlineSubworkflowNode(BaseSubworkflowNode[StateType], Generic[StateType, W
24
26
  subworkflow: Type["BaseWorkflow[WorkflowInputsType, InnerStateType]"]
25
27
 
26
28
  def run(self) -> Iterator[BaseOutput]:
27
- subworkflow = self.subworkflow(
28
- parent_state=self.state,
29
- context=self._context,
30
- )
31
- subworkflow_stream = subworkflow.stream(
32
- inputs=self._compile_subworkflow_inputs(),
33
- )
29
+ with execution_context(parent_context=get_parent_context() or self._context.parent_context):
30
+ subworkflow = self.subworkflow(
31
+ parent_state=self.state,
32
+ context=WorkflowContext(
33
+ _vellum_client=self._context._vellum_client,
34
+ ),
35
+ )
36
+ subworkflow_stream = subworkflow.stream(
37
+ inputs=self._compile_subworkflow_inputs(),
38
+ )
34
39
 
35
40
  outputs: Optional[BaseOutputs] = None
36
41
  fulfilled_output_names: Set[str] = set()
37
42
 
38
43
  for event in subworkflow_stream:
44
+ self._context._emit_subworkflow_event(event)
39
45
  if event.name == "workflow.execution.streaming":
40
46
  if event.output.is_fulfilled:
41
47
  fulfilled_output_names.add(event.output.name)