vellum-ai 0.14.2__py3-none-any.whl → 0.14.3__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.
@@ -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.2",
21
+ "X-Fern-SDK-Version": "0.14.3",
22
22
  }
23
23
  headers["X_API_KEY"] = self.api_key
24
24
  return headers
@@ -19,7 +19,7 @@ from vellum.client.types.vellum_audio import VellumAudio
19
19
  from vellum.client.types.vellum_image import VellumImage
20
20
  from vellum.prompts.blocks.exceptions import PromptCompilationError
21
21
  from vellum.prompts.blocks.types import CompiledChatMessagePromptBlock, CompiledPromptBlock, CompiledValuePromptBlock
22
- from vellum.utils.templating.constants import DEFAULT_JINJA_CUSTOM_FILTERS
22
+ from vellum.utils.templating.constants import DEFAULT_JINJA_CUSTOM_FILTERS, DEFAULT_JINJA_GLOBALS
23
23
  from vellum.utils.templating.render import render_sandboxed_jinja_template
24
24
  from vellum.utils.typing import cast_not_optional
25
25
 
@@ -74,7 +74,7 @@ def compile_prompt_blocks(
74
74
  template=block.template,
75
75
  input_values={name: inp.value for name, inp in inputs_by_name.items()},
76
76
  jinja_custom_filters=DEFAULT_JINJA_CUSTOM_FILTERS,
77
- jinja_globals=DEFAULT_JINJA_CUSTOM_FILTERS,
77
+ jinja_globals=DEFAULT_JINJA_GLOBALS,
78
78
  )
79
79
  jinja_content = StringVellumValue(value=rendered_template)
80
80
 
@@ -37,6 +37,14 @@ from vellum.prompts.blocks.types import CompiledChatMessagePromptBlock, Compiled
37
37
  CompiledValuePromptBlock(content=StringVellumValue(value="Repeat back to me Hello, world!")),
38
38
  ],
39
39
  ),
40
+ (
41
+ [JinjaPromptBlock(template="{{ re.search('test', message).group() }}")],
42
+ [PromptRequestStringInput(key="message", value="testing")],
43
+ [VellumVariable(id="1", type="STRING", key="message")],
44
+ [
45
+ CompiledValuePromptBlock(content=StringVellumValue(value="test")),
46
+ ],
47
+ ),
40
48
  # Rich Text
41
49
  (
42
50
  [
@@ -127,6 +135,7 @@ from vellum.prompts.blocks.types import CompiledChatMessagePromptBlock, Compiled
127
135
  "empty",
128
136
  "jinja-no-variables",
129
137
  "jinja-with-variables",
138
+ "jinja-with-custom-global",
130
139
  "rich-text-no-variables",
131
140
  "rich-text-with-variables",
132
141
  "chat-message",
@@ -9,7 +9,7 @@ from vellum.workflows.state.encoder import DefaultStateEncoder
9
9
 
10
10
 
11
11
  def finalize(obj: Any) -> str:
12
- if isinstance(obj, dict):
12
+ if isinstance(obj, (dict, list)):
13
13
  return json.dumps(obj, cls=DefaultStateEncoder)
14
14
 
15
15
  return str(obj)
@@ -220,3 +220,17 @@ def test_templating_node__replace_filter():
220
220
  },
221
221
  }
222
222
  ]
223
+
224
+
225
+ def test_templating_node__last_chat_message():
226
+ # GIVEN a templating node that outputs a complex object
227
+ class LastChatMessageTemplateNode(TemplatingNode[BaseState, List[ChatMessage]]):
228
+ template = """{{ chat_history[:-1] }}"""
229
+ inputs = {"chat_history": [ChatMessage(role="USER", text="Hello"), ChatMessage(role="ASSISTANT", text="World")]}
230
+
231
+ # WHEN the node is run
232
+ node = LastChatMessageTemplateNode()
233
+ outputs = node.run()
234
+
235
+ # THEN the output is the expected JSON
236
+ assert outputs.result == [ChatMessage(role="USER", text="Hello")]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vellum-ai
3
- Version: 0.14.2
3
+ Version: 0.14.3
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.9,<4.0
@@ -19,7 +19,7 @@ vellum_ee/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  vellum_ee/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
20
  vellum_ee/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
21
  vellum_ee/workflows/display/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
