vellum-ai 1.3.7__py3-none-any.whl → 1.3.8__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/client/core/client_wrapper.py +2 -2
- vellum/client/types/node_execution_rejected_body.py +1 -0
- vellum/client/types/workflow_event_error.py +1 -0
- vellum/client/types/workflow_execution_rejected_body.py +1 -0
- vellum/workflows/descriptors/exceptions.py +18 -1
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py +86 -0
- vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py +87 -7
- vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py +60 -0
- vellum/workflows/runner/runner.py +16 -0
- {vellum_ai-1.3.7.dist-info → vellum_ai-1.3.8.dist-info}/METADATA +1 -1
- {vellum_ai-1.3.7.dist-info → vellum_ai-1.3.8.dist-info}/RECORD +15 -15
- vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_deployment_node.py +70 -0
- {vellum_ai-1.3.7.dist-info → vellum_ai-1.3.8.dist-info}/LICENSE +0 -0
- {vellum_ai-1.3.7.dist-info → vellum_ai-1.3.8.dist-info}/WHEEL +0 -0
- {vellum_ai-1.3.7.dist-info → vellum_ai-1.3.8.dist-info}/entry_points.txt +0 -0
@@ -27,10 +27,10 @@ class BaseClientWrapper:
|
|
27
27
|
|
28
28
|
def get_headers(self) -> typing.Dict[str, str]:
|
29
29
|
headers: typing.Dict[str, str] = {
|
30
|
-
"User-Agent": "vellum-ai/1.3.
|
30
|
+
"User-Agent": "vellum-ai/1.3.8",
|
31
31
|
"X-Fern-Language": "Python",
|
32
32
|
"X-Fern-SDK-Name": "vellum-ai",
|
33
|
-
"X-Fern-SDK-Version": "1.3.
|
33
|
+
"X-Fern-SDK-Version": "1.3.8",
|
34
34
|
**(self.get_custom_headers() or {}),
|
35
35
|
}
|
36
36
|
if self._api_version is not None:
|
@@ -11,6 +11,7 @@ from .vellum_sdk_error import VellumSdkError
|
|
11
11
|
class NodeExecutionRejectedBody(UniversalBaseModel):
|
12
12
|
node_definition: VellumCodeResourceDefinition
|
13
13
|
error: VellumSdkError
|
14
|
+
stacktrace: typing.Optional[str] = None
|
14
15
|
|
15
16
|
if IS_PYDANTIC_V2:
|
16
17
|
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
|
+
stacktrace: typing.Optional[str] = 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
|
@@ -11,6 +11,7 @@ from .vellum_sdk_error import VellumSdkError
|
|
11
11
|
class WorkflowExecutionRejectedBody(UniversalBaseModel):
|
12
12
|
workflow_definition: VellumCodeResourceDefinition
|
13
13
|
error: VellumSdkError
|
14
|
+
stacktrace: typing.Optional[str] = None
|
14
15
|
|
15
16
|
if IS_PYDANTIC_V2:
|
16
17
|
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
@@ -1,2 +1,19 @@
|
|
1
|
+
from vellum.workflows.errors import WorkflowError, WorkflowErrorCode
|
2
|
+
|
3
|
+
|
1
4
|
class InvalidExpressionException(Exception):
|
2
|
-
|
5
|
+
def __init__(self, message: str, code: WorkflowErrorCode = WorkflowErrorCode.NODE_EXECUTION):
|
6
|
+
self.message = message
|
7
|
+
self.code = code
|
8
|
+
super().__init__(message)
|
9
|
+
|
10
|
+
@property
|
11
|
+
def error(self) -> WorkflowError:
|
12
|
+
return WorkflowError(
|
13
|
+
message=self.message,
|
14
|
+
code=self.code,
|
15
|
+
)
|
16
|
+
|
17
|
+
@staticmethod
|
18
|
+
def of(workflow_error: WorkflowError) -> "InvalidExpressionException":
|
19
|
+
return InvalidExpressionException(message=workflow_error.message, code=workflow_error.code)
|
@@ -17,6 +17,20 @@ from vellum import (
|
|
17
17
|
VellumVariable,
|
18
18
|
)
|
19
19
|
from vellum.client import ApiError, RequestOptions
|
20
|
+
from vellum.client.types import (
|
21
|
+
PromptRequestAudioInput,
|
22
|
+
PromptRequestDocumentInput,
|
23
|
+
PromptRequestImageInput,
|
24
|
+
PromptRequestVideoInput,
|
25
|
+
VellumAudio,
|
26
|
+
VellumAudioRequest,
|
27
|
+
VellumDocument,
|
28
|
+
VellumDocumentRequest,
|
29
|
+
VellumImage,
|
30
|
+
VellumImageRequest,
|
31
|
+
VellumVideo,
|
32
|
+
VellumVideoRequest,
|
33
|
+
)
|
20
34
|
from vellum.client.types.chat_message_request import ChatMessageRequest
|
21
35
|
from vellum.client.types.prompt_exec_config import PromptExecConfig
|
22
36
|
from vellum.client.types.prompt_settings import PromptSettings
|
@@ -273,6 +287,78 @@ class BaseInlinePromptNode(BasePromptNode[StateType], Generic[StateType]):
|
|
273
287
|
value=chat_history,
|
274
288
|
)
|
275
289
|
)
|
290
|
+
elif isinstance(input_value, (VellumAudio, VellumAudioRequest)):
|
291
|
+
input_variables.append(
|
292
|
+
VellumVariable(
|
293
|
+
id=str(uuid4()),
|
294
|
+
key=input_name,
|
295
|
+
type="AUDIO",
|
296
|
+
)
|
297
|
+
)
|
298
|
+
input_values.append(
|
299
|
+
PromptRequestAudioInput(
|
300
|
+
key=input_name,
|
301
|
+
value=(
|
302
|
+
input_value
|
303
|
+
if isinstance(input_value, VellumAudio)
|
304
|
+
else VellumAudio.model_validate(input_value.model_dump())
|
305
|
+
),
|
306
|
+
)
|
307
|
+
)
|
308
|
+
elif isinstance(input_value, (VellumVideo, VellumVideoRequest)):
|
309
|
+
input_variables.append(
|
310
|
+
VellumVariable(
|
311
|
+
id=str(uuid4()),
|
312
|
+
key=input_name,
|
313
|
+
type="VIDEO",
|
314
|
+
)
|
315
|
+
)
|
316
|
+
input_values.append(
|
317
|
+
PromptRequestVideoInput(
|
318
|
+
key=input_name,
|
319
|
+
value=(
|
320
|
+
input_value
|
321
|
+
if isinstance(input_value, VellumVideo)
|
322
|
+
else VellumVideo.model_validate(input_value.model_dump())
|
323
|
+
),
|
324
|
+
)
|
325
|
+
)
|
326
|
+
elif isinstance(input_value, (VellumImage, VellumImageRequest)):
|
327
|
+
input_variables.append(
|
328
|
+
VellumVariable(
|
329
|
+
id=str(uuid4()),
|
330
|
+
key=input_name,
|
331
|
+
type="IMAGE",
|
332
|
+
)
|
333
|
+
)
|
334
|
+
input_values.append(
|
335
|
+
PromptRequestImageInput(
|
336
|
+
key=input_name,
|
337
|
+
value=(
|
338
|
+
input_value
|
339
|
+
if isinstance(input_value, VellumImage)
|
340
|
+
else VellumImage.model_validate(input_value.model_dump())
|
341
|
+
),
|
342
|
+
)
|
343
|
+
)
|
344
|
+
elif isinstance(input_value, (VellumDocument, VellumDocumentRequest)):
|
345
|
+
input_variables.append(
|
346
|
+
VellumVariable(
|
347
|
+
id=str(uuid4()),
|
348
|
+
key=input_name,
|
349
|
+
type="DOCUMENT",
|
350
|
+
)
|
351
|
+
)
|
352
|
+
input_values.append(
|
353
|
+
PromptRequestDocumentInput(
|
354
|
+
key=input_name,
|
355
|
+
value=(
|
356
|
+
input_value
|
357
|
+
if isinstance(input_value, VellumDocument)
|
358
|
+
else VellumDocument.model_validate(input_value.model_dump())
|
359
|
+
),
|
360
|
+
)
|
361
|
+
)
|
276
362
|
else:
|
277
363
|
try:
|
278
364
|
input_value = default_serializer(input_value)
|
vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py
CHANGED
@@ -9,22 +9,34 @@ from pydantic import BaseModel
|
|
9
9
|
from vellum import (
|
10
10
|
AdHocExecutePromptEvent,
|
11
11
|
ChatMessagePromptBlock,
|
12
|
+
ExecutePromptEvent,
|
12
13
|
FulfilledAdHocExecutePromptEvent,
|
14
|
+
FulfilledExecutePromptEvent,
|
15
|
+
FulfilledPromptExecutionMeta,
|
16
|
+
InitiatedExecutePromptEvent,
|
13
17
|
JinjaPromptBlock,
|
14
18
|
PlainTextPromptBlock,
|
15
19
|
PromptBlock,
|
20
|
+
PromptOutput,
|
16
21
|
PromptParameters,
|
22
|
+
PromptRequestAudioInput,
|
23
|
+
PromptRequestDocumentInput,
|
24
|
+
PromptRequestImageInput,
|
25
|
+
PromptRequestStringInput,
|
26
|
+
PromptRequestVideoInput,
|
17
27
|
PromptSettings,
|
18
28
|
RichTextPromptBlock,
|
29
|
+
StringVellumValue,
|
19
30
|
VariablePromptBlock,
|
31
|
+
VellumAudio,
|
32
|
+
VellumAudioRequest,
|
33
|
+
VellumDocument,
|
34
|
+
VellumDocumentRequest,
|
35
|
+
VellumImage,
|
36
|
+
VellumImageRequest,
|
37
|
+
VellumVideo,
|
38
|
+
VellumVideoRequest,
|
20
39
|
)
|
21
|
-
from vellum.client.types.execute_prompt_event import ExecutePromptEvent
|
22
|
-
from vellum.client.types.fulfilled_execute_prompt_event import FulfilledExecutePromptEvent
|
23
|
-
from vellum.client.types.fulfilled_prompt_execution_meta import FulfilledPromptExecutionMeta
|
24
|
-
from vellum.client.types.initiated_execute_prompt_event import InitiatedExecutePromptEvent
|
25
|
-
from vellum.client.types.prompt_output import PromptOutput
|
26
|
-
from vellum.client.types.prompt_request_string_input import PromptRequestStringInput
|
27
|
-
from vellum.client.types.string_vellum_value import StringVellumValue
|
28
40
|
from vellum.workflows.errors import WorkflowErrorCode
|
29
41
|
from vellum.workflows.exceptions import NodeException
|
30
42
|
from vellum.workflows.inputs import BaseInputs
|
@@ -725,3 +737,71 @@ def test_inline_prompt_node__empty_string_output_with_length_finish_reason(vellu
|
|
725
737
|
|
726
738
|
# AND the exception should have the correct error code
|
727
739
|
assert excinfo.value.code == WorkflowErrorCode.INVALID_OUTPUTS
|
740
|
+
|
741
|
+
|
742
|
+
@pytest.mark.parametrize(
|
743
|
+
[
|
744
|
+
"raw_input",
|
745
|
+
"expected_vellum_variable_type",
|
746
|
+
"expected_compiled_inputs",
|
747
|
+
],
|
748
|
+
[
|
749
|
+
# Cast VellumX -> VellumXRequest
|
750
|
+
(
|
751
|
+
VellumAudio(src="data:audio/wav;base64,mockaudio"),
|
752
|
+
"AUDIO",
|
753
|
+
[PromptRequestAudioInput(key="file_input", value=VellumAudio(src="data:audio/wav;base64,mockaudio"))],
|
754
|
+
),
|
755
|
+
(
|
756
|
+
VellumImage(src="data:image/png;base64,mockimage"),
|
757
|
+
"IMAGE",
|
758
|
+
[PromptRequestImageInput(key="file_input", value=VellumImage(src="data:image/png;base64,mockimage"))],
|
759
|
+
),
|
760
|
+
(
|
761
|
+
VellumVideo(src="data:video/mp4;base64,mockvideo"),
|
762
|
+
"VIDEO",
|
763
|
+
[PromptRequestVideoInput(key="file_input", value=VellumVideo(src="data:video/mp4;base64,mockvideo"))],
|
764
|
+
),
|
765
|
+
(
|
766
|
+
VellumDocument(src="mockdocument"),
|
767
|
+
"DOCUMENT",
|
768
|
+
[PromptRequestDocumentInput(key="file_input", value=VellumDocument(src="mockdocument"))],
|
769
|
+
),
|
770
|
+
# No casting required
|
771
|
+
(
|
772
|
+
VellumAudioRequest(src="data:audio/wav;base64,mockaudio"),
|
773
|
+
"AUDIO",
|
774
|
+
[PromptRequestAudioInput(key="file_input", value=VellumAudio(src="data:audio/wav;base64,mockaudio"))],
|
775
|
+
),
|
776
|
+
(
|
777
|
+
VellumImageRequest(src="data:image/png;base64,mockimage"),
|
778
|
+
"IMAGE",
|
779
|
+
[PromptRequestImageInput(key="file_input", value=VellumImage(src="data:image/png;base64,mockimage"))],
|
780
|
+
),
|
781
|
+
(
|
782
|
+
VellumVideoRequest(src="data:video/mp4;base64,mockvideo"),
|
783
|
+
"VIDEO",
|
784
|
+
[PromptRequestVideoInput(key="file_input", value=VellumVideo(src="data:video/mp4;base64,mockvideo"))],
|
785
|
+
),
|
786
|
+
(
|
787
|
+
VellumDocumentRequest(src="mockdocument"),
|
788
|
+
"DOCUMENT",
|
789
|
+
[PromptRequestDocumentInput(key="file_input", value=VellumDocument(src="mockdocument"))],
|
790
|
+
),
|
791
|
+
],
|
792
|
+
)
|
793
|
+
def test_file_input_compilation(raw_input, expected_vellum_variable_type, expected_compiled_inputs):
|
794
|
+
# GIVEN a prompt node with file input
|
795
|
+
class MyPromptDeploymentNode(InlinePromptNode):
|
796
|
+
ml_model = "test-model"
|
797
|
+
ml_model_fallbacks = None
|
798
|
+
|
799
|
+
prompt_inputs = {"file_input": raw_input}
|
800
|
+
|
801
|
+
# WHEN we compile the inputs
|
802
|
+
vellum_variables, compiled_inputs = MyPromptDeploymentNode()._compile_prompt_inputs()
|
803
|
+
|
804
|
+
# THEN we should get the correct input type
|
805
|
+
assert len(vellum_variables) == 1
|
806
|
+
assert vellum_variables[0].type == expected_vellum_variable_type
|
807
|
+
assert compiled_inputs == expected_compiled_inputs
|
@@ -3,15 +3,27 @@ from uuid import UUID
|
|
3
3
|
from typing import Any, ClassVar, Dict, Generator, Generic, Iterator, List, Optional, Sequence, Set, Union
|
4
4
|
|
5
5
|
from vellum import (
|
6
|
+
AudioInputRequest,
|
6
7
|
ChatHistoryInputRequest,
|
7
8
|
ChatMessage,
|
9
|
+
DocumentInputRequest,
|
8
10
|
ExecutePromptEvent,
|
11
|
+
ImageInputRequest,
|
9
12
|
JsonInputRequest,
|
10
13
|
PromptDeploymentExpandMetaRequest,
|
11
14
|
PromptDeploymentInputRequest,
|
12
15
|
PromptOutput,
|
13
16
|
RawPromptExecutionOverridesRequest,
|
14
17
|
StringInputRequest,
|
18
|
+
VellumAudio,
|
19
|
+
VellumAudioRequest,
|
20
|
+
VellumDocument,
|
21
|
+
VellumDocumentRequest,
|
22
|
+
VellumImage,
|
23
|
+
VellumImageRequest,
|
24
|
+
VellumVideo,
|
25
|
+
VellumVideoRequest,
|
26
|
+
VideoInputRequest,
|
15
27
|
)
|
16
28
|
from vellum.client import ApiError, RequestOptions
|
17
29
|
from vellum.client.types.chat_message_request import ChatMessageRequest
|
@@ -202,6 +214,54 @@ class BasePromptDeploymentNode(BasePromptNode, Generic[StateType]):
|
|
202
214
|
value=chat_history,
|
203
215
|
)
|
204
216
|
)
|
217
|
+
elif isinstance(input_value, (VellumAudio, VellumAudioRequest)):
|
218
|
+
audio_value = (
|
219
|
+
input_value
|
220
|
+
if isinstance(input_value, VellumAudioRequest)
|
221
|
+
else VellumAudioRequest.model_validate(input_value.model_dump())
|
222
|
+
)
|
223
|
+
compiled_inputs.append(
|
224
|
+
AudioInputRequest(
|
225
|
+
name=input_name,
|
226
|
+
value=audio_value,
|
227
|
+
)
|
228
|
+
)
|
229
|
+
elif isinstance(input_value, (VellumImage, VellumImageRequest)):
|
230
|
+
image_value = (
|
231
|
+
input_value
|
232
|
+
if isinstance(input_value, VellumImageRequest)
|
233
|
+
else VellumImageRequest.model_validate(input_value.model_dump())
|
234
|
+
)
|
235
|
+
compiled_inputs.append(
|
236
|
+
ImageInputRequest(
|
237
|
+
name=input_name,
|
238
|
+
value=image_value,
|
239
|
+
)
|
240
|
+
)
|
241
|
+
elif isinstance(input_value, (VellumDocument, VellumDocumentRequest)):
|
242
|
+
document_value = (
|
243
|
+
input_value
|
244
|
+
if isinstance(input_value, VellumDocumentRequest)
|
245
|
+
else VellumDocumentRequest.model_validate(input_value.model_dump())
|
246
|
+
)
|
247
|
+
compiled_inputs.append(
|
248
|
+
DocumentInputRequest(
|
249
|
+
name=input_name,
|
250
|
+
value=document_value,
|
251
|
+
)
|
252
|
+
)
|
253
|
+
elif isinstance(input_value, (VellumVideo, VellumVideoRequest)):
|
254
|
+
video_value = (
|
255
|
+
input_value
|
256
|
+
if isinstance(input_value, VellumVideoRequest)
|
257
|
+
else VellumVideoRequest.model_validate(input_value.model_dump())
|
258
|
+
)
|
259
|
+
compiled_inputs.append(
|
260
|
+
VideoInputRequest(
|
261
|
+
name=input_name,
|
262
|
+
value=video_value,
|
263
|
+
)
|
264
|
+
)
|
205
265
|
else:
|
206
266
|
try:
|
207
267
|
input_value = default_serializer(input_value)
|
@@ -27,6 +27,7 @@ from typing import (
|
|
27
27
|
from vellum.workflows.constants import undefined
|
28
28
|
from vellum.workflows.context import ExecutionContext, execution_context, get_execution_context
|
29
29
|
from vellum.workflows.descriptors.base import BaseDescriptor
|
30
|
+
from vellum.workflows.descriptors.exceptions import InvalidExpressionException
|
30
31
|
from vellum.workflows.errors import WorkflowError, WorkflowErrorCode
|
31
32
|
from vellum.workflows.events import (
|
32
33
|
NodeExecutionFulfilledEvent,
|
@@ -433,6 +434,21 @@ class WorkflowRunner(Generic[StateType]):
|
|
433
434
|
parent=execution.parent_context,
|
434
435
|
)
|
435
436
|
)
|
437
|
+
except InvalidExpressionException as e:
|
438
|
+
logger.info(e)
|
439
|
+
captured_stacktrace = traceback.format_exc()
|
440
|
+
self._workflow_event_inner_queue.put(
|
441
|
+
NodeExecutionRejectedEvent(
|
442
|
+
trace_id=execution.trace_id,
|
443
|
+
span_id=span_id,
|
444
|
+
body=NodeExecutionRejectedBody(
|
445
|
+
node_definition=node.__class__,
|
446
|
+
error=e.error,
|
447
|
+
stacktrace=captured_stacktrace,
|
448
|
+
),
|
449
|
+
parent=execution.parent_context,
|
450
|
+
)
|
451
|
+
)
|
436
452
|
|
437
453
|
except Exception as e:
|
438
454
|
error_message = self._parse_error_message(e)
|
@@ -60,7 +60,7 @@ vellum_ee/workflows/display/nodes/vellum/tests/test_code_execution_node.py,sha25
|
|
60
60
|
vellum_ee/workflows/display/nodes/vellum/tests/test_error_node.py,sha256=540FoWMpJ3EN_DPjHsr9ODJWCRVcUa5hZBn-5T2GiHU,1665
|
61
61
|
vellum_ee/workflows/display/nodes/vellum/tests/test_inline_subworkflow_node.py,sha256=SKOYan-dxY4gsO0R4JyQUyWrABHBN8XImKw9Eeo4wGo,3535
|
62
62
|
vellum_ee/workflows/display/nodes/vellum/tests/test_note_node.py,sha256=uiMB0cOxKZzos7YKnj4ef4DFa2bOvZJWIv-hfbUV6Go,1218
|
63
|
-
vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_deployment_node.py,sha256=
|
63
|
+
vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_deployment_node.py,sha256=54oatuBB98Dfbr08NqZU8ZNhfQdJWhODIwjsegPPJJw,6376
|
64
64
|
vellum_ee/workflows/display/nodes/vellum/tests/test_prompt_node.py,sha256=h3rXIfB349w11cMgNpqEWCI3ucTsTb30cWskXN8FoV0,14053
|
65
65
|
vellum_ee/workflows/display/nodes/vellum/tests/test_retry_node.py,sha256=WyqX_g-jN4BOVHIto_HDRVb-uWCmDTaiCwHho4uYKOM,1954
|
66
66
|
vellum_ee/workflows/display/nodes/vellum/tests/test_search_node.py,sha256=KvByxgbUkVyfPIVxTUBUk6a92JiJMi8eReZWxzfPExU,3864
|
@@ -155,7 +155,7 @@ vellum/client/README.md,sha256=flqu57ubZNTfpq60CdLtJC9gp4WEkyjb_n_eZ4OYf9w,6497
|
|
155
155
|
vellum/client/__init__.py,sha256=T5Ht_w-Mk_9nzGqdadhQB8V20M0vYj7am06ut0A3P1o,73401
|
156
156
|
vellum/client/core/__init__.py,sha256=lTcqUPXcx4112yLDd70RAPeqq6tu3eFMe1pKOqkW9JQ,1562
|
157
157
|
vellum/client/core/api_error.py,sha256=44vPoTyWN59gonCIZMdzw7M1uspygiLnr3GNFOoVL2Q,614
|
158
|
-
vellum/client/core/client_wrapper.py,sha256=
|
158
|
+
vellum/client/core/client_wrapper.py,sha256=3jamH9TZmnQVnQ_3AONYmIgWDW0mHBDzFiOfpCYnSXk,2840
|
159
159
|
vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
|
160
160
|
vellum/client/core/file.py,sha256=d4NNbX8XvXP32z8KpK2Xovv33nFfruIrpz0QWxlgpZk,2663
|
161
161
|
vellum/client/core/force_multipart.py,sha256=awxh5MtcRYe74ehY8U76jzv6fYM_w_D3Rur7KQQzSDk,429
|
@@ -524,7 +524,7 @@ vellum/client/types/node_execution_initiated_body.py,sha256=PmI24HmrlHFoROgJdAJI
|
|
524
524
|
vellum/client/types/node_execution_initiated_event.py,sha256=MEEcgN9AjEAdDeUCGQyg7WaaxEpfPPA6AJKmIMGZMF8,1897
|
525
525
|
vellum/client/types/node_execution_paused_body.py,sha256=pAySHgvgRO6iV1pfO_lRyufk4ecA0LON8CCap4YTZsk,640
|
526
526
|
vellum/client/types/node_execution_paused_event.py,sha256=9JqnlTAtnMhnSlztrp9GpjCdSYVcKvV_h1jQszRInt8,1876
|
527
|
-
vellum/client/types/node_execution_rejected_body.py,sha256=
|
527
|
+
vellum/client/types/node_execution_rejected_body.py,sha256=PxLPedDB-Budfm9OtFtyjLnpaMO3rK_DQg62sv1TpsA,757
|
528
528
|
vellum/client/types/node_execution_rejected_event.py,sha256=JzbQux0bYivwK7edTydq6vrGQEVRdvypa4ZipTrmsig,1890
|
529
529
|
vellum/client/types/node_execution_resumed_body.py,sha256=M8nhwykvfwFgRKAyiVXJZC3Mrd7JankiTdO8muHQWMA,641
|
530
530
|
vellum/client/types/node_execution_resumed_event.py,sha256=SQ0EPqJnnAWulBb2H46v5p809UznM8YVIsdbyPOHn_s,1883
|
@@ -837,7 +837,7 @@ vellum/client/types/workflow_deployment_release_workflow_deployment.py,sha256=Zm
|
|
837
837
|
vellum/client/types/workflow_deployment_release_workflow_version.py,sha256=VbVrwsDHapwPSsGEt8OM9Gjs31esIqkp8ta5zrZvPTw,885
|
838
838
|
vellum/client/types/workflow_error.py,sha256=iDMQ3Wx7E8lf6BYtBTGpeIxG46iF9mjzTpjxyJVTXgM,283
|
839
839
|
vellum/client/types/workflow_event.py,sha256=M_ra0CjUffCPqPRFJM_oR1IY4egHDGa0tY1HAoA8j5k,1532
|
840
|
-
vellum/client/types/workflow_event_error.py,sha256=
|
840
|
+
vellum/client/types/workflow_event_error.py,sha256=Isqu59qZywEFRZbgHwn2NKh2CZ3RA9qoqZSbzdQcy5g,695
|
841
841
|
vellum/client/types/workflow_event_execution_read.py,sha256=DRB19CN0E3r3t1mtfNLhaxiVtPKh5nJLYkCwVtomM7w,2456
|
842
842
|
vellum/client/types/workflow_execution_actual.py,sha256=QJn7xXOtSJT30se2KdOyAYVJKjU53uhdvpjcMDIz1eM,962
|
843
843
|
vellum/client/types/workflow_execution_actual_chat_history_request.py,sha256=E3Vt4l6PpE24_teWe3Kfu_4z1sbosaz_Uk1iUI9cZ-s,1957
|
@@ -853,7 +853,7 @@ vellum/client/types/workflow_execution_initiated_event.py,sha256=JpzYEKYJPe5blgM
|
|
853
853
|
vellum/client/types/workflow_execution_node_result_event.py,sha256=4rLmfNqLq2UYUGW1_CBb1yCXaCgBwFjq1UQ4-txSimU,1040
|
854
854
|
vellum/client/types/workflow_execution_paused_body.py,sha256=YzALzCHE9wRkyRuseriaGKst_oidAaIUNar9B6doMrY,769
|
855
855
|
vellum/client/types/workflow_execution_paused_event.py,sha256=nLzQ4j_qB7Z7q9D8TfPDCeCYfGuk-8_emlBcAx_oOu4,1904
|
856
|
-
vellum/client/types/workflow_execution_rejected_body.py,sha256=
|
856
|
+
vellum/client/types/workflow_execution_rejected_body.py,sha256=biJQ8_PDeJGELgjjUbZayC3tzoDkFSs2o-o04IKA6fg,765
|
857
857
|
vellum/client/types/workflow_execution_rejected_event.py,sha256=j1QzOxkcmcFfA9zHOiKBnv7qF_YrFePq380us1nnYEk,1918
|
858
858
|
vellum/client/types/workflow_execution_resumed_body.py,sha256=L0Atzk7328tpjhRKC0Y8AoWuMebtdHzd4gBjYkvKDIM,649
|
859
859
|
vellum/client/types/workflow_execution_resumed_event.py,sha256=7PTH1rLBlvC4414LG3L3AdMRrJEmtrJSOWwM5sptAZc,1911
|
@@ -1717,7 +1717,7 @@ vellum/workflows/constants.py,sha256=xweiPRUSVEnGz9BJvpIWu96Gfok89QneARu4K7wj7f8
|
|
1717
1717
|
vellum/workflows/context.py,sha256=ViyIeMDhUv-MhnynLaXPlvlbYxRU45ySvYidCNSbFZU,2458
|
1718
1718
|
vellum/workflows/descriptors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1719
1719
|
vellum/workflows/descriptors/base.py,sha256=fRnRkECyDjfz2QEDCY9Q5mAerlJ6jR0R4nE-MP2VP_k,16558
|
1720
|
-
vellum/workflows/descriptors/exceptions.py,sha256=
|
1720
|
+
vellum/workflows/descriptors/exceptions.py,sha256=Rv2uMiaO2a2SADhJzl_VHhV6dqwAhZAzaJPoThP7SZc,653
|
1721
1721
|
vellum/workflows/descriptors/tests/test_utils.py,sha256=HJ5DoRz0sJvViGxyZ_FtytZjxN2J8xTkGtaVwCy6Q90,6928
|
1722
1722
|
vellum/workflows/descriptors/utils.py,sha256=7QvS_IOZWIoKvhNwpYBOTP3NasLSIBKTnhyASry2HCM,4320
|
1723
1723
|
vellum/workflows/edges/__init__.py,sha256=wSkmAnz9xyi4vZwtDbKxwlplt2skD7n3NsxkvR_pUus,50
|
@@ -1840,10 +1840,10 @@ vellum/workflows/nodes/displayable/bases/api_node/tests/test_node.py,sha256=5C59
|
|
1840
1840
|
vellum/workflows/nodes/displayable/bases/base_prompt_node/__init__.py,sha256=Org3xTvgp1pA0uUXFfnJr29D3HzCey2lEdYF4zbIUgo,70
|
1841
1841
|
vellum/workflows/nodes/displayable/bases/base_prompt_node/node.py,sha256=ea20icDM1HB942wkH-XtXNSNCBDcjeOiN3vowkHL4fs,4477
|
1842
1842
|
vellum/workflows/nodes/displayable/bases/inline_prompt_node/__init__.py,sha256=Hl35IAoepRpE-j4cALaXVJIYTYOF3qszyVbxTj4kS1s,82
|
1843
|
-
vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py,sha256=
|
1843
|
+
vellum/workflows/nodes/displayable/bases/inline_prompt_node/node.py,sha256=TkVfwD5-GGWG32vtGMo4ZjuxWrjVYbK7tDWq0U9OBCM,17316
|
1844
1844
|
vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1845
|
-
vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py,sha256=
|
1846
|
-
vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py,sha256=
|
1845
|
+
vellum/workflows/nodes/displayable/bases/inline_prompt_node/tests/test_inline_prompt_node.py,sha256=xc53wGwVqxBnN7eoyWkJ-RJ-FeUpHKekkKjViASHAFg,27495
|
1846
|
+
vellum/workflows/nodes/displayable/bases/prompt_deployment_node.py,sha256=H9mM75EQpP6PUvsXCTbwjw4CqMMLf36m1G2XqiPEvH4,12139
|
1847
1847
|
vellum/workflows/nodes/displayable/bases/search_node.py,sha256=9TtFn6oNpEkpCL59QdBViUe4WPjcITajbiS7EOjOGag,6114
|
1848
1848
|
vellum/workflows/nodes/displayable/bases/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1849
1849
|
vellum/workflows/nodes/displayable/bases/tests/test_utils.py,sha256=eqdqbKNRWVMDPevgwLg1i6YK0g4L4bCy-7xCBN5yYZI,3156
|
@@ -1939,7 +1939,7 @@ vellum/workflows/resolvers/resolver.py,sha256=yK-oY0HDsFJcjlNKAm3vpsPKRIFerIh59F
|
|
1939
1939
|
vellum/workflows/resolvers/tests/test_resolver.py,sha256=jXkJBb9SwtoH__bBN-ECohpyD0aTIB9ErEvtFhuTMQM,9750
|
1940
1940
|
vellum/workflows/resolvers/types.py,sha256=Hndhlk69g6EKLh_LYg5ILepW5U_h_BYNllfzhS9k8p4,237
|
1941
1941
|
vellum/workflows/runner/__init__.py,sha256=i1iG5sAhtpdsrlvwgH6B-m49JsINkiWyPWs8vyT-bqM,72
|
1942
|
-
vellum/workflows/runner/runner.py,sha256=
|
1942
|
+
vellum/workflows/runner/runner.py,sha256=lnVbqA1nSdWuyY1SZDpLDvnpLRQcQyWYOWrx3RIJpcg,41043
|
1943
1943
|
vellum/workflows/sandbox.py,sha256=jwlFFQjHDwmbVoBah_Q3i8K_BrzOt-F6TXFauiyVyIk,3021
|
1944
1944
|
vellum/workflows/state/__init__.py,sha256=yUUdR-_Vl7UiixNDYQZ-GEM_kJI9dnOia75TtuNEsnE,60
|
1945
1945
|
vellum/workflows/state/base.py,sha256=m9fCqbZn21GshCVCjJTD1dPZEQjFrsMXqlg7tM9fIwM,24283
|
@@ -1982,8 +1982,8 @@ vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnad
|
|
1982
1982
|
vellum/workflows/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
1983
1983
|
vellum/workflows/workflows/tests/test_base_workflow.py,sha256=ptMntHzVyy8ZuzNgeTuk7hREgKQ5UBdgq8VJFSGaW4Y,20832
|
1984
1984
|
vellum/workflows/workflows/tests/test_context.py,sha256=VJBUcyWVtMa_lE5KxdhgMu0WYNYnUQUDvTF7qm89hJ0,2333
|
1985
|
-
vellum_ai-1.3.
|
1986
|
-
vellum_ai-1.3.
|
1987
|
-
vellum_ai-1.3.
|
1988
|
-
vellum_ai-1.3.
|
1989
|
-
vellum_ai-1.3.
|
1985
|
+
vellum_ai-1.3.8.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
|
1986
|
+
vellum_ai-1.3.8.dist-info/METADATA,sha256=KV_O-jG8Vwr7C8sWo7lhOV_jCflTi2AJQJKTBkxftN8,5547
|
1987
|
+
vellum_ai-1.3.8.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
1988
|
+
vellum_ai-1.3.8.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
|
1989
|
+
vellum_ai-1.3.8.dist-info/RECORD,,
|
@@ -3,6 +3,20 @@ from datetime import datetime
|
|
3
3
|
from uuid import UUID, uuid4
|
4
4
|
from typing import Type
|
5
5
|
|
6
|
+
from vellum import (
|
7
|
+
AudioInputRequest,
|
8
|
+
DocumentInputRequest,
|
9
|
+
ImageInputRequest,
|
10
|
+
VellumAudio,
|
11
|
+
VellumAudioRequest,
|
12
|
+
VellumDocument,
|
13
|
+
VellumDocumentRequest,
|
14
|
+
VellumImage,
|
15
|
+
VellumImageRequest,
|
16
|
+
VellumVideo,
|
17
|
+
VellumVideoRequest,
|
18
|
+
VideoInputRequest,
|
19
|
+
)
|
6
20
|
from vellum.workflows import BaseWorkflow
|
7
21
|
from vellum.workflows.nodes import PromptDeploymentNode
|
8
22
|
from vellum_ee.workflows.display.nodes.vellum.prompt_deployment_node import BasePromptDeploymentNodeDisplay
|
@@ -105,3 +119,59 @@ def test_serialize_node__prompt_inputs(GetDisplayClass, expected_input_id, mock_
|
|
105
119
|
},
|
106
120
|
}
|
107
121
|
]
|
122
|
+
|
123
|
+
|
124
|
+
@pytest.mark.parametrize(
|
125
|
+
[
|
126
|
+
"raw_input",
|
127
|
+
"expected_compiled_inputs",
|
128
|
+
],
|
129
|
+
[
|
130
|
+
# Cast VellumX -> VellumXRequest
|
131
|
+
(
|
132
|
+
VellumAudio(src="data:audio/wav;base64,mockaudio"),
|
133
|
+
[AudioInputRequest(name="file_input", value=VellumAudioRequest(src="data:audio/wav;base64,mockaudio"))],
|
134
|
+
),
|
135
|
+
(
|
136
|
+
VellumImage(src="data:image/png;base64,mockimage"),
|
137
|
+
[ImageInputRequest(name="file_input", value=VellumImageRequest(src="data:image/png;base64,mockimage"))],
|
138
|
+
),
|
139
|
+
(
|
140
|
+
VellumVideo(src="data:video/mp4;base64,mockvideo"),
|
141
|
+
[VideoInputRequest(name="file_input", value=VellumVideoRequest(src="data:video/mp4;base64,mockvideo"))],
|
142
|
+
),
|
143
|
+
(
|
144
|
+
VellumDocument(src="mockdocument"),
|
145
|
+
[DocumentInputRequest(name="file_input", value=VellumDocumentRequest(src="mockdocument"))],
|
146
|
+
),
|
147
|
+
# No casting required
|
148
|
+
(
|
149
|
+
VellumAudioRequest(src="data:audio/wav;base64,mockaudio"),
|
150
|
+
[AudioInputRequest(name="file_input", value=VellumAudioRequest(src="data:audio/wav;base64,mockaudio"))],
|
151
|
+
),
|
152
|
+
(
|
153
|
+
VellumImageRequest(src="data:image/png;base64,mockimage"),
|
154
|
+
[ImageInputRequest(name="file_input", value=VellumImageRequest(src="data:image/png;base64,mockimage"))],
|
155
|
+
),
|
156
|
+
(
|
157
|
+
VellumVideoRequest(src="data:video/mp4;base64,mockvideo"),
|
158
|
+
[VideoInputRequest(name="file_input", value=VellumVideoRequest(src="data:video/mp4;base64,mockvideo"))],
|
159
|
+
),
|
160
|
+
(
|
161
|
+
VellumDocumentRequest(src="mockdocument"),
|
162
|
+
[DocumentInputRequest(name="file_input", value=VellumDocumentRequest(src="mockdocument"))],
|
163
|
+
),
|
164
|
+
],
|
165
|
+
)
|
166
|
+
def test_file_input_compilation(raw_input, expected_compiled_inputs):
|
167
|
+
# GIVEN a prompt node with file input
|
168
|
+
class MyPromptDeploymentNode(PromptDeploymentNode):
|
169
|
+
deployment = "DEPLOYMENT"
|
170
|
+
prompt_inputs = {"file_input": raw_input}
|
171
|
+
ml_model_fallbacks = None
|
172
|
+
|
173
|
+
# WHEN we compile the inputs
|
174
|
+
compiled_inputs = MyPromptDeploymentNode()._compile_prompt_inputs()
|
175
|
+
|
176
|
+
# THEN we should get the correct input type
|
177
|
+
assert compiled_inputs == expected_compiled_inputs
|
File without changes
|
File without changes
|
File without changes
|