vellum-ai 1.4.1__py3-none-any.whl → 1.5.0__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 +14 -0
- vellum/client/__init__.py +3 -0
- vellum/client/core/client_wrapper.py +2 -2
- vellum/client/reference.md +160 -0
- vellum/client/resources/__init__.py +2 -0
- vellum/client/resources/integrations/__init__.py +4 -0
- vellum/client/resources/integrations/client.py +260 -0
- vellum/client/resources/integrations/raw_client.py +267 -0
- vellum/client/types/__init__.py +12 -0
- vellum/client/types/components_schemas_composio_execute_tool_request.py +5 -0
- vellum/client/types/components_schemas_composio_execute_tool_response.py +5 -0
- vellum/client/types/components_schemas_composio_tool_definition.py +5 -0
- vellum/client/types/composio_execute_tool_request.py +24 -0
- vellum/client/types/composio_execute_tool_response.py +24 -0
- vellum/client/types/composio_tool_definition.py +26 -0
- vellum/client/types/vellum_error_code_enum.py +2 -0
- vellum/client/types/vellum_sdk_error.py +1 -0
- vellum/client/types/workflow_event_error.py +1 -0
- vellum/resources/integrations/__init__.py +3 -0
- vellum/resources/integrations/client.py +3 -0
- vellum/resources/integrations/raw_client.py +3 -0
- vellum/types/components_schemas_composio_execute_tool_request.py +3 -0
- vellum/types/components_schemas_composio_execute_tool_response.py +3 -0
- vellum/types/components_schemas_composio_tool_definition.py +3 -0
- vellum/types/composio_execute_tool_request.py +3 -0
- vellum/types/composio_execute_tool_response.py +3 -0
- vellum/types/composio_tool_definition.py +3 -0
- vellum/workflows/constants.py +4 -0
- vellum/workflows/emitters/base.py +8 -0
- vellum/workflows/emitters/vellum_emitter.py +10 -0
- vellum/workflows/inputs/dataset_row.py +2 -2
- vellum/workflows/nodes/bases/base.py +12 -1
- vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py +6 -0
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +16 -2
- vellum/workflows/nodes/displayable/final_output_node/node.py +59 -0
- vellum/workflows/nodes/displayable/final_output_node/tests/test_node.py +40 -1
- vellum/workflows/nodes/displayable/tool_calling_node/node.py +3 -0
- vellum/workflows/nodes/displayable/tool_calling_node/tests/test_utils.py +64 -0
- vellum/workflows/nodes/displayable/tool_calling_node/utils.py +30 -41
- vellum/workflows/runner/runner.py +132 -110
- vellum/workflows/tests/test_dataset_row.py +29 -0
- vellum/workflows/types/core.py +13 -2
- vellum/workflows/types/definition.py +13 -1
- vellum/workflows/utils/functions.py +69 -27
- vellum/workflows/utils/tests/test_functions.py +50 -6
- vellum/workflows/vellum_client.py +7 -1
- vellum/workflows/workflows/base.py +26 -4
- vellum/workflows/workflows/tests/test_base_workflow.py +54 -0
- {vellum_ai-1.4.1.dist-info → vellum_ai-1.5.0.dist-info}/METADATA +1 -1
- {vellum_ai-1.4.1.dist-info → vellum_ai-1.5.0.dist-info}/RECORD +63 -42
- vellum_ai-1.5.0.dist-info/entry_points.txt +4 -0
- vellum_cli/tests/test_pull.py +1 -0
- vellum_cli/tests/test_push.py +2 -0
- vellum_ee/assets/node-definitions.json +483 -0
- vellum_ee/scripts/generate_node_definitions.py +89 -0
- vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py +1 -3
- vellum_ee/workflows/display/nodes/vellum/tests/test_final_output_node.py +78 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_inline_workflow_serialization.py +5 -0
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_tool_calling_node_serialization.py +5 -0
- vellum_ee/workflows/display/types.py +3 -0
- vellum_ee/workflows/display/workflows/base_workflow_display.py +6 -0
- vellum_ai-1.4.1.dist-info/entry_points.txt +0 -3
- {vellum_ai-1.4.1.dist-info → vellum_ai-1.5.0.dist-info}/LICENSE +0 -0
- {vellum_ai-1.4.1.dist-info → vellum_ai-1.5.0.dist-info}/WHEEL +0 -0
@@ -0,0 +1,267 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
from json.decoder import JSONDecodeError
|
5
|
+
|
6
|
+
from ...core.api_error import ApiError
|
7
|
+
from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
8
|
+
from ...core.http_response import AsyncHttpResponse, HttpResponse
|
9
|
+
from ...core.jsonable_encoder import jsonable_encoder
|
10
|
+
from ...core.pydantic_utilities import parse_obj_as
|
11
|
+
from ...core.request_options import RequestOptions
|
12
|
+
from ...errors.bad_request_error import BadRequestError
|
13
|
+
from ...types.components_schemas_composio_execute_tool_response import ComponentsSchemasComposioExecuteToolResponse
|
14
|
+
from ...types.components_schemas_composio_tool_definition import ComponentsSchemasComposioToolDefinition
|
15
|
+
|
16
|
+
# this is used as the default value for optional parameters
|
17
|
+
OMIT = typing.cast(typing.Any, ...)
|
18
|
+
|
19
|
+
|
20
|
+
class RawIntegrationsClient:
|
21
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
22
|
+
self._client_wrapper = client_wrapper
|
23
|
+
|
24
|
+
def retrieve_integration_tool_definition(
|
25
|
+
self,
|
26
|
+
integration: str,
|
27
|
+
provider: str,
|
28
|
+
tool_name: str,
|
29
|
+
*,
|
30
|
+
request_options: typing.Optional[RequestOptions] = None,
|
31
|
+
) -> HttpResponse[ComponentsSchemasComposioToolDefinition]:
|
32
|
+
"""
|
33
|
+
Parameters
|
34
|
+
----------
|
35
|
+
integration : str
|
36
|
+
The integration name
|
37
|
+
|
38
|
+
provider : str
|
39
|
+
The integration provider name
|
40
|
+
|
41
|
+
tool_name : str
|
42
|
+
The tool's unique name, as specified by the integration provider
|
43
|
+
|
44
|
+
request_options : typing.Optional[RequestOptions]
|
45
|
+
Request-specific configuration.
|
46
|
+
|
47
|
+
Returns
|
48
|
+
-------
|
49
|
+
HttpResponse[ComponentsSchemasComposioToolDefinition]
|
50
|
+
|
51
|
+
"""
|
52
|
+
_response = self._client_wrapper.httpx_client.request(
|
53
|
+
f"integrations/v1/providers/{jsonable_encoder(provider)}/integrations/{jsonable_encoder(integration)}/tools/{jsonable_encoder(tool_name)}",
|
54
|
+
base_url=self._client_wrapper.get_environment().default,
|
55
|
+
method="GET",
|
56
|
+
request_options=request_options,
|
57
|
+
)
|
58
|
+
try:
|
59
|
+
if 200 <= _response.status_code < 300:
|
60
|
+
_data = typing.cast(
|
61
|
+
ComponentsSchemasComposioToolDefinition,
|
62
|
+
parse_obj_as(
|
63
|
+
type_=ComponentsSchemasComposioToolDefinition, # type: ignore
|
64
|
+
object_=_response.json(),
|
65
|
+
),
|
66
|
+
)
|
67
|
+
return HttpResponse(response=_response, data=_data)
|
68
|
+
_response_json = _response.json()
|
69
|
+
except JSONDecodeError:
|
70
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
71
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
72
|
+
|
73
|
+
def execute_integration_tool(
|
74
|
+
self,
|
75
|
+
integration: str,
|
76
|
+
provider: str,
|
77
|
+
tool_name: str,
|
78
|
+
*,
|
79
|
+
arguments: typing.Dict[str, typing.Optional[typing.Any]],
|
80
|
+
request_options: typing.Optional[RequestOptions] = None,
|
81
|
+
) -> HttpResponse[ComponentsSchemasComposioExecuteToolResponse]:
|
82
|
+
"""
|
83
|
+
Parameters
|
84
|
+
----------
|
85
|
+
integration : str
|
86
|
+
The integration name
|
87
|
+
|
88
|
+
provider : str
|
89
|
+
The integration provider name
|
90
|
+
|
91
|
+
tool_name : str
|
92
|
+
The tool's unique name, as specified by the integration provider
|
93
|
+
|
94
|
+
arguments : typing.Dict[str, typing.Optional[typing.Any]]
|
95
|
+
|
96
|
+
request_options : typing.Optional[RequestOptions]
|
97
|
+
Request-specific configuration.
|
98
|
+
|
99
|
+
Returns
|
100
|
+
-------
|
101
|
+
HttpResponse[ComponentsSchemasComposioExecuteToolResponse]
|
102
|
+
|
103
|
+
"""
|
104
|
+
_response = self._client_wrapper.httpx_client.request(
|
105
|
+
f"integrations/v1/providers/{jsonable_encoder(provider)}/integrations/{jsonable_encoder(integration)}/tools/{jsonable_encoder(tool_name)}/execute",
|
106
|
+
base_url=self._client_wrapper.get_environment().default,
|
107
|
+
method="POST",
|
108
|
+
json={
|
109
|
+
"arguments": arguments,
|
110
|
+
"provider": "COMPOSIO",
|
111
|
+
},
|
112
|
+
headers={
|
113
|
+
"content-type": "application/json",
|
114
|
+
},
|
115
|
+
request_options=request_options,
|
116
|
+
omit=OMIT,
|
117
|
+
)
|
118
|
+
try:
|
119
|
+
if 200 <= _response.status_code < 300:
|
120
|
+
_data = typing.cast(
|
121
|
+
ComponentsSchemasComposioExecuteToolResponse,
|
122
|
+
parse_obj_as(
|
123
|
+
type_=ComponentsSchemasComposioExecuteToolResponse, # type: ignore
|
124
|
+
object_=_response.json(),
|
125
|
+
),
|
126
|
+
)
|
127
|
+
return HttpResponse(response=_response, data=_data)
|
128
|
+
if _response.status_code == 400:
|
129
|
+
raise BadRequestError(
|
130
|
+
headers=dict(_response.headers),
|
131
|
+
body=typing.cast(
|
132
|
+
typing.Optional[typing.Any],
|
133
|
+
parse_obj_as(
|
134
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
135
|
+
object_=_response.json(),
|
136
|
+
),
|
137
|
+
),
|
138
|
+
)
|
139
|
+
_response_json = _response.json()
|
140
|
+
except JSONDecodeError:
|
141
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
142
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
143
|
+
|
144
|
+
|
145
|
+
class AsyncRawIntegrationsClient:
|
146
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
147
|
+
self._client_wrapper = client_wrapper
|
148
|
+
|
149
|
+
async def retrieve_integration_tool_definition(
|
150
|
+
self,
|
151
|
+
integration: str,
|
152
|
+
provider: str,
|
153
|
+
tool_name: str,
|
154
|
+
*,
|
155
|
+
request_options: typing.Optional[RequestOptions] = None,
|
156
|
+
) -> AsyncHttpResponse[ComponentsSchemasComposioToolDefinition]:
|
157
|
+
"""
|
158
|
+
Parameters
|
159
|
+
----------
|
160
|
+
integration : str
|
161
|
+
The integration name
|
162
|
+
|
163
|
+
provider : str
|
164
|
+
The integration provider name
|
165
|
+
|
166
|
+
tool_name : str
|
167
|
+
The tool's unique name, as specified by the integration provider
|
168
|
+
|
169
|
+
request_options : typing.Optional[RequestOptions]
|
170
|
+
Request-specific configuration.
|
171
|
+
|
172
|
+
Returns
|
173
|
+
-------
|
174
|
+
AsyncHttpResponse[ComponentsSchemasComposioToolDefinition]
|
175
|
+
|
176
|
+
"""
|
177
|
+
_response = await self._client_wrapper.httpx_client.request(
|
178
|
+
f"integrations/v1/providers/{jsonable_encoder(provider)}/integrations/{jsonable_encoder(integration)}/tools/{jsonable_encoder(tool_name)}",
|
179
|
+
base_url=self._client_wrapper.get_environment().default,
|
180
|
+
method="GET",
|
181
|
+
request_options=request_options,
|
182
|
+
)
|
183
|
+
try:
|
184
|
+
if 200 <= _response.status_code < 300:
|
185
|
+
_data = typing.cast(
|
186
|
+
ComponentsSchemasComposioToolDefinition,
|
187
|
+
parse_obj_as(
|
188
|
+
type_=ComponentsSchemasComposioToolDefinition, # type: ignore
|
189
|
+
object_=_response.json(),
|
190
|
+
),
|
191
|
+
)
|
192
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
193
|
+
_response_json = _response.json()
|
194
|
+
except JSONDecodeError:
|
195
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
196
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
197
|
+
|
198
|
+
async def execute_integration_tool(
|
199
|
+
self,
|
200
|
+
integration: str,
|
201
|
+
provider: str,
|
202
|
+
tool_name: str,
|
203
|
+
*,
|
204
|
+
arguments: typing.Dict[str, typing.Optional[typing.Any]],
|
205
|
+
request_options: typing.Optional[RequestOptions] = None,
|
206
|
+
) -> AsyncHttpResponse[ComponentsSchemasComposioExecuteToolResponse]:
|
207
|
+
"""
|
208
|
+
Parameters
|
209
|
+
----------
|
210
|
+
integration : str
|
211
|
+
The integration name
|
212
|
+
|
213
|
+
provider : str
|
214
|
+
The integration provider name
|
215
|
+
|
216
|
+
tool_name : str
|
217
|
+
The tool's unique name, as specified by the integration provider
|
218
|
+
|
219
|
+
arguments : typing.Dict[str, typing.Optional[typing.Any]]
|
220
|
+
|
221
|
+
request_options : typing.Optional[RequestOptions]
|
222
|
+
Request-specific configuration.
|
223
|
+
|
224
|
+
Returns
|
225
|
+
-------
|
226
|
+
AsyncHttpResponse[ComponentsSchemasComposioExecuteToolResponse]
|
227
|
+
|
228
|
+
"""
|
229
|
+
_response = await self._client_wrapper.httpx_client.request(
|
230
|
+
f"integrations/v1/providers/{jsonable_encoder(provider)}/integrations/{jsonable_encoder(integration)}/tools/{jsonable_encoder(tool_name)}/execute",
|
231
|
+
base_url=self._client_wrapper.get_environment().default,
|
232
|
+
method="POST",
|
233
|
+
json={
|
234
|
+
"arguments": arguments,
|
235
|
+
"provider": "COMPOSIO",
|
236
|
+
},
|
237
|
+
headers={
|
238
|
+
"content-type": "application/json",
|
239
|
+
},
|
240
|
+
request_options=request_options,
|
241
|
+
omit=OMIT,
|
242
|
+
)
|
243
|
+
try:
|
244
|
+
if 200 <= _response.status_code < 300:
|
245
|
+
_data = typing.cast(
|
246
|
+
ComponentsSchemasComposioExecuteToolResponse,
|
247
|
+
parse_obj_as(
|
248
|
+
type_=ComponentsSchemasComposioExecuteToolResponse, # type: ignore
|
249
|
+
object_=_response.json(),
|
250
|
+
),
|
251
|
+
)
|
252
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
253
|
+
if _response.status_code == 400:
|
254
|
+
raise BadRequestError(
|
255
|
+
headers=dict(_response.headers),
|
256
|
+
body=typing.cast(
|
257
|
+
typing.Optional[typing.Any],
|
258
|
+
parse_obj_as(
|
259
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
260
|
+
object_=_response.json(),
|
261
|
+
),
|
262
|
+
),
|
263
|
+
)
|
264
|
+
_response_json = _response.json()
|
265
|
+
except JSONDecodeError:
|
266
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
267
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
vellum/client/types/__init__.py
CHANGED
@@ -72,9 +72,15 @@ from .code_executor_secret_input import CodeExecutorSecretInput
|
|
72
72
|
from .code_resource_definition import CodeResourceDefinition
|
73
73
|
from .compile_prompt_deployment_expand_meta_request import CompilePromptDeploymentExpandMetaRequest
|
74
74
|
from .compile_prompt_meta import CompilePromptMeta
|
75
|
+
from .components_schemas_composio_execute_tool_request import ComponentsSchemasComposioExecuteToolRequest
|
76
|
+
from .components_schemas_composio_execute_tool_response import ComponentsSchemasComposioExecuteToolResponse
|
77
|
+
from .components_schemas_composio_tool_definition import ComponentsSchemasComposioToolDefinition
|
75
78
|
from .components_schemas_pdf_search_result_meta_source import ComponentsSchemasPdfSearchResultMetaSource
|
76
79
|
from .components_schemas_pdf_search_result_meta_source_request import ComponentsSchemasPdfSearchResultMetaSourceRequest
|
77
80
|
from .components_schemas_prompt_version_build_config_sandbox import ComponentsSchemasPromptVersionBuildConfigSandbox
|
81
|
+
from .composio_execute_tool_request import ComposioExecuteToolRequest
|
82
|
+
from .composio_execute_tool_response import ComposioExecuteToolResponse
|
83
|
+
from .composio_tool_definition import ComposioToolDefinition
|
78
84
|
from .condition_combinator import ConditionCombinator
|
79
85
|
from .conditional_node_result import ConditionalNodeResult
|
80
86
|
from .conditional_node_result_data import ConditionalNodeResultData
|
@@ -758,9 +764,15 @@ __all__ = [
|
|
758
764
|
"CodeResourceDefinition",
|
759
765
|
"CompilePromptDeploymentExpandMetaRequest",
|
760
766
|
"CompilePromptMeta",
|
767
|
+
"ComponentsSchemasComposioExecuteToolRequest",
|
768
|
+
"ComponentsSchemasComposioExecuteToolResponse",
|
769
|
+
"ComponentsSchemasComposioToolDefinition",
|
761
770
|
"ComponentsSchemasPdfSearchResultMetaSource",
|
762
771
|
"ComponentsSchemasPdfSearchResultMetaSourceRequest",
|
763
772
|
"ComponentsSchemasPromptVersionBuildConfigSandbox",
|
773
|
+
"ComposioExecuteToolRequest",
|
774
|
+
"ComposioExecuteToolResponse",
|
775
|
+
"ComposioToolDefinition",
|
764
776
|
"ConditionCombinator",
|
765
777
|
"ConditionalNodeResult",
|
766
778
|
"ConditionalNodeResultData",
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
import pydantic
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
7
|
+
|
8
|
+
|
9
|
+
class ComposioExecuteToolRequest(UniversalBaseModel):
|
10
|
+
"""
|
11
|
+
Payload for executing a Composio tool with provider id and tool arguments.
|
12
|
+
"""
|
13
|
+
|
14
|
+
provider: typing.Literal["COMPOSIO"] = "COMPOSIO"
|
15
|
+
arguments: typing.Dict[str, typing.Optional[typing.Any]]
|
16
|
+
|
17
|
+
if IS_PYDANTIC_V2:
|
18
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
19
|
+
else:
|
20
|
+
|
21
|
+
class Config:
|
22
|
+
frozen = True
|
23
|
+
smart_union = True
|
24
|
+
extra = pydantic.Extra.allow
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
import pydantic
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
7
|
+
|
8
|
+
|
9
|
+
class ComposioExecuteToolResponse(UniversalBaseModel):
|
10
|
+
"""
|
11
|
+
Response payload with provider id and execution output from a Composio tool.
|
12
|
+
"""
|
13
|
+
|
14
|
+
provider: typing.Literal["COMPOSIO"] = "COMPOSIO"
|
15
|
+
data: typing.Dict[str, typing.Optional[typing.Any]]
|
16
|
+
|
17
|
+
if IS_PYDANTIC_V2:
|
18
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
19
|
+
else:
|
20
|
+
|
21
|
+
class Config:
|
22
|
+
frozen = True
|
23
|
+
smart_union = True
|
24
|
+
extra = pydantic.Extra.allow
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
2
|
+
|
3
|
+
import typing
|
4
|
+
|
5
|
+
import pydantic
|
6
|
+
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
7
|
+
|
8
|
+
|
9
|
+
class ComposioToolDefinition(UniversalBaseModel):
|
10
|
+
"""
|
11
|
+
Serializer for Composio tool definition response.
|
12
|
+
"""
|
13
|
+
|
14
|
+
provider: typing.Literal["COMPOSIO"] = "COMPOSIO"
|
15
|
+
name: str
|
16
|
+
description: str
|
17
|
+
parameters: typing.Dict[str, typing.Optional[typing.Any]]
|
18
|
+
|
19
|
+
if IS_PYDANTIC_V2:
|
20
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
21
|
+
else:
|
22
|
+
|
23
|
+
class Config:
|
24
|
+
frozen = True
|
25
|
+
smart_union = True
|
26
|
+
extra = pydantic.Extra.allow
|
@@ -7,9 +7,11 @@ VellumErrorCodeEnum = typing.Union[
|
|
7
7
|
"INVALID_REQUEST",
|
8
8
|
"INVALID_INPUTS",
|
9
9
|
"PROVIDER_ERROR",
|
10
|
+
"PROVIDER_CREDENTIALS_AVAILABLE",
|
10
11
|
"REQUEST_TIMEOUT",
|
11
12
|
"INTERNAL_SERVER_ERROR",
|
12
13
|
"USER_DEFINED_ERROR",
|
14
|
+
"WORKFLOW_CANCELLED",
|
13
15
|
],
|
14
16
|
typing.Any,
|
15
17
|
]
|
@@ -10,6 +10,7 @@ from .vellum_sdk_error_code_enum import VellumSdkErrorCodeEnum
|
|
10
10
|
class VellumSdkError(UniversalBaseModel):
|
11
11
|
message: str
|
12
12
|
code: VellumSdkErrorCodeEnum
|
13
|
+
raw_data: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
13
14
|
|
14
15
|
if IS_PYDANTIC_V2:
|
15
16
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
@@ -10,6 +10,7 @@ from .workflow_execution_event_error_code import WorkflowExecutionEventErrorCode
|
|
10
10
|
class WorkflowEventError(UniversalBaseModel):
|
11
11
|
message: str
|
12
12
|
code: WorkflowExecutionEventErrorCode
|
13
|
+
raw_data: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
13
14
|
stacktrace: typing.Optional[str] = None
|
14
15
|
|
15
16
|
if IS_PYDANTIC_V2:
|
vellum/workflows/constants.py
CHANGED
@@ -29,3 +29,11 @@ class BaseWorkflowEmitter(ABC):
|
|
29
29
|
@abstractmethod
|
30
30
|
def snapshot_state(self, state: BaseState) -> None:
|
31
31
|
pass
|
32
|
+
|
33
|
+
@abstractmethod
|
34
|
+
def join(self) -> None:
|
35
|
+
"""
|
36
|
+
Wait for any background threads or timers used by this emitter to complete.
|
37
|
+
This ensures all pending work is finished before the workflow terminates.
|
38
|
+
"""
|
39
|
+
pass
|
@@ -135,3 +135,13 @@ class VellumEmitter(BaseWorkflowEmitter):
|
|
135
135
|
request=events, # type: ignore[arg-type]
|
136
136
|
request_options=request_options,
|
137
137
|
)
|
138
|
+
|
139
|
+
def join(self) -> None:
|
140
|
+
"""
|
141
|
+
Wait for any background threads or timers used by this emitter to complete.
|
142
|
+
This ensures all pending work is finished before the workflow terminates.
|
143
|
+
"""
|
144
|
+
self._flush_events()
|
145
|
+
|
146
|
+
if self._debounce_timer and self._debounce_timer.is_alive():
|
147
|
+
self._debounce_timer.join()
|
@@ -1,6 +1,6 @@
|
|
1
1
|
from typing import Any, Dict
|
2
2
|
|
3
|
-
from pydantic import field_serializer
|
3
|
+
from pydantic import Field, field_serializer
|
4
4
|
|
5
5
|
from vellum.client.core.pydantic_utilities import UniversalBaseModel
|
6
6
|
from vellum.workflows.inputs.base import BaseInputs
|
@@ -16,7 +16,7 @@ class DatasetRow(UniversalBaseModel):
|
|
16
16
|
"""
|
17
17
|
|
18
18
|
label: str
|
19
|
-
inputs: BaseInputs
|
19
|
+
inputs: BaseInputs = Field(default_factory=BaseInputs)
|
20
20
|
|
21
21
|
@field_serializer("inputs")
|
22
22
|
def serialize_inputs(self, inputs: BaseInputs) -> Dict[str, Any]:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from abc import ABC, ABCMeta
|
1
|
+
from abc import ABC, ABCMeta, abstractmethod
|
2
2
|
from dataclasses import field
|
3
3
|
from functools import cached_property, reduce
|
4
4
|
import inspect
|
@@ -215,6 +215,17 @@ class BaseNodeMeta(ABCMeta):
|
|
215
215
|
yield attr_value
|
216
216
|
yielded_attr_names.add(attr_name)
|
217
217
|
|
218
|
+
@abstractmethod
|
219
|
+
def __validate__(cls) -> None:
|
220
|
+
"""
|
221
|
+
Validates the node.
|
222
|
+
Subclasses can override this method to implement their specific validation logic.
|
223
|
+
Called during serialization or explicit validation.
|
224
|
+
|
225
|
+
Default implementation performs no validation.
|
226
|
+
"""
|
227
|
+
pass
|
228
|
+
|
218
229
|
|
219
230
|
class _BaseNodeTriggerMeta(type):
|
220
231
|
def __eq__(self, other: Any) -> bool:
|
@@ -112,4 +112,10 @@ class BasePromptNode(BaseNode[StateType], Generic[StateType]):
|
|
112
112
|
if not target_node_output:
|
113
113
|
return False
|
114
114
|
|
115
|
+
if not isinstance(target_node_output.instance, OutputReference):
|
116
|
+
return False
|
117
|
+
|
118
|
+
if target_node_output.instance.name != "text":
|
119
|
+
return False
|
120
|
+
|
115
121
|
return True
|
@@ -45,9 +45,15 @@ from vellum.workflows.nodes.displayable.bases.base_prompt_node import BasePrompt
|
|
45
45
|
from vellum.workflows.nodes.displayable.bases.utils import process_additional_prompt_outputs
|
46
46
|
from vellum.workflows.outputs import BaseOutput
|
47
47
|
from vellum.workflows.types import MergeBehavior
|
48
|
-
from vellum.workflows.types.definition import
|
48
|
+
from vellum.workflows.types.definition import (
|
49
|
+
ComposioToolDefinition,
|
50
|
+
DeploymentDefinition,
|
51
|
+
MCPServer,
|
52
|
+
VellumIntegrationToolDefinition,
|
53
|
+
)
|
49
54
|
from vellum.workflows.types.generics import StateType, is_workflow_class
|
50
55
|
from vellum.workflows.utils.functions import (
|
56
|
+
compile_composio_tool_definition,
|
51
57
|
compile_function_definition,
|
52
58
|
compile_inline_workflow_function_definition,
|
53
59
|
compile_mcp_tool_definition,
|
@@ -134,7 +140,7 @@ class BaseInlinePromptNode(BasePromptNode[StateType], Generic[StateType]):
|
|
134
140
|
elif isinstance(function, DeploymentDefinition):
|
135
141
|
normalized_functions.append(
|
136
142
|
compile_workflow_deployment_function_definition(
|
137
|
-
function
|
143
|
+
function,
|
138
144
|
vellum_client=self._context.vellum_client,
|
139
145
|
)
|
140
146
|
)
|
@@ -142,6 +148,14 @@ class BaseInlinePromptNode(BasePromptNode[StateType], Generic[StateType]):
|
|
142
148
|
normalized_functions.append(compile_inline_workflow_function_definition(function))
|
143
149
|
elif callable(function):
|
144
150
|
normalized_functions.append(compile_function_definition(function))
|
151
|
+
elif isinstance(function, ComposioToolDefinition):
|
152
|
+
normalized_functions.append(compile_composio_tool_definition(function))
|
153
|
+
elif isinstance(function, VellumIntegrationToolDefinition):
|
154
|
+
# TODO: Implement compile_vellum_integration_tool_definition
|
155
|
+
raise NotImplementedError(
|
156
|
+
"VellumIntegrationToolDefinition support coming soon. "
|
157
|
+
"This will be implemented when compile_vellum_integration_tool_definition is created."
|
158
|
+
)
|
145
159
|
elif isinstance(function, MCPServer):
|
146
160
|
tool_definitions = compile_mcp_tool_definition(function)
|
147
161
|
for tool_def in tool_definitions:
|