- vellum_ee/workflows/display/base.py,sha256=i8o7Ex0S9BVub_91s6D2a8kHGcv3ro5XGEwSzeVSz-Y,2083
22
+ vellum_ee/workflows/display/base.py,sha256=ak29FIsawhaFa9_paZUHThlZRFJ1xB486JWKuSt1PYY,1965
23
23
  vellum_ee/workflows/display/nodes/__init__.py,sha256=5XOcZJXYUgaLS55QgRJzyQ_W1tpeprjnYAeYVezqoGw,160
24
24
  vellum_ee/workflows/display/nodes/base_node_display.py,sha256=En8Ir2e1mpExkAi1T8ExOEpZbv5gu6OetaNq35-_WSY,16317
25
25
  vellum_ee/workflows/display/nodes/base_node_vellum_display.py,sha256=pLO0dORfRu--Ne9NgoyFT_CNjfpr5fGCsgbsMkUF5GM,2845
@@ -36,7 +36,7 @@ vellum_ee/workflows/display/nodes/vellum/error_node.py,sha256=I1Jkp2htRINJATtv1e
36
36
  vellum_ee/workflows/display/nodes/vellum/final_output_node.py,sha256=p-PvlnxpBQ7IKskZi2A19jKAtKnSxJ8LPbGMA83VkFk,2805
37
37
  vellum_ee/workflows/display/nodes/vellum/guardrail_node.py,sha256=aYZSJTxknU4LMiQdWk9LcK6CkhdozeDEMiRxfAyUNEc,2202
38
38
  vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py,sha256=aNZhjw5CwpUO8IcLJ2nhYrzn96RJ3FWeJXdfDizuPzw,8491
39
- vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py,sha256=9858pFzuhkAAmLcw4gkt5mPvsqWk5vqcX_vwHOg2xZw,5610
39
+ vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py,sha256=MU9I8CB1X1TgL1aa1eT6DHWwNJ-2v79t74xl0oy-fBo,5510
40
40
  vellum_ee/workflows/display/nodes/vellum/map_node.py,sha256=VlO3UwkspCOdDQ-h3v8k16-7JZwWNSLpOLT4p-eirIs,3740
41
41
  vellum_ee/workflows/display/nodes/vellum/merge_node.py,sha256=HkNMgdQELiON42jdO-xDLmqrEKdGx1RVqrz2DXNTLS8,3239
42
42
  vellum_ee/workflows/display/nodes/vellum/note_node.py,sha256=TMb8txILu2uWjzoxaghjgjlzeBAgzn4vkP_8zSh2qoE,1151
@@ -80,16 +80,16 @@ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_templating_n
80
80
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py,sha256=NdhE3lm7RMQ8DqkraPSq24IbOxNla9unbs4tsMWRzm4,3781
81
81
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_try_node_serialization.py,sha256=gHKU8Vg960ooV3uXqM2LMnVS-mGbv3aagGozQuTVTjI,2455
82
82
  vellum_ee/workflows/display/tests/workflow_serialization/test_complex_terminal_node_serialization.py,sha256=huKAOeMJ2MKmp6XtbvMJTUadqynoV40Ypoz9jsBEBEQ,7431
83
- vellum_ee/workflows/display/types.py,sha256=bm355ZcZ-7WaesBvIB8RbWDD7qiFmazfcNb6tEZWx3M,2940
83
+ vellum_ee/workflows/display/types.py,sha256=xDC1zy4rWKNqDtSr-h6MQfWnJ6scZ_Sadxp4t8Q3PY4,2897
84
84
  vellum_ee/workflows/display/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
85
85
  vellum_ee/workflows/display/utils/expressions.py,sha256=9FpOslDI-RCR5m4TgAu9KCHh4aTVnh7CHR2ykyMUDw0,1151
86
86
  vellum_ee/workflows/display/utils/vellum.py,sha256=UjK_RxnSEmlIu9klGCPWU5RAQBmgZ7cRbRdgxaTbubE,8081
87
- vellum_ee/workflows/display/vellum.py,sha256=iiBzMIHTnRb-Xb4Q9-26vOxPpK_rDPKBlky3dBew8Gg,8480
87
+ vellum_ee/workflows/display/vellum.py,sha256=0Uwe1NJA_7trwSqqqaYwilqRp6_u2GqOwSNbgTVlgZE,8638
88
88
  vellum_ee/workflows/display/workflows/__init__.py,sha256=kapXsC67VJcgSuiBMa86FdePG5A9kMB5Pi4Uy1O2ob4,207
