vellum-ai 0.14.26__py3-none-any.whl → 0.14.27__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
vellum/__init__.py CHANGED
@@ -300,6 +300,7 @@ from .types import (
300
300
  PromptDeploymentExpandMetaRequest,
301
301
  PromptDeploymentInputRequest,
302
302
  PromptDeploymentParentContext,
303
+ PromptExecConfig,
303
304
  PromptExecutionMeta,
304
305
  PromptNodeExecutionMeta,
305
306
  PromptNodeResult,
@@ -589,6 +590,7 @@ from .resources import (
589
590
  metric_definitions,
590
591
  ml_models,
591
592
  organizations,
593
+ prompts,
592
594
  sandboxes,
593
595
  test_suite_runs,
594
596
  test_suites,
@@ -910,6 +912,7 @@ __all__ = [
910
912
  "PromptDeploymentExpandMetaRequest",
911
913
  "PromptDeploymentInputRequest",
912
914
  "PromptDeploymentParentContext",
915
+ "PromptExecConfig",
913
916
  "PromptExecutionMeta",
914
917
  "PromptNodeExecutionMeta",
915
918
  "PromptNodeResult",
@@ -1193,6 +1196,7 @@ __all__ = [
1193
1196
  "metric_definitions",
1194
1197
  "ml_models",
1195
1198
  "organizations",
1199
+ "prompts",
1196
1200
  "sandboxes",
1197
1201
  "test_suite_runs",
1198
1202
  "test_suites",
vellum/client/__init__.py CHANGED
@@ -13,6 +13,7 @@ from .resources.folder_entities.client import FolderEntitiesClient
13
13
  from .resources.metric_definitions.client import MetricDefinitionsClient
14
14
  from .resources.ml_models.client import MlModelsClient
15
15
  from .resources.organizations.client import OrganizationsClient
16
+ from .resources.prompts.client import PromptsClient
16
17
  from .resources.sandboxes.client import SandboxesClient
17
18
  from .resources.test_suite_runs.client import TestSuiteRunsClient
18
19
  from .resources.test_suites.client import TestSuitesClient
@@ -69,6 +70,7 @@ from .resources.folder_entities.client import AsyncFolderEntitiesClient
69
70
  from .resources.metric_definitions.client import AsyncMetricDefinitionsClient
70
71
  from .resources.ml_models.client import AsyncMlModelsClient
71
72
  from .resources.organizations.client import AsyncOrganizationsClient
73
+ from .resources.prompts.client import AsyncPromptsClient
72
74
  from .resources.sandboxes.client import AsyncSandboxesClient
73
75
  from .resources.test_suite_runs.client import AsyncTestSuiteRunsClient
74
76
  from .resources.test_suites.client import AsyncTestSuitesClient
@@ -145,6 +147,7 @@ class Vellum:
145
147
  self.metric_definitions = MetricDefinitionsClient(client_wrapper=self._client_wrapper)
146
148
  self.ml_models = MlModelsClient(client_wrapper=self._client_wrapper)
147
149
  self.organizations = OrganizationsClient(client_wrapper=self._client_wrapper)
150
+ self.prompts = PromptsClient(client_wrapper=self._client_wrapper)
148
151
  self.sandboxes = SandboxesClient(client_wrapper=self._client_wrapper)
149
152
  self.test_suite_runs = TestSuiteRunsClient(client_wrapper=self._client_wrapper)
150
153
  self.test_suites = TestSuitesClient(client_wrapper=self._client_wrapper)
@@ -1486,6 +1489,7 @@ class AsyncVellum:
1486
1489
  self.metric_definitions = AsyncMetricDefinitionsClient(client_wrapper=self._client_wrapper)
1487
1490
  self.ml_models = AsyncMlModelsClient(client_wrapper=self._client_wrapper)
1488
1491
  self.organizations = AsyncOrganizationsClient(client_wrapper=self._client_wrapper)
1492
+ self.prompts = AsyncPromptsClient(client_wrapper=self._client_wrapper)
1489
1493
  self.sandboxes = AsyncSandboxesClient(client_wrapper=self._client_wrapper)
1490
1494
  self.test_suite_runs = AsyncTestSuiteRunsClient(client_wrapper=self._client_wrapper)
1491
1495
  self.test_suites = AsyncTestSuitesClient(client_wrapper=self._client_wrapper)
@@ -18,7 +18,7 @@ class BaseClientWrapper:
18
18
  headers: typing.Dict[str, str] = {
19
19
  "X-Fern-Language": "Python",
20
20
  "X-Fern-SDK-Name": "vellum-ai",
21
- "X-Fern-SDK-Version": "0.14.26",
21
+ "X-Fern-SDK-Version": "0.14.27",
22
22
  }
23
23
  headers["X_API_KEY"] = self.api_key
24
24
  return headers
@@ -45,7 +45,7 @@ def jsonable_encoder(obj: Any, custom_encoder: Optional[Dict[Any, Callable[[Any]
45
45
  encoder = getattr(obj.__config__, "json_encoders", {}) # type: ignore # Pydantic v1
46
46
  if custom_encoder:
47
47
  encoder.update(custom_encoder)
48
- obj_dict = obj.dict(by_alias=True)
48
+ obj_dict = obj.model_dump(mode="json")
49
49
  if "__root__" in obj_dict:
50
50
  obj_dict = obj_dict["__root__"]
51
51
  if "root" in obj_dict:
@@ -10,6 +10,7 @@ from . import (
10
10
  metric_definitions,
11
11
  ml_models,
12
12
  organizations,
13
+ prompts,
13
14
  sandboxes,
14
15
  test_suite_runs,
15
16
  test_suites,
@@ -42,6 +43,7 @@ __all__ = [
42
43
  "metric_definitions",
43
44
  "ml_models",
44
45
  "organizations",
46
+ "prompts",
45
47
  "sandboxes",
46
48
  "test_suite_runs",
47
49
  "test_suites",
@@ -0,0 +1,2 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
@@ -0,0 +1,197 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ...core.client_wrapper import SyncClientWrapper
4
+ import typing
5
+ from ...core.request_options import RequestOptions
6
+ from ...types.prompt_exec_config import PromptExecConfig
7
+ from ...core.jsonable_encoder import jsonable_encoder
8
+ from ...core.pydantic_utilities import parse_obj_as
9
+ from ...errors.bad_request_error import BadRequestError
10
+ from ...errors.not_found_error import NotFoundError
11
+ from json.decoder import JSONDecodeError
12
+ from ...core.api_error import ApiError
13
+ from ...core.client_wrapper import AsyncClientWrapper
14
+
15
+
16
+ class PromptsClient:
17
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
18
+ self._client_wrapper = client_wrapper
19
+
20
+ def pull(
21
+ self,
22
+ id: str,
23
+ *,
24
+ prompt_variant_id: typing.Optional[str] = None,
25
+ request_options: typing.Optional[RequestOptions] = None,
26
+ ) -> PromptExecConfig:
27
+ """
28
+ Used to pull the definition of a Prompt from Vellum.
29
+
30
+ Parameters
31
+ ----------
32
+ id : str
33
+ The ID of the Prompt to pull from. Prompt Sandbox IDs are currently supported.
34
+
35
+ prompt_variant_id : typing.Optional[str]
36
+ The ID of the Prompt Variant within a Prompt Sandbox to pull. Must be included if providing the ID of a Prompt Sandbox.
37
+
38
+ request_options : typing.Optional[RequestOptions]
39
+ Request-specific configuration.
40
+
41
+ Returns
42
+ -------
43
+ PromptExecConfig
44
+
45
+
46
+ Examples
47
+ --------
48
+ from vellum import Vellum
49
+
50
+ client = Vellum(
51
+ api_key="YOUR_API_KEY",
52
+ )
53
+ client.prompts.pull(
54
+ id="id",
55
+ )
56
+ """
57
+ _response = self._client_wrapper.httpx_client.request(
58
+ f"v1/prompts/{jsonable_encoder(id)}/pull",
59
+ base_url=self._client_wrapper.get_environment().default,
60
+ method="GET",
61
+ params={
62
+ "prompt_variant_id": prompt_variant_id,
63
+ },
64
+ headers={
65
+ "Accept": "application/json",
66
+ },
67
+ request_options=request_options,
68
+ )
69
+ try:
70
+ if 200 <= _response.status_code < 300:
71
+ return typing.cast(
72
+ PromptExecConfig,
73
+ parse_obj_as(
74
+ type_=PromptExecConfig, # type: ignore
75
+ object_=_response.json(),
76
+ ),
77
+ )
78
+ if _response.status_code == 400:
79
+ raise BadRequestError(
80
+ typing.cast(
81
+ typing.Optional[typing.Any],
82
+ parse_obj_as(
83
+ type_=typing.Optional[typing.Any], # type: ignore
84
+ object_=_response.json(),
85
+ ),
86
+ )
87
+ )
88
+ if _response.status_code == 404:
89
+ raise NotFoundError(
90
+ typing.cast(
91
+ typing.Optional[typing.Any],
92
+ parse_obj_as(
93
+ type_=typing.Optional[typing.Any], # type: ignore
94
+ object_=_response.json(),
95
+ ),
96
+ )
97
+ )
98
+ _response_json = _response.json()
99
+ except JSONDecodeError:
100
+ raise ApiError(status_code=_response.status_code, body=_response.text)
101
+ raise ApiError(status_code=_response.status_code, body=_response_json)
102
+
103
+
104
+ class AsyncPromptsClient:
105
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
106
+ self._client_wrapper = client_wrapper
107
+
108
+ async def pull(
109
+ self,
110
+ id: str,
111
+ *,
112
+ prompt_variant_id: typing.Optional[str] = None,
113
+ request_options: typing.Optional[RequestOptions] = None,
114
+ ) -> PromptExecConfig:
115
+ """
116
+ Used to pull the definition of a Prompt from Vellum.
117
+
118
+ Parameters
119
+ ----------
120
+ id : str
121
+ The ID of the Prompt to pull from. Prompt Sandbox IDs are currently supported.
122
+
123
+ prompt_variant_id : typing.Optional[str]
124
+ The ID of the Prompt Variant within a Prompt Sandbox to pull. Must be included if providing the ID of a Prompt Sandbox.
125
+
126
+ request_options : typing.Optional[RequestOptions]
127
+ Request-specific configuration.
128
+
129
+ Returns
130
+ -------
131
+ PromptExecConfig
132
+
133
+
134
+ Examples
135
+ --------
136
+ import asyncio
137
+
138
+ from vellum import AsyncVellum
139
+
140
+ client = AsyncVellum(
141
+ api_key="YOUR_API_KEY",
142
+ )
143
+
144
+
145
+ async def main() -> None:
146
+ await client.prompts.pull(
147
+ id="id",
148
+ )
149
+
150
+
151
+ asyncio.run(main())
152
+ """
153
+ _response = await self._client_wrapper.httpx_client.request(
154
+ f"v1/prompts/{jsonable_encoder(id)}/pull",
155
+ base_url=self._client_wrapper.get_environment().default,
156
+ method="GET",
157
+ params={
158
+ "prompt_variant_id": prompt_variant_id,
159
+ },
160
+ headers={
161
+ "Accept": "application/json",
162
+ },
163
+ request_options=request_options,
164
+ )
165
+ try:
166
+ if 200 <= _response.status_code < 300:
167
+ return typing.cast(
168
+ PromptExecConfig,
169
+ parse_obj_as(
170
+ type_=PromptExecConfig, # type: ignore
171
+ object_=_response.json(),
172
+ ),
173
+ )
174
+ if _response.status_code == 400:
175
+ raise BadRequestError(
176
+ typing.cast(
177
+ typing.Optional[typing.Any],
178
+ parse_obj_as(
179
+ type_=typing.Optional[typing.Any], # type: ignore
180
+ object_=_response.json(),
181
+ ),
182
+ )
183
+ )
184
+ if _response.status_code == 404:
185
+ raise NotFoundError(
186
+ typing.cast(
187
+ typing.Optional[typing.Any],
188
+ parse_obj_as(
189
+ type_=typing.Optional[typing.Any], # type: ignore
190
+ object_=_response.json(),
191
+ ),
192
+ )
193
+ )
194
+ _response_json = _response.json()
195
+ except JSONDecodeError:
196
+ raise ApiError(status_code=_response.status_code, body=_response.text)
197
+ raise ApiError(status_code=_response.status_code, body=_response_json)
@@ -308,6 +308,7 @@ from .prompt_block_state import PromptBlockState
308
308
  from .prompt_deployment_expand_meta_request import PromptDeploymentExpandMetaRequest
309
309
  from .prompt_deployment_input_request import PromptDeploymentInputRequest
310
310
  from .prompt_deployment_parent_context import PromptDeploymentParentContext
311
+ from .prompt_exec_config import PromptExecConfig
311
312
  from .prompt_execution_meta import PromptExecutionMeta
312
313
  from .prompt_node_execution_meta import PromptNodeExecutionMeta
313
314
  from .prompt_node_result import PromptNodeResult
@@ -892,6 +893,7 @@ __all__ = [
892
893
  "PromptDeploymentExpandMetaRequest",
893
894
  "PromptDeploymentInputRequest",
894
895
  "PromptDeploymentParentContext",
896
+ "PromptExecConfig",
895
897
  "PromptExecutionMeta",
896
898
  "PromptNodeExecutionMeta",
897
899
  "PromptNodeResult",
@@ -0,0 +1,37 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from __future__ import annotations
4
+ from ..core.pydantic_utilities import UniversalBaseModel
5
+ from .array_vellum_value import ArrayVellumValue
6
+ from .chat_message_prompt_block import ChatMessagePromptBlock
7
+ import typing
8
+ from .vellum_variable import VellumVariable
9
+ from .prompt_parameters import PromptParameters
10
+ from .prompt_settings import PromptSettings
11
+ from .prompt_block import PromptBlock
12
+ from .function_definition import FunctionDefinition
13
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
14
+ import pydantic
15
+ from ..core.pydantic_utilities import update_forward_refs
16
+
17
+
18
+ class PromptExecConfig(UniversalBaseModel):
19
+ ml_model: str
20
+ input_variables: typing.List[VellumVariable]
21
+ parameters: PromptParameters
22
+ settings: typing.Optional[PromptSettings] = None
23
+ blocks: typing.List[PromptBlock]
24
+ functions: typing.Optional[typing.List[FunctionDefinition]] = None
25
+
26
+ if IS_PYDANTIC_V2:
27
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
28
+ else:
29
+
30
+ class Config:
31
+ frozen = True
32
+ smart_union = True
33
+ extra = pydantic.Extra.allow
34
+
35
+
36
+ update_forward_refs(ArrayVellumValue, PromptExecConfig=PromptExecConfig)
37
+ update_forward_refs(ChatMessagePromptBlock, PromptExecConfig=PromptExecConfig)
@@ -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.prompts 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.prompts.client 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.prompt_exec_config import *
@@ -52,19 +52,18 @@ class GuardrailNode(BaseNode[StateType], Generic[StateType]):
52
52
  message="Metric execution must have one output named 'score' with type 'float'",
53
53
  code=WorkflowErrorCode.INVALID_OUTPUTS,
54
54
  )
55
-
56
- log = metric_outputs.get("log")
57
-
58
- if log is not None and not isinstance(log, str):
59
- raise NodeException(
60
- message="Metric execution log output must be of type 'str'",
61
- code=WorkflowErrorCode.INVALID_OUTPUTS,
62
- )
63
- if log:
64
- metric_outputs.pop("log")
65
-
66
55
  metric_outputs.pop("score")
67
56
 
57
+ if "log" in metric_outputs:
58
+ log = metric_outputs.pop("log") or ""
59
+ if not isinstance(log, str):
60
+ raise NodeException(
61
+ message="Metric execution log output must be of type 'str'",
62
+ code=WorkflowErrorCode.INVALID_OUTPUTS,
63
+ )
64
+ else:
65
+ log = None
66
+
68
67
  return self.Outputs(score=score, log=log, **metric_outputs)
69
68
 
70
69
  def _compile_metric_inputs(self) -> List[MetricDefinitionInput]:
@@ -0,0 +1,38 @@
1
+ import pytest
2
+
3
+ from vellum import TestSuiteRunMetricNumberOutput
4
+ from vellum.client.types.metric_definition_execution import MetricDefinitionExecution
5
+ from vellum.client.types.test_suite_run_metric_string_output import TestSuiteRunMetricStringOutput
6
+ from vellum.workflows.nodes.displayable.guardrail_node.node import GuardrailNode
7
+
8
+
9
+ @pytest.mark.parametrize("log_value", [None, ""], ids=["None", "Empty"])
10
+ def test_run_guardrail_node__empty_log(vellum_client, log_value):
11
+ """Confirm that we can successfully invoke a Guardrail Node"""
12
+
13
+ # GIVEN a Guardrail Node
14
+ class MyGuard(GuardrailNode):
15
+ metric_definition = "example_metric_definition"
16
+ metric_inputs = {}
17
+
18
+ # AND we know that the guardrail node will return a blank log
19
+ mock_metric_execution = MetricDefinitionExecution(
20
+ outputs=[
21
+ TestSuiteRunMetricNumberOutput(
22
+ name="score",
23
+ value=0.6,
24
+ ),
25
+ TestSuiteRunMetricStringOutput(
26
+ name="log",
27
+ value=log_value,
28
+ ),
29
+ ],
30
+ )
31
+ vellum_client.metric_definitions.execute_metric_definition.return_value = mock_metric_execution
32
+
33
+ # WHEN we run the Guardrail Node
34
+ outputs = MyGuard().run()
35
+
36
+ # THEN the workflow should have completed successfully
37
+ assert outputs.score == 0.6
38
+ assert outputs.log == ""
@@ -321,6 +321,7 @@ class WorkflowRunner(Generic[StateType]):
321
321
  )
322
322
  )
323
323
  except NodeException as e:
324
+ logger.info(e)
324
325
  self._workflow_event_inner_queue.put(
325
326
  NodeExecutionRejectedEvent(
326
327
  trace_id=node.state.meta.trace_id,
@@ -333,6 +334,7 @@ class WorkflowRunner(Generic[StateType]):
333
334
  )
334
335
  )
335
336
  except WorkflowInitializationException as e:
337
+ logger.info(e)
336
338
  self._workflow_event_inner_queue.put(
337
339
  NodeExecutionRejectedEvent(
338
340
  trace_id=node.state.meta.trace_id,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vellum-ai
3
- Version: 0.14.26
3
+ Version: 0.14.27
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.9,<4.0
@@ -121,18 +121,18 @@ vellum_ee/workflows/tests/local_workflow/nodes/final_output.py,sha256=ZX7zBv87zi
121
121
  vellum_ee/workflows/tests/local_workflow/nodes/templating_node.py,sha256=NQwFN61QkHfI3Vssz-B0NKGfupK8PU0FDSAIAhYBLi0,325
122
122
  vellum_ee/workflows/tests/local_workflow/workflow.py,sha256=A4qOzOPNwePYxWbcAgIPLsmrVS_aVEZEc-wULSv787Q,393
123
123
  vellum_ee/workflows/tests/test_display_meta.py,sha256=C25dErwghPNXio49pvSRxyOuc96srH6eYEwTAWdE2zY,2258
124
- vellum_ee/workflows/tests/test_server.py,sha256=IWqjJXSbVFuV3w6b9lB3N6yoVAHJicmJuubASvw5QQM,2276
124
+ vellum_ee/workflows/tests/test_server.py,sha256=2za_EEIRgmep4motFI-UIEeGU0EvlFpo1G9B8ZfbISw,3841
125
125
  vellum_ee/workflows/tests/test_virtual_files.py,sha256=TJEcMR0v2S8CkloXNmCHA0QW0K6pYNGaIjraJz7sFvY,2762
126
- vellum/__init__.py,sha256=NhD0OIit3WcTPXjWnLKErRlSzNN_K0WM8fWunk5SybE,40396
126
+ vellum/__init__.py,sha256=88-79I29hBTQvR1uH_BOCGMWuj2a4Nx82R_8KIESg28,40470
127
127
  vellum/client/README.md,sha256=JkCJjmMZl4jrPj46pkmL9dpK4gSzQQmP5I7z4aME4LY,4749
128
- vellum/client/__init__.py,sha256=tKtdM1_GqmGq1gpi9ydWD_T-MM7fPn8QdHh8ww19cNI,117564
128
+ vellum/client/__init__.py,sha256=Jv9sI5BNFo2OYA9px_aREFSIp655ryC3eaZSRI6yH1k,117826
129
129
  vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
130
130
  vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
131
- vellum/client/core/client_wrapper.py,sha256=1wWo_Rb2vE2CNr--h4FyLmfr9mFgKq67hlfzKHAc2TE,1869
131
+ vellum/client/core/client_wrapper.py,sha256=lLWC2w0e3KTAB1BDko4CdDRGR3x7RCpVB3NoA4E1TQo,1869
132
132
  vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
133
133
  vellum/client/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
134
134
  vellum/client/core/http_client.py,sha256=R0pQpCppnEtxccGvXl4uJ76s7ro_65Fo_erlNNLp_AI,19228
135
- vellum/client/core/jsonable_encoder.py,sha256=qaF1gtgH-kQZb4kJskETwcCsOPUof-NnYVdszHkb-dM,3656
135
+ vellum/client/core/jsonable_encoder.py,sha256=ZZad_lvQK-HJ8EWAvpPI8clvao8L_G5YcCbi2gq0kOI,3660
136
136
  vellum/client/core/pydantic_utilities.py,sha256=6ev3gtER-hjlq7PcPL9XT_YSCdgyCE8ZKHJ9Uc-gHIg,12071
137
137
  vellum/client/core/query_encoder.py,sha256=ekulqNd0j8TgD7ox-Qbz7liqX8-KP9blvT9DsRCenYM,2144
138
138
  vellum/client/core/remove_none_from_dict.py,sha256=EU9SGgYidWq7SexuJbNs4-PZ-5Bl3Vppd864mS6vQZw,342
@@ -144,7 +144,7 @@ vellum/client/errors/bad_request_error.py,sha256=_EbO8mWqN9kFZPvIap8qa1lL_EWkRcs
144
144
  vellum/client/errors/forbidden_error.py,sha256=QO1kKlhClAPES6zsEK7g9pglWnxn3KWaOCAawWOg6Aw,263
145
145
  vellum/client/errors/internal_server_error.py,sha256=8USCagXyJJ1MOm9snpcXIUt6eNXvrd_aq7Gfcu1vlOI,268
146
146
  vellum/client/errors/not_found_error.py,sha256=tBVCeBC8n3C811WHRj_n-hs3h8MqwR5gp0vLiobk7W8,262
147
- vellum/client/resources/__init__.py,sha256=LzmnnOhM6oxD2Gt9cEotCkbVKywV_GH85-lEAERQG1o,1483
147
+ vellum/client/resources/__init__.py,sha256=UcVAa7Iwo6e5ijqrraBlDlUA5wnXYVfRMJwXGJkz8UM,1511
148
148
  vellum/client/resources/ad_hoc/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
149
149
  vellum/client/resources/ad_hoc/client.py,sha256=_liorv4AsoJ55kVu0a5oWB3Qeff0iUKXqoHEIyDWLxc,14173
150
150
  vellum/client/resources/container_images/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
@@ -170,6 +170,8 @@ vellum/client/resources/ml_models/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8
170
170
  vellum/client/resources/ml_models/client.py,sha256=XIYapTEY6GRNr7V0Kjy5bEeKmrhv9ul8qlQY2A5LFqQ,3872
171
171
  vellum/client/resources/organizations/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
172
172
  vellum/client/resources/organizations/client.py,sha256=Uye92moqjAcOCs4astmuFpT92QdC5SLMunA-C8_G-gA,3675
173
+ vellum/client/resources/prompts/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
174
+ vellum/client/resources/prompts/client.py,sha256=_rNTUjhl_ZF3vyQa_M1BSTrX4DlFXU_SXkwwCEYKD2s,6598
173
175
  vellum/client/resources/sandboxes/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
174
176
  vellum/client/resources/sandboxes/client.py,sha256=i-6DHap5k6gFcYS-kWI8ayJFVZxb-GENRft6BJwVam4,17158
175
177
  vellum/client/resources/test_suite_runs/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
@@ -191,7 +193,7 @@ vellum/client/resources/workspace_secrets/__init__.py,sha256=FTtvy8EDg9nNNg9WCat
191
193
  vellum/client/resources/workspace_secrets/client.py,sha256=h7UzXLyTttPq1t-JZGMg1BWxypxJvBGUdqg7KGT7MK4,8027
192
194
  vellum/client/resources/workspaces/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
193
195
  vellum/client/resources/workspaces/client.py,sha256=RthwzN1o-Jxwg5yyNNodavFyNUSxfLoTv26w3mRR5g8,3595
194
- vellum/client/types/__init__.py,sha256=aiQpSDBi__mK4Lqi2kzc9Cp0LcrOI_TOHoq4FHK5zDE,61186
196
+ vellum/client/types/__init__.py,sha256=MUfv33R5OwoLX1dHVETCtWFNM3Xz-jWPJ2Z8ZrXlLqM,61259
195
197
  vellum/client/types/ad_hoc_execute_prompt_event.py,sha256=bCjujA2XsOgyF3bRZbcEqV2rOIymRgsLoIRtZpB14xg,607
196
198
  vellum/client/types/ad_hoc_expand_meta.py,sha256=1gv-NCsy_6xBYupLvZH979yf2VMdxAU-l0y0ynMKZaw,1331
197
199
  vellum/client/types/ad_hoc_fulfilled_prompt_execution_meta.py,sha256=Bfvf1d_dkmshxRACVM5vcxbH_7AQY23RmrrnPc0ytYY,939
@@ -488,6 +490,7 @@ vellum/client/types/prompt_block_state.py,sha256=BRAzTYARoSU36IVZGWMeeqhl5fgFMXC
488
490
  vellum/client/types/prompt_deployment_expand_meta_request.py,sha256=agsiAaHB6lDoZPlnfJ2nmhB4Ud4EiJJTX05YmduyCPo,1910
489
491
  vellum/client/types/prompt_deployment_input_request.py,sha256=KrT4-Ew2VvTWXEkYQz2oyHn5EDOgrMW7FzRFaPH3ARg,353
490
492
  vellum/client/types/prompt_deployment_parent_context.py,sha256=eu8dYmRb789uZeFVzbRkJrErDYZXo35f2qaNBcY0wOQ,2319
493
+ vellum/client/types/prompt_exec_config.py,sha256=kthvyEe-IzfTpOBd1fYrczHuxD-v7k6cwjmuaY170RQ,1390
491
494
  vellum/client/types/prompt_execution_meta.py,sha256=3hhMZgdAR5mKfnh2e_eVN3oKfT0E9w26khVPrpjn7jk,1141
492
495
  vellum/client/types/prompt_node_execution_meta.py,sha256=IyWH__nCp5uwS0N32b2ZEsA-Fv7AZDB4nnlRZayU2Gc,888
493
496
  vellum/client/types/prompt_node_result.py,sha256=3jewO-nPodoXTq_5RxgwhKfDZrvoPjRZ_vUXLeqiuHY,749
@@ -822,6 +825,8 @@ vellum/resources/ml_models/__init__.py,sha256=qIepoIEWDHz3u7i0bW3jnTpdTdfPGhA1LB
822
825
  vellum/resources/ml_models/client.py,sha256=RSYFEe1BnFTDBMur2_eR3ZkLZbdWeTGe_OIuMwcsfdw,158
823
826
  vellum/resources/organizations/__init__.py,sha256=FD1umjszsErkQIAI6aZ7Lv_T6iN5IafeCbgv25uIpYo,155
824
827
  vellum/resources/organizations/client.py,sha256=68HAX4pswpJDH0-Yjc3teoloSJBUGRv8O1V8tCqFSuk,162
828
+ vellum/resources/prompts/__init__.py,sha256=CtN_jI0nc0C3yqxUPR1uWs5Mvxhlce5c-d8E96GVt4g,149
829
+ vellum/resources/prompts/client.py,sha256=9S00NNuuiz41m6-kOL6KCxu9bnYMORrXrXVWfFEeW5o,156
825
830
  vellum/resources/sandboxes/__init__.py,sha256=sycp4Bgvj9GzBGjiXhtmKFjOdBsIoDfMFaQrvDK_lGo,151
826
831
  vellum/resources/sandboxes/client.py,sha256=PBpYOg43HN-9B4YKtPqmE1aFag39ypLc5UWSxixUJjo,158
827
832
  vellum/resources/test_suite_runs/__init__.py,sha256=PfRYjodfN_rYZlUTiBnVXxdwQNcdmI-qT6MCqubd3ug,157
@@ -1140,6 +1145,7 @@ vellum/types/prompt_block_state.py,sha256=tKqNrZnHWjvfGS_6oIUTpdCPGxvRJa31Le6qWL
1140
1145
  vellum/types/prompt_deployment_expand_meta_request.py,sha256=5dBdvjjK9zCKxrPMdKQPj6iG8A06GAlb_zazde6qZsU,175
1141
1146
  vellum/types/prompt_deployment_input_request.py,sha256=z8CxCZWnKW8BBZajQ6iDnz-2gaxU-FrnYrVe_MvC3FU,169
1142
1147
  vellum/types/prompt_deployment_parent_context.py,sha256=U9X9PvXhG6ZUE8RxLrH13xfqKvs3DOwbxzWmujoXTbg,170
1148
+ vellum/types/prompt_exec_config.py,sha256=aNeOGDi6l2rVzvkFt8CJE6L3W2EmY8gZaSb5051w8as,156
1143
1149
  vellum/types/prompt_execution_meta.py,sha256=_5izDjusf-TM69zKhvXr5EHH4Fx9jfWkg8F5_KNJV-w,159
1144
1150
  vellum/types/prompt_node_execution_meta.py,sha256=cJoHlIn_lb_sLpQniB8eszRJvFI6mJij9QgUIiKtiCY,164
1145
1151
  vellum/types/prompt_node_result.py,sha256=9ootTTh8lscQ-0WE0-bqdmn7XFvpP7uavO-g7mPkA3Q,156
@@ -1551,7 +1557,8 @@ vellum/workflows/nodes/displayable/final_output_node/node.py,sha256=PuQ0RvtAmoSI
1551
1557
  vellum/workflows/nodes/displayable/final_output_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1552
1558
  vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py,sha256=E6LQ74qZjY4Xi4avx2qdOCgGhF8pEcNLBh8cqYRkzMI,709
1553
1559
  vellum/workflows/nodes/displayable/guardrail_node/__init__.py,sha256=Ab5eXmOoBhyV4dMWdzh32HLUmnPIBEK_zFCT38C4Fng,68
1554
- vellum/workflows/nodes/displayable/guardrail_node/node.py,sha256=g6xG2-fEKGxYtJwbex1X5IodP3cJ7DqSthi80d2-Lo4,4395
1560
+ vellum/workflows/nodes/displayable/guardrail_node/node.py,sha256=YMXBLHB4_TYWGvbWMQP2WH0ckktK1uFDOEYkRJc-RfE,4422
1561
+ vellum/workflows/nodes/displayable/guardrail_node/test_node.py,sha256=1yPIAt4_GWiUKT6u3rTW2XKp62b8xG8Jj3JWeCm5ZDM,1368
1555
1562
  vellum/workflows/nodes/displayable/inline_prompt_node/__init__.py,sha256=gSUOoEZLlrx35-tQhSAd3An8WDwBqyiQh-sIebLU9wU,74
1556
1563
  vellum/workflows/nodes/displayable/inline_prompt_node/node.py,sha256=8RXZqWMzViUjFfbpmcy1gkSsKnEpci8BGwsuPYv4xMQ,3380
1557
1564
  vellum/workflows/nodes/displayable/inline_prompt_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1607,7 +1614,7 @@ vellum/workflows/references/workflow_input.py,sha256=lq7BiiLBHQNP-vP2p1TN2QBq0_L
1607
1614
  vellum/workflows/resolvers/__init__.py,sha256=eH6hTvZO4IciDaf_cf7aM2vs-DkBDyJPycOQevJxQnI,82
1608
1615
  vellum/workflows/resolvers/base.py,sha256=WHra9LRtlTuB1jmuNqkfVE2JUgB61Cyntn8f0b0WZg4,411
1609
1616
  vellum/workflows/runner/__init__.py,sha256=i1iG5sAhtpdsrlvwgH6B-m49JsINkiWyPWs8vyT-bqM,72
1610
- vellum/workflows/runner/runner.py,sha256=pK_cRWS75x_sX7zrnltz3IykCTgoAWA7AW19Ih5BaB4,31759
1617
+ vellum/workflows/runner/runner.py,sha256=ww4fjZJBENkB5HJxdj92kTz7k_EyifCeAreupy5qIxs,31813
1611
1618
  vellum/workflows/sandbox.py,sha256=GVJzVjMuYzOBnSrboB0_6MMRZWBluAyQ2o7syeaeBd0,2235
1612
1619
  vellum/workflows/state/__init__.py,sha256=yUUdR-_Vl7UiixNDYQZ-GEM_kJI9dnOia75TtuNEsnE,60
1613
1620
  vellum/workflows/state/base.py,sha256=Vkhneko3VlQrPsMLU1PYSzXU_W1u7_AraJsghiv5O-4,15512
@@ -1643,8 +1650,8 @@ vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnad
1643
1650
  vellum/workflows/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1644
1651
  vellum/workflows/workflows/tests/test_base_workflow.py,sha256=tCxrV3QBHL8wfdEO3bvKteDdw32xBlUl1_WxkAwaONw,8344
1645
1652
  vellum/workflows/workflows/tests/test_context.py,sha256=VJBUcyWVtMa_lE5KxdhgMu0WYNYnUQUDvTF7qm89hJ0,2333
1646
- vellum_ai-0.14.26.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1647
- vellum_ai-0.14.26.dist-info/METADATA,sha256=LajPvDTo4iXyXPY7rs0OTu7CXWL8oZHb9tb3c58XP5g,5484
1648
- vellum_ai-0.14.26.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1649
- vellum_ai-0.14.26.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1650
- vellum_ai-0.14.26.dist-info/RECORD,,
1653
+ vellum_ai-0.14.27.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1654
+ vellum_ai-0.14.27.dist-info/METADATA,sha256=DgLbQNMAj3437pSlt-7jgoO88Km4cBlRqqabwpj85jc,5484
1655
+ vellum_ai-0.14.27.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1656
+ vellum_ai-0.14.27.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1657
+ vellum_ai-0.14.27.dist-info/RECORD,,
@@ -1,3 +1,4 @@
1
+ import pytest
1
2
  import sys
2
3
  from uuid import uuid4
3
4
  from typing import Type, cast
@@ -69,3 +70,56 @@ class StartNode(BaseNode):
69
70
  # AND the lazy reference has the correct name
70
71
  assert start_node.foo.instance
71
72
  assert start_node.foo.instance.name == "StartNode.Outputs.bar"
73
+
74
+
75
+ @pytest.mark.skip(reason="Code execution inspect and get read file from path needs to be fixed")
76
+ def test_load_from_module__ts_code_in_file_loader():
77
+ # GIVEN a workflow module with only a code execution node
78
+ files = {
79
+ "__init__.py": "",
80
+ "workflow.py": """\
81
+ from vellum.workflows import BaseWorkflow
82
+ from .nodes.code_execution_node import CodeExecutionNode
83
+
84
+ class Workflow(BaseWorkflow):
85
+ graph = CodeExecutionNode
86
+ """,
87
+ "nodes/__init__.py": """\
88
+ from .code_execution_node import CodeExecutionNode
89
+
90
+ __all__ = ["CodeExecutionNode"]
91
+ """,
92
+ "nodes/code_execution_node.py": """\
93
+ from typing import Any
94
+
95
+ from vellum.workflows.nodes.displayable import CodeExecutionNode as BaseCodeExecutionNode
96
+ from vellum.workflows.state import BaseState
97
+
98
+ class CodeExecutionNode(BaseCodeExecutionNode[BaseState, Any]):
99
+ filepath = "./script.ts"
100
+ code_inputs = {}
101
+ runtime = "TYPESCRIPT_5_3_3"
102
+ packages = []
103
+ """,
104
+ "nodes/code_execution_node/script.ts": """async function main(inputs: {
105
+ text: string,
106
+ }): any {
107
+ const matches = inputs.text.match(/\\((.+?)\\)/gs);
108
+ return matches;
109
+ }""",
110
+ }
111
+
112
+ namespace = str(uuid4())
113
+
114
+ # AND the virtual file loader is registered
115
+ sys.meta_path.append(VirtualFileFinder(files, namespace))
116
+
117
+ # WHEN the workflow is loaded
118
+ Workflow = BaseWorkflow.load_from_module(namespace)
119
+ workflow = Workflow()
120
+
121
+ # THEN the workflow is successfully initialized
122
+ assert workflow
123
+
124
+ event = workflow.run()
125
+ assert event.name == "workflow.execution.fulfilled"