89
- vellum_ee/workflows/display/workflows/base_workflow_display.py,sha256=Amow11LhE-GL3j8bNZ8rK1iYKjkNOhH1ECMQ-dvyLAU,17204
89
+ vellum_ee/workflows/display/workflows/base_workflow_display.py,sha256=mqP81wMam8Xl0g0qeBrFiCfpUdKqlwySINK28UU8EzM,16974
90
90
  vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py,sha256=kp0u8LN_2IwshLrhMImhpZx1hRyAcD5gXY-kDuuaGMQ,1269
91
91
  vellum_ee/workflows/display/workflows/tests/test_workflow_display.py,sha256=yl1ytpl9_lijOGeDPWSypWYRJ7aOEVA7NgUg81jTuCs,2229
92
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py,sha256=8roVFJ4SWrMRNpptwwneVcE6kJmoVtJPN-fmkfDNb7Q,19102
92
+ vellum_ee/workflows/display/workflows/vellum_workflow_display.py,sha256=3UHe61Em1Tj68ZAR4B6Ucas_vc1BuHlqwbicN-aJMys,17828
93
93
  vellum_ee/workflows/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
94
  vellum_ee/workflows/server/virtual_file_loader.py,sha256=X_DdNK7MfyOjKWekk6YQpOSCT6klKcdjT6nVJcBH1sM,1481
95
95
  vellum_ee/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -104,7 +104,7 @@ vellum_ee/workflows/tests/local_workflow/display/__init__.py,sha256=xo75Uqb4aErO
104
104
  vellum_ee/workflows/tests/local_workflow/display/nodes/__init__.py,sha256=szW_mgOUriyZ6v1vlnevBgkzNi8g83-ihS98UOLHVcE,155
105
105
  vellum_ee/workflows/tests/local_workflow/display/nodes/final_output.py,sha256=Kv92TCREiZsB9531KZYaBIq83uHn7e_ECw_yAbD1qfk,1017
106
106
  vellum_ee/workflows/tests/local_workflow/display/nodes/templating_node.py,sha256=5cankEe1rDZlXKgILFSPbmN0tUZhIdmcFgz_AguXTJc,1229
107
- vellum_ee/workflows/tests/local_workflow/display/workflow.py,sha256=XJCmx64TCsD2Zt55Q5SISdXSr1NO7n5xenkOtCk0WXI,2151
107
+ vellum_ee/workflows/tests/local_workflow/display/workflow.py,sha256=QV-TyH6FeqOZ53U8kj3m_annpYgRynG_hfrOuoV1cmk,2051
108
108
  vellum_ee/workflows/tests/local_workflow/inputs.py,sha256=4cgsZBoUbIY0Rs8gknC9yqxQ-sSoULclx_SAm1FT2RA,96
109
109
  vellum_ee/workflows/tests/local_workflow/metadata.json,sha256=rdu3h5qkFZiqhCAMxoyoWyMI0O8QALC5-URvSIW6F00,24
110
110
  vellum_ee/workflows/tests/local_workflow/nodes/__init__.py,sha256=1F6jxUpSKfPXPj4ZZKSbnX6Mg-VwF3euLJSZfGn6xkM,127
@@ -119,7 +119,7 @@ vellum/client/README.md,sha256=JkCJjmMZl4jrPj46pkmL9dpK4gSzQQmP5I7z4aME4LY,4749
119
119
  vellum/client/__init__.py,sha256=j6zi0NZ4BMC6JrwckvzMWuG5x8KoOvO4KqsLhvVCa68,117624
120
120
  vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
121
121
  vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
122
- vellum/client/core/client_wrapper.py,sha256=r8ZNshVLkA2wiH4k5knCrjqc-qjeEZ06Cpf5iE7nQ-g,1868
122
+ vellum/client/core/client_wrapper.py,sha256=5MqSBkzxbM11wbTg4CUjaavYf5Rv9t5-_lqijxHjmU8,1868
123
123
  vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
124
124
  vellum/client/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
125
125
  vellum/client/core/http_client.py,sha256=R0pQpCppnEtxccGvXl4uJ76s7ro_65Fo_erlNNLp_AI,19228
@@ -709,10 +709,10 @@ vellum/plugins/utils.py,sha256=U9ZY9KdE3RRvbcG01hXxu9CvfJD6Fo7nJDgcHjQn0FI,606
709
709
  vellum/plugins/vellum_mypy.py,sha256=QTuMSq6PiZW1dyTUZ5Bf1d4XkgFj0TKAgZLP8f4UgL4,27914
710
710
  vellum/prompts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
711
711
  vellum/prompts/blocks/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
712
- vellum/prompts/blocks/compilation.py,sha256=P2gdL4bRR1j0IbvQFzS13cJzGpnaDZFhdV3x5COVvs0,9481
712
+ vellum/prompts/blocks/compilation.py,sha256=lpGVuquFaHnGglON7-S8fIHgUIZyo6TdXOmBtG_Si-0,9497
713
713
  vellum/prompts/blocks/exceptions.py,sha256=vmk5PV6Vyw9nKjZYQDUDW0LH8MfQNIgFvFb_mFWdIRI,50
714
714
  vellum/prompts/blocks/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
715
- vellum/prompts/blocks/tests/test_compilation.py,sha256=WhR8L7AzxssZiizItAbbtQMXZ3An5RMUws0kfCwJBgw,4841
715
+ vellum/prompts/blocks/tests/test_compilation.py,sha256=EOUtdzJDFGbGhoc_y5XTMyO0HOpOM7FYJssPzd_yRVg,5235
716
716
  vellum/prompts/blocks/types.py,sha256=6aSJQco-5kKeadfKVVXF_SrQPlIJgMYVNc-C7so1sY8,975
717
717
  vellum/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
718
718
  vellum/resources/__init__.py,sha256=sQWK7g_Z4EM7pa7fy6vy3d_DMdTJ4wVcozBn3Lx4Qpo,141
@@ -1262,7 +1262,7 @@ vellum/utils/templating/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
1262
1262
  vellum/utils/templating/constants.py,sha256=8OHMO6WFAEimbIaiHc5gy6s91D7_KvW-vTlEMWwvl_M,711
1263
1263
  vellum/utils/templating/custom_filters.py,sha256=XVHriwazejRZmxB_eg4xHgCxl7AiQQ2sx-hRLMmylfU,885
1264
1264
  vellum/utils/templating/exceptions.py,sha256=cDp140PP4OnInW4qAvg3KqiSiF70C71UyEAKRBR1Abo,46
1265
- vellum/utils/templating/render.py,sha256=ooQxCiBMAizPVfwJsIPS2feSBUuoalR1UeJMO0Df-3s,2029
1265
+ vellum/utils/templating/render.py,sha256=5OsD1e9fks1aysYTyPKjYGaloYUbIKWpajcxtjtiFuU,2037
1266
1266
  vellum/utils/templating/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1267
1267
  vellum/utils/templating/tests/test_custom_filters.py,sha256=mkJwc7t1gE13SKgPxhF-lN_m2XGCkphCB9Te81dGekI,532
1268
1268
  vellum/utils/typing.py,sha256=wx_daFqD69cYkuJTVnvNrpjhqC3uuhbnyJ9_bIwC9OU,327
@@ -1351,7 +1351,7 @@ vellum/workflows/nodes/core/retry_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TI
1351
1351
  vellum/workflows/nodes/core/retry_node/tests/test_node.py,sha256=RM_OHwxrHwyxvlQQBJPqVBxpedFuWQ9h2-Xa3kP75sc,4399
1352
1352
  vellum/workflows/nodes/core/templating_node/__init__.py,sha256=GmyuYo81_A1_Bz6id69ozVFS6FKiuDsZTiA3I6MaL2U,70
1353
1353
  vellum/workflows/nodes/core/templating_node/node.py,sha256=Vqlg4L-5XNuIdbZKQe-GEYqTIV7iXNjLO7QIRgz4ujc,3722
1354
- vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py,sha256=-53Vh0YOnk8sAcmZ7drdKgBcSCj68DYts5-jFNNsPRE,6755
1354
+ vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py,sha256=nY2P6r7cW85k7NEKXUFNeDTMWlz8ZEZyMY2Sg-0qO_E,7327
1355
1355
  vellum/workflows/nodes/core/try_node/__init__.py,sha256=JVD4DrldTIqFQQFrubs9KtWCCc0YCAc7Fzol5ZWIWeM,56
1356
1356
  vellum/workflows/nodes/core/try_node/node.py,sha256=bk2uhYUl10yaPJlOBWxiL7igTUrL_7mM9S2nvsdWB68,4242
1357
1357
  vellum/workflows/nodes/core/try_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1473,8 +1473,8 @@ vellum/workflows/workflows/base.py,sha256=tBivLLLPtMyMi2Bd5WjbwQ2_zZFpG8rNfEidfQ
1473
1473
  vellum/workflows/workflows/event_filters.py,sha256=GSxIgwrX26a1Smfd-6yss2abGCnadGsrSZGa7t7LpJA,2008
1474
1474
  vellum/workflows/workflows/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1475
1475
  vellum/workflows/workflows/tests/test_base_workflow.py,sha256=dz5F3DuGOk9qUMjmNd-GdEE3320G5ko5nJ6J0QJyVcY,2659
1476
- vellum_ai-0.14.2.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1477
- vellum_ai-0.14.2.dist-info/METADATA,sha256=w083H2Gds-z_b4DPwlYGdnCjD-UXv1q_3CqQAZtSLvI,5407
1478
- vellum_ai-0.14.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1479
- vellum_ai-0.14.2.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1480
- vellum_ai-0.14.2.dist-info/RECORD,,
1476
+ vellum_ai-0.14.3.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1477
+ vellum_ai-0.14.3.dist-info/METADATA,sha256=4Q0I2ydIobyCxpBPpfRJgFtoGEfWnlteA_j2XUuFvME,5407
1478
+ vellum_ai-0.14.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
1479
+ vellum_ai-0.14.3.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1480
+ vellum_ai-0.14.3.dist-info/RECORD,,
@@ -74,14 +74,15 @@ EntrypointDisplayOverridesType = TypeVar("EntrypointDisplayOverridesType", bound
74
74
 
75
75
 
76
76
  @dataclass
77
- class WorkflowOutputDisplayOverrides:
77
+ class WorkflowOutputDisplay:
78
78
  id: UUID
79
+ name: str
79
80
 
80
81
 
81
82
  @dataclass
82
- class WorkflowOutputDisplay(WorkflowOutputDisplayOverrides):
83
- pass
84
-
83
+ class WorkflowOutputDisplayOverrides(WorkflowOutputDisplay):
84
+ """
85
+ DEPRECATED: Use WorkflowOutputDisplay instead. Will be removed in 0.15.0
86
+ """
85
87
 
86
- WorkflowOutputDisplayType = TypeVar("WorkflowOutputDisplayType", bound=WorkflowOutputDisplay)
87
- WorkflowOutputDisplayOverridesType = TypeVar("WorkflowOutputDisplayOverridesType", bound=WorkflowOutputDisplayOverrides)
88
+ pass
@@ -1,5 +1,5 @@
1
1
  from uuid import UUID
2
- from typing import ClassVar, Dict, Generic, List, Optional, Tuple, Type, TypeVar, cast
2
+ from typing import ClassVar, Dict, Generic, List, Optional, Tuple, Type, TypeVar
3
3
 
4
4
  from vellum import VellumVariable
5
5
  from vellum.workflows.inputs.base import BaseInputs
@@ -10,7 +10,7 @@ from vellum_ee.workflows.display.nodes.utils import raise_if_descriptor
10
10
  from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
11
11
  from vellum_ee.workflows.display.types import WorkflowDisplayContext
12
12
  from vellum_ee.workflows.display.utils.vellum import infer_vellum_variable_type
13
- from vellum_ee.workflows.display.vellum import NodeInput, WorkflowOutputVellumDisplay
13
+ from vellum_ee.workflows.display.vellum import NodeInput
14
14
  from vellum_ee.workflows.display.workflows.get_vellum_workflow_display_class import get_workflow_display
15
15
 
16
16
  _InlineSubworkflowNodeType = TypeVar("_InlineSubworkflowNodeType", bound=InlineSubworkflowNode)
@@ -110,9 +110,7 @@ class BaseInlineSubworkflowNodeDisplay(
110
110
  ) -> List[VellumVariable]:
111
111
  workflow_outputs: List[VellumVariable] = []
112
112
  for output_descriptor in raise_if_descriptor(node.subworkflow).Outputs: # type: ignore[union-attr]
113
- workflow_output_display = cast(
114
- WorkflowOutputVellumDisplay, display_context.workflow_output_displays[output_descriptor]
115
- )
113
+ workflow_output_display = display_context.workflow_output_displays[output_descriptor]
116
114
  output_type = infer_vellum_variable_type(output_descriptor)
117
115
  workflow_outputs.append(
118
116
  VellumVariable(id=str(workflow_output_display.id), key=workflow_output_display.name, type=output_type)
@@ -13,7 +13,7 @@ from vellum_ee.workflows.display.base import (
13
13
  StateValueDisplayType,
14
14
  WorkflowInputsDisplayType,
15
15
  WorkflowMetaDisplayType,
16
- WorkflowOutputDisplayType,
16
+ WorkflowOutputDisplay,
17
17
  )
18
18
 
19
19
  if TYPE_CHECKING:
@@ -45,7 +45,6 @@ class WorkflowDisplayContext(
45
45
  StateValueDisplayType,
46
46
  NodeDisplayType,
47
47
  EntrypointDisplayType,
48
- WorkflowOutputDisplayType,
49
48
  EdgeDisplayType,
50
49
  ]
51
50
  ):
@@ -63,6 +62,6 @@ class WorkflowDisplayContext(
63
62
  default_factory=dict
64
63
  )
65
64
  entrypoint_displays: Dict[Type[BaseNode], EntrypointDisplayType] = field(default_factory=dict)
66
- workflow_output_displays: Dict[BaseDescriptor, WorkflowOutputDisplayType] = field(default_factory=dict)
65
+ workflow_output_displays: Dict[BaseDescriptor, WorkflowOutputDisplay] = field(default_factory=dict)
67
66
  edge_displays: Dict[Tuple[Port, Type[BaseNode]], EdgeDisplayType] = field(default_factory=dict)
68
67
  port_displays: Dict[Port, "PortDisplay"] = field(default_factory=dict)
@@ -20,7 +20,6 @@ from vellum_ee.workflows.display.base import (
20
20
  WorkflowInputsDisplayOverrides,
21
21
  WorkflowMetaDisplay,
22
22
  WorkflowMetaDisplayOverrides,
23
- WorkflowOutputDisplay,
24
23
  WorkflowOutputDisplayOverrides,
25
24
  )
26
25
 
@@ -123,16 +122,23 @@ class EntrypointVellumDisplay(EntrypointVellumDisplayOverrides):
123
122
 
124
123
 
125
124
  @dataclass
126
- class WorkflowOutputVellumDisplayOverrides(WorkflowOutputDisplay, WorkflowOutputDisplayOverrides):
127
- name: str
128
- label: str
129
- node_id: UUID
125
+ class WorkflowOutputVellumDisplayOverrides(WorkflowOutputDisplayOverrides):
126
+ """
127
+ DEPRECATED: Use WorkflowOutputDisplay instead. Will be removed in 0.15.0
128
+ """
129
+
130
+ label: Optional[str] = None
131
+ node_id: Optional[UUID] = None
130
132
  display_data: Optional[NodeDisplayData] = None
131
133
  target_handle_id: Optional[UUID] = None
132
134
 
133
135
 
134
136
  @dataclass
135
137
  class WorkflowOutputVellumDisplay(WorkflowOutputVellumDisplayOverrides):
138
+ """
139
+ DEPRECATED: Use WorkflowOutputDisplay instead. Will be removed in 0.15.0
140
+ """
141
+
136
142
  pass
137
143
 
138
144
 
@@ -28,8 +28,7 @@ from vellum_ee.workflows.display.base import (
28
28
  WorkflowInputsDisplayType,
29
29
  WorkflowMetaDisplayOverridesType,
30
30
  WorkflowMetaDisplayType,
31
- WorkflowOutputDisplayOverridesType,
32
- WorkflowOutputDisplayType,
31
+ WorkflowOutputDisplay,
33
32
  )
34
33
  from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
35
34
  from vellum_ee.workflows.display.nodes.get_node_display_class import get_node_display_class
@@ -58,8 +57,6 @@ class BaseWorkflowDisplay(
58
57
  EntrypointDisplayOverridesType,
59
58
  EdgeDisplayType,
60
59
  EdgeDisplayOverridesType,
61
- WorkflowOutputDisplayType,
62
- WorkflowOutputDisplayOverridesType,
63
60
  ]
64
61
  ):
65
62
  # Used to specify the display data for a workflow.
@@ -75,7 +72,7 @@ class BaseWorkflowDisplay(
75
72
  entrypoint_displays: Dict[Type[BaseNode], EntrypointDisplayOverridesType] = {}
76
73
 
77
74
  # Used to explicitly specify display data for a workflow's outputs.
78
- output_displays: Dict[BaseDescriptor, WorkflowOutputDisplayOverridesType] = {}
75
+ output_displays: Dict[BaseDescriptor, WorkflowOutputDisplay] = {}
79
76
 
80
77
  # Used to explicitly specify display data for a workflow's edges.
81
78
  edge_displays: Dict[Tuple[Port, Type[BaseNode]], EdgeDisplayOverridesType] = {}
@@ -101,7 +98,6 @@ class BaseWorkflowDisplay(
101
98
  StateValueDisplayType,
102
99
  NodeDisplayType,
103
100
  EntrypointDisplayType,
104
- WorkflowOutputDisplayType,
105
101
  EdgeDisplayType,
106
102
  ]
107
103
  ] = None,
@@ -202,7 +198,6 @@ class BaseWorkflowDisplay(
202
198
  StateValueDisplayType,
203
199
  NodeDisplayType,
204
200
  EntrypointDisplayType,
205
- WorkflowOutputDisplayType,
206
201
  EdgeDisplayType,
207
202
  ]:
208
203
  workflow_display = self._generate_workflow_meta_display()
@@ -285,7 +280,7 @@ class BaseWorkflowDisplay(
285
280
  edge, node_displays, port_displays, overrides=edge_display_overrides
286
281
  )
287
282
 
288
- workflow_output_displays: Dict[BaseDescriptor, WorkflowOutputDisplayType] = {}
283
+ workflow_output_displays: Dict[BaseDescriptor, WorkflowOutputDisplay] = {}
289
284
  for workflow_output in self._workflow.Outputs:
290
285
  if workflow_output in workflow_output_displays:
291
286
  continue
@@ -298,9 +293,9 @@ class BaseWorkflowDisplay(
298
293
  ):
299
294
  raise ValueError("Expected to find a descriptor instance on the workflow output")
300
295
 
301
- workflow_output_display_overrides = self.output_displays.get(workflow_output)
302
- workflow_output_displays[workflow_output] = self._generate_workflow_output_display(
303
- workflow_output, overrides=workflow_output_display_overrides
296
+ workflow_output_display = self.output_displays.get(workflow_output)
297
+ workflow_output_displays[workflow_output] = (
298
+ workflow_output_display or self._generate_workflow_output_display(workflow_output)
304
299
  )
305
300
 
306
301
  return WorkflowDisplayContext(
@@ -345,13 +340,10 @@ class BaseWorkflowDisplay(
345
340
  ) -> EntrypointDisplayType:
346
341
  pass
347
342
 
348
- @abstractmethod
349
- def _generate_workflow_output_display(
350
- self,
351
- output: BaseDescriptor,
352
- overrides: Optional[WorkflowOutputDisplayOverridesType] = None,
353
- ) -> WorkflowOutputDisplayType:
354
- pass
343
+ def _generate_workflow_output_display(self, output: BaseDescriptor) -> WorkflowOutputDisplay:
344
+ output_id = uuid4_from_hash(f"{self.workflow_id}|id|{output.name}")
345
+
346
+ return WorkflowOutputDisplay(id=output_id, name=output.name)
355
347
 
356
348
  @abstractmethod
357
349
  def _generate_edge_display(
@@ -31,8 +31,6 @@ from vellum_ee.workflows.display.vellum import (
31
31
  WorkflowInputsVellumDisplayOverrides,
32
32
  WorkflowMetaVellumDisplay,
33
33
  WorkflowMetaVellumDisplayOverrides,
34
- WorkflowOutputVellumDisplay,
35
- WorkflowOutputVellumDisplayOverrides,
36
34
  )
37
35
  from vellum_ee.workflows.display.workflows.base_workflow_display import BaseWorkflowDisplay
38
36
 
@@ -53,8 +51,6 @@ class VellumWorkflowDisplay(
53
51
  EntrypointVellumDisplayOverrides,
54
52
  EdgeVellumDisplay,
55
53
  EdgeVellumDisplayOverrides,
56
- WorkflowOutputVellumDisplay,
57
- WorkflowOutputVellumDisplayOverrides,
58
54
  ]
59
55
  ):
60
56
  node_display_base_class = BaseNodeDisplay
@@ -144,7 +140,7 @@ class VellumWorkflowDisplay(
144
140
 
145
141
  # Add a synthetic Terminal Node and track the Workflow's output variables for each Workflow output
146
142
  for workflow_output, workflow_output_display in self.display_context.workflow_output_displays.items():
147
- final_output_node_id = workflow_output_display.node_id
143
+ final_output_node_id = uuid4_from_hash(f"{self.workflow_id}|node_id|{workflow_output.name}")
148
144
  inferred_type = infer_vellum_variable_type(workflow_output)
149
145
 
150
146
  # Remove the terminal node output from the unreferenced set
@@ -176,22 +172,17 @@ class VellumWorkflowDisplay(
176
172
  except IndexError:
177
173
  source_node_display = None
178
174
 
179
- synthetic_target_handle_id = (
180
- str(workflow_output_display.target_handle_id)
181
- if workflow_output_display.target_handle_id
182
- else str(uuid4_from_hash(f"{self.workflow_id}|target_handle_id|{workflow_output_display.name}"))
183
- )
184
- synthetic_display_data = (
185
- workflow_output_display.display_data.dict()
186
- if workflow_output_display.display_data
187
- else NodeDisplayData().dict()
175
+ synthetic_target_handle_id = str(
176
+ uuid4_from_hash(f"{self.workflow_id}|target_handle_id|{workflow_output_display.name}")
188
177
  )
178
+ synthetic_display_data = NodeDisplayData().dict()
179
+ synthetic_node_label = "Final Output"
189
180
  nodes.append(
190
181
  {
191
182
  "id": str(final_output_node_id),
192
183
  "type": "TERMINAL",
193
184
  "data": {
194
- "label": workflow_output_display.label,
185
+ "label": synthetic_node_label,
195
186
  "name": workflow_output_display.name,
196
187
  "target_handle_id": synthetic_target_handle_id,
197
188
  "output_id": str(workflow_output_display.id),
@@ -220,7 +211,7 @@ class VellumWorkflowDisplay(
220
211
  "id": str(uuid4_from_hash(f"{self.workflow_id}|edge_id|{workflow_output_display.name}")),
221
212
  "source_node_id": str(source_node_display.node_id),
222
213
  "source_handle_id": str(source_handle_id),
223
- "target_node_id": str(workflow_output_display.node_id),
214
+ "target_node_id": str(final_output_node_id),
224
215
  "target_handle_id": synthetic_target_handle_id,
225
216
  "type": "DEFAULT",
226
217
  }
@@ -365,31 +356,6 @@ class VellumWorkflowDisplay(
365
356
 
366
357
  return EntrypointVellumDisplay(id=entrypoint_id, edge_display=edge_display)
367
358
 
368
- def _generate_workflow_output_display(
369
- self,
370
- output: BaseDescriptor,
371
- overrides: Optional[WorkflowOutputVellumDisplayOverrides] = None,
372
- ) -> WorkflowOutputVellumDisplay:
373
- if overrides:
374
- return WorkflowOutputVellumDisplay(
375
- id=overrides.id,
376
- name=overrides.name,
377
- label=overrides.label,
378
- node_id=overrides.node_id,
379
- target_handle_id=overrides.target_handle_id,
380
- display_data=overrides.display_data,
381
- )
382
-
383
- output_id = uuid4_from_hash(f"{self.workflow_id}|id|{output.name}")
384
- node_id = uuid4_from_hash(f"{self.workflow_id}|node_id|{output.name}")
385
-
386
- return WorkflowOutputVellumDisplay(
387
- id=output_id,
388
- node_id=node_id,
389
- name=output.name,
390
- label="Final Output",
391
- )
392
-
393
359
  def _generate_edge_display(
394
360
  self,
395
361
  edge: Edge,
@@ -47,8 +47,6 @@ class WorkflowDisplay(VellumWorkflowDisplay[Workflow]):
47
47
  output_displays = {
48
48
  Workflow.Outputs.final_output: WorkflowOutputVellumDisplayOverrides(
49
49
  id=UUID("5469b810-6ea6-4362-9e79-e360d44a1405"),
50
- node_id=UUID("f3ef4b2b-fec9-4026-9cc6-e5eac295307f"),
51
50
  name="final-output",
52
- label="Final Output",
53
51
  )
54
52
  }