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

Sign up to get free protection for your applications and to get access to all the features.
vellum/__init__.py CHANGED
@@ -319,6 +319,7 @@ from .types import (
319
319
  SentenceChunkingRequest,
320
320
  SlimDeploymentRead,
321
321
  SlimDocument,
322
+ SlimDocumentDocumentToDocumentIndex,
322
323
  SlimWorkflowDeployment,
323
324
  StreamingAdHocExecutePromptEvent,
324
325
  StreamingExecutePromptEvent,
@@ -851,6 +852,7 @@ __all__ = [
851
852
  "SentenceChunkingRequest",
852
853
  "SlimDeploymentRead",
853
854
  "SlimDocument",
855
+ "SlimDocumentDocumentToDocumentIndex",
854
856
  "SlimWorkflowDeployment",
855
857
  "StreamingAdHocExecutePromptEvent",
856
858
  "StreamingExecutePromptEvent",
@@ -17,7 +17,7 @@ class BaseClientWrapper:
17
17
  headers: typing.Dict[str, str] = {
18
18
  "X-Fern-Language": "Python",
19
19
  "X-Fern-SDK-Name": "vellum-ai",
20
- "X-Fern-SDK-Version": "0.11.1",
20
+ "X-Fern-SDK-Version": "0.11.2",
21
21
  }
22
22
  headers["X_API_KEY"] = self.api_key
23
23
  return headers
@@ -330,6 +330,7 @@ from .sentence_chunking import SentenceChunking
330
330
  from .sentence_chunking_request import SentenceChunkingRequest
331
331
  from .slim_deployment_read import SlimDeploymentRead
332
332
  from .slim_document import SlimDocument
333
+ from .slim_document_document_to_document_index import SlimDocumentDocumentToDocumentIndex
333
334
  from .slim_workflow_deployment import SlimWorkflowDeployment
334
335
  from .streaming_ad_hoc_execute_prompt_event import StreamingAdHocExecutePromptEvent
335
336
  from .streaming_execute_prompt_event import StreamingExecutePromptEvent
@@ -839,6 +840,7 @@ __all__ = [
839
840
  "SentenceChunkingRequest",
840
841
  "SlimDeploymentRead",
841
842
  "SlimDocument",
843
+ "SlimDocumentDocumentToDocumentIndex",
842
844
  "SlimWorkflowDeployment",
843
845
  "StreamingAdHocExecutePromptEvent",
844
846
  "StreamingExecutePromptEvent",
@@ -8,6 +8,10 @@ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
8
 
9
9
 
10
10
  class DocumentDocumentToDocumentIndex(UniversalBaseModel):
11
+ """
12
+ A detailed representation of the link between a Document and a Document Index it's a member of.
13
+ """
14
+
11
15
  id: str = pydantic.Field()
12
16
  """
13
17
  Vellum-generated ID that uniquely identifies this link.
@@ -29,6 +33,8 @@ class DocumentDocumentToDocumentIndex(UniversalBaseModel):
29
33
  - `FAILED` - Failed
30
34
  """
31
35
 
36
+ extracted_text_file_url: typing.Optional[str] = None
37
+
32
38
  if IS_PYDANTIC_V2:
33
39
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
34
40
  else:
@@ -7,7 +7,7 @@ import datetime as dt
7
7
  from .document_processing_state import DocumentProcessingState
8
8
  from .processing_failure_reason_enum import ProcessingFailureReasonEnum
9
9
  from .document_status import DocumentStatus
10
- from .document_document_to_document_index import DocumentDocumentToDocumentIndex
10
+ from .slim_document_document_to_document_index import SlimDocumentDocumentToDocumentIndex
11
11
  from ..core.pydantic_utilities import IS_PYDANTIC_V2
12
12
 
13
13
 
@@ -58,7 +58,7 @@ class SlimDocument(UniversalBaseModel):
58
58
  A previously supplied JSON object containing metadata that can be filtered on when searching.
59
59
  """
60
60
 
61
- document_to_document_indexes: typing.List[DocumentDocumentToDocumentIndex]
61
+ document_to_document_indexes: typing.List[SlimDocumentDocumentToDocumentIndex]
62
62
 
63
63
  if IS_PYDANTIC_V2:
64
64
  model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
@@ -0,0 +1,43 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from ..core.pydantic_utilities import UniversalBaseModel
4
+ import pydantic
5
+ import typing
6
+ from .indexing_state_enum import IndexingStateEnum
7
+ from ..core.pydantic_utilities import IS_PYDANTIC_V2
8
+
9
+
10
+ class SlimDocumentDocumentToDocumentIndex(UniversalBaseModel):
11
+ """
12
+ A slim representation of the link between a Document and a Document Index it's a member of.
13
+ """
14
+
15
+ id: str = pydantic.Field()
16
+ """
17
+ Vellum-generated ID that uniquely identifies this link.
18
+ """
19
+
20
+ document_index_id: str = pydantic.Field()
21
+ """
22
+ Vellum-generated ID that uniquely identifies the index this document is included in.
23
+ """
24
+
25
+ indexing_state: typing.Optional[IndexingStateEnum] = pydantic.Field(default=None)
26
+ """
27
+ An enum value representing where this document is along its indexing lifecycle for this index.
28
+
29
+ - `AWAITING_PROCESSING` - Awaiting Processing
30
+ - `QUEUED` - Queued
31
+ - `INDEXING` - Indexing
32
+ - `INDEXED` - Indexed
33
+ - `FAILED` - Failed
34
+ """
35
+
36
+ if IS_PYDANTIC_V2:
37
+ model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
38
+ else:
39
+
40
+ class Config:
41
+ frozen = True
42
+ smart_union = True
43
+ extra = pydantic.Extra.allow
@@ -0,0 +1,3 @@
1
+ # WARNING: This file will be removed in a future release. Please import from "vellum.client" instead.
2
+
3
+ from vellum.client.types.slim_document_document_to_document_index import *
@@ -30,7 +30,7 @@ if TYPE_CHECKING:
30
30
  from vellum.workflows.nodes.bases import BaseNode
31
31
  from vellum.workflows.state.base import BaseState
32
32
 
33
- _T = TypeVar("_T")
33
+ _T = TypeVar("_T", covariant=True)
34
34
  _O = TypeVar("_O")
35
35
  _O2 = TypeVar("_O2")
36
36
 
@@ -25,7 +25,7 @@ def test_base_node__node_resolution__unset_pydantic_fields():
25
25
  assert node.data.dict() == my_data.dict()
26
26
 
27
27
 
28
- def test_base_node__node_resolution__descriptor_in_dict():
28
+ def test_base_node__node_resolution__descriptors_in_dict():
29
29
  # GIVEN an Input and State class
30
30
  class Inputs(BaseInputs):
31
31
  hello: str
@@ -3,14 +3,18 @@ from queue import Empty, Queue
3
3
  from threading import Thread
4
4
  from typing import TYPE_CHECKING, Callable, Dict, Generic, List, Optional, Tuple, Type, TypeVar, Union, overload
5
5
 
6
+ from vellum.workflows.context import execution_context, get_parent_context
6
7
  from vellum.workflows.descriptors.base import BaseDescriptor
7
8
  from vellum.workflows.errors.types import VellumErrorCode
9
+ from vellum.workflows.events.types import ParentContext
8
10
  from vellum.workflows.exceptions import NodeException
9
11
  from vellum.workflows.inputs.base import BaseInputs
10
12
  from vellum.workflows.nodes.bases import BaseNode
11
13
  from vellum.workflows.outputs import BaseOutputs
12
14
  from vellum.workflows.state.base import BaseState
15
+ from vellum.workflows.state.context import WorkflowContext
13
16
  from vellum.workflows.types.generics import NodeType, StateType
17
+ from vellum.workflows.workflows.event_filters import all_workflow_event_filter
14
18
 
15
19
  if TYPE_CHECKING:
16
20
  from vellum.workflows import BaseWorkflow
@@ -53,7 +57,15 @@ class MapNode(BaseNode, Generic[StateType, MapNodeItemType]):
53
57
  fulfilled_iterations: List[bool] = []
54
58
  for index, item in enumerate(self.items):
55
59
  fulfilled_iterations.append(False)
56
- thread = Thread(target=self._run_subworkflow, kwargs={"item": item, "index": index})
60
+ parent_context = get_parent_context() or self._context.parent_context
61
+ thread = Thread(
62
+ target=self._context_run_subworkflow,
63
+ kwargs={
64
+ "item": item,
65
+ "index": index,
66
+ "parent_context": parent_context,
67
+ },
68
+ )
57
69
  thread.start()
58
70
 
59
71
  try:
@@ -62,6 +74,7 @@ class MapNode(BaseNode, Generic[StateType, MapNodeItemType]):
62
74
  while map_node_event := self._event_queue.get():
63
75
  index = map_node_event[0]
64
76
  terminal_event = map_node_event[1]
77
+ self._context._emit_subworkflow_event(terminal_event)
65
78
 
66
79
  if terminal_event.name == "workflow.execution.fulfilled":
67
80
  workflow_output_vars = vars(terminal_event.outputs)
@@ -85,12 +98,22 @@ class MapNode(BaseNode, Generic[StateType, MapNodeItemType]):
85
98
  )
86
99
  except Empty:
87
100
  pass
88
-
89
101
  return self.Outputs(**mapped_items)
90
102
 
103
+ def _context_run_subworkflow(
104
+ self, *, item: MapNodeItemType, index: int, parent_context: Optional[ParentContext] = None
105
+ ) -> None:
106
+ parent_context = parent_context or self._context.parent_context
107
+ with execution_context(parent_context=parent_context):
108
+ self._run_subworkflow(item=item, index=index)
109
+
91
110
  def _run_subworkflow(self, *, item: MapNodeItemType, index: int) -> None:
92
- subworkflow = self.subworkflow(parent_state=self.state, context=self._context)
93
- events = subworkflow.stream(inputs=self.SubworkflowInputs(index=index, item=item, all_items=self.items))
111
+ context = WorkflowContext(_vellum_client=self._context._vellum_client)
112
+ subworkflow = self.subworkflow(parent_state=self.state, context=context)
113
+ events = subworkflow.stream(
114
+ inputs=self.SubworkflowInputs(index=index, item=item, all_items=self.items),
115
+ event_filter=all_workflow_event_filter,
116
+ )
94
117
 
95
118
  for event in events:
96
119
  self._event_queue.put((index, event))
@@ -1,5 +1,6 @@
1
1
  import json
2
2
 
3
+ from vellum.workflows.nodes.bases.base import BaseNode
3
4
  from vellum.workflows.nodes.core.templating_node.node import TemplatingNode
4
5
 
5
6
 
@@ -19,3 +20,23 @@ def test_templating_node__dict_output():
19
20
 
20
21
  # THEN the output is json serializable
21
22
  assert json.loads(outputs.result) == {"key": "value"}
23
+
24
+
25
+ def test_templating_node__execution_count_reference():
26
+ # GIVEN a random node
27
+ class OtherNode(BaseNode):
28
+ pass
29
+
30
+ # AND a templating node that references the execution count of the random node
31
+ class TemplateNode(TemplatingNode):
32
+ template = "{{ total }}"
33
+ inputs = {
34
+ "total": OtherNode.Execution.count,
35
+ }
36
+
37
+ # WHEN the node is run
38
+ node = TemplateNode()
39
+ outputs = node.run()
40
+
41
+ # THEN the output is just the total
42
+ assert outputs.result == "0"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vellum-ai
3
- Version: 0.11.1
3
+ Version: 0.11.3
4
4
  Summary:
5
5
  License: MIT
6
6
  Requires-Python: >=3.9,<4.0
@@ -17,7 +17,7 @@ vellum_ee/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
17
  vellum_ee/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
18
18
  vellum_ee/workflows/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  vellum_ee/workflows/display/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- vellum_ee/workflows/display/base.py,sha256=qwdT0mzR6SMSmF1hNaibvq_UDqrJPRQb1s9JHjYDlRY,1833
20
+ vellum_ee/workflows/display/base.py,sha256=3ZFUYRNKL24fBqXhKpa_Dq2W1a-a86J20dmJYA3H2eY,1755
21
21
  vellum_ee/workflows/display/nodes/__init__.py,sha256=5XOcZJXYUgaLS55QgRJzyQ_W1tpeprjnYAeYVezqoGw,160
22
22
  vellum_ee/workflows/display/nodes/base_node_display.py,sha256=3W7X1V2Lv0k6djYp60LDu-0lYVMNsEjPXmNmIQ4UW6s,5961
23
23
  vellum_ee/workflows/display/nodes/base_node_vellum_display.py,sha256=HoD3AGCMXKoHyyRJteUYlQ7DR26Srjhlrv4fZlLCyKc,1649
@@ -36,12 +36,12 @@ vellum_ee/workflows/display/nodes/vellum/guardrail_node.py,sha256=3TJvHX_Uuf_gr9
36
36
  vellum_ee/workflows/display/nodes/vellum/inline_prompt_node.py,sha256=sj-pySLVYGt032debhcQhHc5JwrALQrNCEKh3DXc8F8,7386
37
37
  vellum_ee/workflows/display/nodes/vellum/inline_subworkflow_node.py,sha256=x5wiuWbRjxNcPGu8BoBEKHwPeqCpHE-vrGjAdM5TJOs,4721
38
38
  vellum_ee/workflows/display/nodes/vellum/map_node.py,sha256=AqUlItgSZij12qRKguKVmDbbaLuDy3Cdom5uOlJPqrc,3640
39
- vellum_ee/workflows/display/nodes/vellum/merge_node.py,sha256=3fXhGIrWF7xr9lxH17SzzsDCkpXQ-99YmrAOzb-kuxw,2218
39
+ vellum_ee/workflows/display/nodes/vellum/merge_node.py,sha256=BM3nfL0-D8x91xW0MGhnJFo45ZgGLXDqdbiSGoSuXN0,3244
40
40
  vellum_ee/workflows/display/nodes/vellum/note_node.py,sha256=9VpC3h0RYOxJuRbjDwidBYlLKakkmlEnDMBh2C7lHcY,1107
41
41
  vellum_ee/workflows/display/nodes/vellum/prompt_deployment_node.py,sha256=gLRkizwyw21-Z12IyDbdOJpXayiZZd4HWd6qgZQg8sc,3106
42
42
  vellum_ee/workflows/display/nodes/vellum/search_node.py,sha256=4KHb2icxH_vHF1GvGp_9ar_flSWthXrGZk6zMa17J_8,8430
43
43
  vellum_ee/workflows/display/nodes/vellum/subworkflow_deployment_node.py,sha256=zOp4voBSgB3MR1R93wTOrsiiara_hxEAYFupLl_SvTA,2657
44
- vellum_ee/workflows/display/nodes/vellum/templating_node.py,sha256=qPu9TqXSeLYfFnydRp4T_eqHzQohv0Wxug-ixWTMLbQ,3019
44
+ vellum_ee/workflows/display/nodes/vellum/templating_node.py,sha256=UNYxoE-89agE8ugK0aWg_uN61jPqlC2VSxWHk568sN4,3324
45
45
  vellum_ee/workflows/display/nodes/vellum/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
46
46
  vellum_ee/workflows/display/nodes/vellum/tests/test_utils.py,sha256=ZUp2fmDF4JTni1NjJOIV8dJoxx22eMBskmBJFsjtEvE,3809
47
47
  vellum_ee/workflows/display/nodes/vellum/try_node.py,sha256=m4d6hi6oD-jSW_bjrlN8coVwb6ivC2amPHpePHJ-Htg,2278
@@ -56,7 +56,7 @@ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_error_node_s
56
56
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_guardrail_node_serialization.py,sha256=vA8cd7PJYhf949OUGeYP_moKtMogSyfHN2Z-qzNQLwM,8294
57
57
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_inline_subworkflow_serialization.py,sha256=N2ACycHn-EwP5paxHwDu2fufABssE293wiunhm-bCGg,22076
58
58
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_map_node_serialization.py,sha256=H1bVDG_mFPokJ7OYrnl9rM9M3gEa5bctGmhUuKccB4U,15950
59
- vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py,sha256=fITHaT72ZmP8Y1AfYsJDdfRG6mz0EE9tusQYyZnheWw,9998
59
+ vellum_ee/workflows/display/tests/workflow_serialization/test_basic_merge_node_serialization.py,sha256=vm-dRH_Y-qU9whkwBUNnhVPYL_Ua6cqpaDsDSEgRkxo,9998
60
60
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_prompt_deployment_serialization.py,sha256=NkpgaTbu6nLr3iwgsSNtiHyiNDCUaFakd1JaoW6CC6Y,9489
61
61
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_subworkflow_deployment_serialization.py,sha256=8bz0vm_EyQKSjnwS5vqqgnjE9ygvm-CaPKcwCfeOrlo,12704
62
62
  vellum_ee/workflows/display/tests/workflow_serialization/test_basic_terminal_node_serialization.py,sha256=xG8nKA1iKXxUe1fnD2X6qm7cUGW14iq2P-L16zhcKC8,4271
@@ -68,17 +68,17 @@ vellum_ee/workflows/display/utils/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5J
68
68
  vellum_ee/workflows/display/utils/tests/test_uuids.py,sha256=ItjROhaPns8_mlvD17LIBwZKvhe2l0dXEd5oL-JiY64,448
69
69
  vellum_ee/workflows/display/utils/uuids.py,sha256=DFzPv9RCvsKhvdTEIQyfSek2A31D6S_QcmeLPbgrgTY,739
70
70
  vellum_ee/workflows/display/utils/vellum.py,sha256=IlkKrfAAi4BV_HFnsdMFxNJC2-TrPM9ubVHv8ikmbSA,5110
71
- vellum_ee/workflows/display/vellum.py,sha256=62nPzLxn9cJdffwjL8vJG_1IDXXJrwaNdYeqsLNpbEQ,8800
71
+ vellum_ee/workflows/display/vellum.py,sha256=OSv0ZS50h1zJbunJ9TH7VEWFw-exXdK_ZsdzPxP9ROs,8814
72
72
  vellum_ee/workflows/display/workflows/__init__.py,sha256=kapXsC67VJcgSuiBMa86FdePG5A9kMB5Pi4Uy1O2ob4,207
73
73
  vellum_ee/workflows/display/workflows/base_workflow_display.py,sha256=HkakkrNgVFoHlUP7yHlQjHOvii3CZ90iyU1062PfoW4,12819
74
74
  vellum_ee/workflows/display/workflows/get_vellum_workflow_display_class.py,sha256=AMxNnTm2z3LIR5rqxoCAfuy37F2FTuSRDVtKUoezO8M,1184
75
- vellum_ee/workflows/display/workflows/vellum_workflow_display.py,sha256=fFs7NxrCnTRxHYOI7on9ClbRairQUc66BYRom3PeizA,17050
76
- vellum/__init__.py,sha256=tifpcqdWe2t7wU1HPqltMgM1AyY4Ruf7J06O1Dw2_Po,35436
75
+ vellum_ee/workflows/display/workflows/vellum_workflow_display.py,sha256=UiE1vJ4nzt1tHAxvXSt8qnV101I__gd5YdiPuKA4TWk,17370
76
+ vellum/__init__.py,sha256=QmGeEPXeFxgkZa849KKK3wH3Y641wyt00Rytfay6KiM,35520
77
77
  vellum/client/README.md,sha256=JkCJjmMZl4jrPj46pkmL9dpK4gSzQQmP5I7z4aME4LY,4749
78
78
  vellum/client/__init__.py,sha256=o4m7iRZWEV8rP3GkdaztHAjNmjxjWERlarviFoHzuKI,110927
79
79
  vellum/client/core/__init__.py,sha256=SQ85PF84B9MuKnBwHNHWemSGuy-g_515gFYNFhvEE0I,1438
80
80
  vellum/client/core/api_error.py,sha256=RE8LELok2QCjABadECTvtDp7qejA1VmINCh6TbqPwSE,426
81
- vellum/client/core/client_wrapper.py,sha256=GdzbbuiX9eXoSlOmj5ppAyjl_-ly0fPbAa8ecCrfSpE,1890
81
+ vellum/client/core/client_wrapper.py,sha256=XbAMOMcjdM9aXRo9_hecrehfft9oYmtBqckaIR0GAog,1890
82
82
  vellum/client/core/datetime_utils.py,sha256=nBys2IsYrhPdszxGKCNRPSOCwa-5DWOHG95FB8G9PKo,1047
83
83
  vellum/client/core/file.py,sha256=X9IbmkZmB2bB_DpmZAO3crWdXagOakAyn6UCOCImCPg,2322
84
84
  vellum/client/core/http_client.py,sha256=R0pQpCppnEtxccGvXl4uJ76s7ro_65Fo_erlNNLp_AI,19228
@@ -137,7 +137,7 @@ vellum/client/resources/workflows/types/__init__.py,sha256=-uFca4ypncAOvfsg6sjD-
137
137
  vellum/client/resources/workflows/types/workflows_pull_request_format.py,sha256=dOWE_jnDnniIJLoeseeCms23aklghyBkoPmBFzcqqZk,165
138
138
  vellum/client/resources/workspace_secrets/__init__.py,sha256=FTtvy8EDg9nNNg9WCatVgKTRYV8-_v1roeGPAKoa_pw,65
139
139
  vellum/client/resources/workspace_secrets/client.py,sha256=h7UzXLyTttPq1t-JZGMg1BWxypxJvBGUdqg7KGT7MK4,8027
140
- vellum/client/types/__init__.py,sha256=ASrY-2_D-vIek3_WlkFzGDazEJH1UG5qRdd7jsNls8Q,53636
140
+ vellum/client/types/__init__.py,sha256=618t1NgjOnUJWFFv5pS4dmOIttrTkHhMNj5F8yRlTpA,53769
141
141
  vellum/client/types/ad_hoc_execute_prompt_event.py,sha256=bCjujA2XsOgyF3bRZbcEqV2rOIymRgsLoIRtZpB14xg,607
142
142
  vellum/client/types/ad_hoc_expand_meta.py,sha256=1gv-NCsy_6xBYupLvZH979yf2VMdxAU-l0y0ynMKZaw,1331
143
143
  vellum/client/types/ad_hoc_fulfilled_prompt_execution_meta.py,sha256=Bfvf1d_dkmshxRACVM5vcxbH_7AQY23RmrrnPc0ytYY,939
@@ -210,7 +210,7 @@ vellum/client/types/deployment_read.py,sha256=NtXmYsYJOATxkMxeVkSM35XzDVGbva3RWm
210
210
  vellum/client/types/deployment_release_tag_deployment_history_item.py,sha256=df4qKHT1f-z0jnRS4UmP8MQe6u3PwYej_d8KDF7EL88,631
211
211
  vellum/client/types/deployment_release_tag_read.py,sha256=YlwssIgBd5lKVqelH-gejQXQ7l31vrsRNMJKDGDyTEA,1129
212
212
  vellum/client/types/docker_service_token.py,sha256=T0icNHBKsIs6TrEiDRjckM_f37hcF1DMwEE8161tTvY,614
213
- vellum/client/types/document_document_to_document_index.py,sha256=LbXTZyYxA4hxewquf7ZLZgBD9uWGoIs1J64x4fY7bNg,1229
213
+ vellum/client/types/document_document_to_document_index.py,sha256=V0SkL-U3LHAL8dOp0fnOjdssuldkabZVJ2QCY_l5KFE,1404
214
214
  vellum/client/types/document_index_chunking.py,sha256=TU0Y7z0Xacm3dhzEDuDIG3ZKJCu3vNURRh3PqEd17mY,356
215
215
  vellum/client/types/document_index_chunking_request.py,sha256=g9BKCsHKg5kzjG7YYeMNQ_5R8TXLeSgumJlMXoSfBcs,435
216
216
  vellum/client/types/document_index_indexing_config.py,sha256=xL1pCzUOkw5sSie1OrBpasE3bVnv0UyZBn7uZztbhbs,781
@@ -455,7 +455,8 @@ vellum/client/types/sentence_chunker_config_request.py,sha256=EpGTP4z3YttiThYmdj
455
455
  vellum/client/types/sentence_chunking.py,sha256=guqU3072X4h8Laf6LhTWQ5lpjBpTgoXRxKp5iXJby2U,783
456
456
  vellum/client/types/sentence_chunking_request.py,sha256=77gv1fVc9IaTuGGx3O1HB0LF9sXM5pSTWksl8BEmvLU,812
457
457
  vellum/client/types/slim_deployment_read.py,sha256=DIYkuill3hfoNDYpgO8oZ7Aq9KGbM09dZv2gOEPPGeQ,1826
458
- vellum/client/types/slim_document.py,sha256=x3xcsgazw5wjlA-oMLqwb4b04QFvMvJGUnc9zrobfW0,2382
458
+ vellum/client/types/slim_document.py,sha256=frw1r47C11M-AsQ5UiDMW-EIuK0JTYUrSh-s6ZPtQSA,2395
459
+ vellum/client/types/slim_document_document_to_document_index.py,sha256=XDEkftIcN4w4LguyzSw7x-V-apbmxEAk2APZfAPzyiw,1346
459
460
  vellum/client/types/slim_workflow_deployment.py,sha256=FW7qXPtSIP9QAzECbl8gKL1iFqKWTAfIjSVwNTIL6GA,2189
460
461
  vellum/client/types/streaming_ad_hoc_execute_prompt_event.py,sha256=NdgmJ3AZMp6io-whZIGnGb49aiqz6__KafsrzjEF_9o,1183
461
462
  vellum/client/types/streaming_execute_prompt_event.py,sha256=bjfY5ZU8ZI048a7x1VW8dDXMtSl-3Ej5koSpfKboJj0,1161
@@ -1024,6 +1025,7 @@ vellum/types/sentence_chunking.py,sha256=MfuUfa_lhTX3OFCLJig0D7xN9lhLOxvsxw5ywHw
1024
1025
  vellum/types/sentence_chunking_request.py,sha256=f0am6XafUmK3Ok3dEy2cqeeqds63XF9qard0tcIzZJk,163
1025
1026
  vellum/types/slim_deployment_read.py,sha256=grU1w1TDVLwQqbklQaoShBRwIjeurD5ZadeK_ABP-VU,158
1026
1027
  vellum/types/slim_document.py,sha256=yhPuWFL65jMKdCEcMNBDqJZQc1UdYlH7tFJ1nkGwDL0,151
1028
+ vellum/types/slim_document_document_to_document_index.py,sha256=3FwldvGhBc0pkccorIE3eMi8hQ0swgCWgKQJ6-jIff0,178
1027
1029
  vellum/types/slim_workflow_deployment.py,sha256=wRfaObu07ouUTNln4QZuBiye2uuKh3kPPvz2h9sbmJU,162
1028
1030
  vellum/types/streaming_ad_hoc_execute_prompt_event.py,sha256=gKFR8SKLo837TRORLQtuQmikKGNrOSi7HeoSTsnLh3Y,175
1029
1031
  vellum/types/streaming_execute_prompt_event.py,sha256=9H0sLQjyLOH6lB1ouk4GFRmp4VkYjNQXh8p8auLzft8,168
@@ -1203,7 +1205,7 @@ vellum/workflows/__init__.py,sha256=CssPsbNvN6rDhoLuqpEv7MMKGa51vE6dvAh6U31Pcio,
1203
1205
  vellum/workflows/constants.py,sha256=Z0W4YlqfSlSgWC11PrVUPs6ZOBeIaQ78E_90J1hohiw,789
1204
1206
  vellum/workflows/context.py,sha256=R8qdsFbD_0p7B6PWnyvSrZ_aOgMtGw-_uk0P0UAmwLA,1230
1205
1207
  vellum/workflows/descriptors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1206
- vellum/workflows/descriptors/base.py,sha256=VyyXtGJ_Hc34AOC8XC_Rw_68L4WMgD5w9Y7r8t8My4E,13814
1208
+ vellum/workflows/descriptors/base.py,sha256=2NQxURc_9QQ4pI9zICTZeULnS4OIml8fYcAkMgNU01Y,13830
1207
1209
  vellum/workflows/descriptors/tests/test_utils.py,sha256=icwW-YkHD5oR6rn9IH6Rck9yYOsuwnocyJVHoeJFd74,2849
1208
1210
  vellum/workflows/descriptors/utils.py,sha256=lO_dbr5g3PXpHPtVBkdguAK4-1qayZ7RXjl3BgAhrMM,3795
1209
1211
  vellum/workflows/edges/__init__.py,sha256=wSkmAnz9xyi4vZwtDbKxwlplt2skD7n3NsxkvR_pUus,50
@@ -1261,14 +1263,14 @@ vellum/workflows/nodes/bases/base.py,sha256=fKEycP9yqcHjH781d4Sg5NFHZFDsbco0nunr
1261
1263
  vellum/workflows/nodes/bases/base_subworkflow_node/__init__.py,sha256=0nkHQiFC4IpA1ZGx60XG0BLUWF6hwUpgqmS3ZrlFGhg,80
1262
1264
  vellum/workflows/nodes/bases/base_subworkflow_node/node.py,sha256=vC0gUBQewAUNtP3i2G0-LUpE_kY-r_ijBD_tS1XkQ1E,383
1263
1265
  vellum/workflows/nodes/bases/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1264
- vellum/workflows/nodes/bases/tests/test_base_node.py,sha256=7M-hmMTClhmD3OSDeZgXxAGJqfi6kM9uf5Mp4L4VooI,3111
1266
+ vellum/workflows/nodes/bases/tests/test_base_node.py,sha256=A4hpFaG4TwpumTi4FV4KDMyUeixBc26mRzSIihxFiGo,3112
1265
1267
  vellum/workflows/nodes/core/__init__.py,sha256=5zDMCmyt1v0HTJzlUBwq3U9L825yZGZhT9JL18-mRR4,455
1266
1268
  vellum/workflows/nodes/core/error_node/__init__.py,sha256=g7RRnlHhqu4qByfLjBwCunmgGA8dI5gNsjS3h6TwlSI,60
1267
1269
  vellum/workflows/nodes/core/error_node/node.py,sha256=hqBPHoLnhNrK9ITIaEzpnk47XYDbG6cmObz7oe78Ceg,944
1268
1270
  vellum/workflows/nodes/core/inline_subworkflow_node/__init__.py,sha256=nKNEH1QTl-1PcvmYoqSWEl0-t6gAur8GLTXHzklRQfM,84
1269
1271
  vellum/workflows/nodes/core/inline_subworkflow_node/node.py,sha256=kkPb2opZ7J6pIWueU-WU43KXEwKY5GrANldmesRFetI,3469
1270
1272
  vellum/workflows/nodes/core/map_node/__init__.py,sha256=MXpZYmGfhsMJHqqlpd64WiJRtbAtAMQz-_3fCU_cLV0,56
1271
- vellum/workflows/nodes/core/map_node/node.py,sha256=aPhV3niv_jWSwrZ2CwiRg0CDOM-09Fa6QqOPYNJMgRc,6206
1273
+ vellum/workflows/nodes/core/map_node/node.py,sha256=LEohCiS1HffS5dD6V0GWgjktf3Z4J9v7FZdVDNTpF5o,7284
1272
1274
  vellum/workflows/nodes/core/map_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
1273
1275
  vellum/workflows/nodes/core/map_node/tests/test_node.py,sha256=RHSZs7t6mW3UWvRrXnHZqaXVdRT2ZquOK_YHJ-gzXsU,1871
1274
1276
  vellum/workflows/nodes/core/retry_node/__init__.py,sha256=lN2bIy5a3Uzhs_FYCrooADyYU6ZGShtvLKFWpelwPvo,60
@@ -1280,7 +1282,7 @@ vellum/workflows/nodes/core/templating_node/custom_filters.py,sha256=Q0DahYRHP4K
1280
1282
  vellum/workflows/nodes/core/templating_node/exceptions.py,sha256=cDp140PP4OnInW4qAvg3KqiSiF70C71UyEAKRBR1Abo,46
1281
1283
  vellum/workflows/nodes/core/templating_node/node.py,sha256=19OFvRimrp1YuUO7H4rU7ZDsuawKvuwwVEAix7qBugs,4500
1282
1284
  vellum/workflows/nodes/core/templating_node/render.py,sha256=OpJp0NAH6qcEL6K9lxR0qjpFb75TYNttJR5iCos8tmg,1792
1283
- vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py,sha256=L6F3Gw9doguj1TSKmAns-mzXvoRuRivaCFe3mhjo13E,551
1285
+ vellum/workflows/nodes/core/templating_node/tests/test_templating_node.py,sha256=0BtXeSix7KGIuKzlPFTMLATpNnFPhut1UV_srGptkt0,1120
1284
1286
  vellum/workflows/nodes/core/try_node/__init__.py,sha256=JVD4DrldTIqFQQFrubs9KtWCCc0YCAc7Fzol5ZWIWeM,56
1285
1287
  vellum/workflows/nodes/core/try_node/node.py,sha256=5LHTPFsJHZ0eZZbXdmNswj1sLs93W8Pa1dp6JSZBnPM,6538
1286
1288
  vellum/workflows/nodes/core/try_node/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -1375,8 +1377,8 @@ vellum/workflows/vellum_client.py,sha256=ODrq_TSl-drX2aezXegf7pizpWDVJuTXH-j6528
1375
1377
  vellum/workflows/workflows/__init__.py,sha256=KY45TqvavCCvXIkyCFMEc0dc6jTMOUci93U2DUrlZYc,66
1376
1378
  vellum/workflows/workflows/base.py,sha256=mnI-kZ78yt7u6NFSTUo-tYjDnarP-RJ7uZjwjCn6PCQ,16795
1377
1379
  vellum/workflows/workflows/event_filters.py,sha256=-uQcMB7IpPd-idMku8f2QNVhPXPFWo6FZLlGjRf8rCo,1996
1378
- vellum_ai-0.11.1.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1379
- vellum_ai-0.11.1.dist-info/METADATA,sha256=OKYg7BRTEYyEI-8T2G9Clrzq8lFPG6vzw4zgEvr93vk,5128
1380
- vellum_ai-0.11.1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
1381
- vellum_ai-0.11.1.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1382
- vellum_ai-0.11.1.dist-info/RECORD,,
1380
+ vellum_ai-0.11.3.dist-info/LICENSE,sha256=hOypcdt481qGNISA784bnAGWAE6tyIf9gc2E78mYC3E,1574
1381
+ vellum_ai-0.11.3.dist-info/METADATA,sha256=6F3pwCqaSVevjDTq4ErE748xs0VspO_aHNYnoOSq-dY,5128
1382
+ vellum_ai-0.11.3.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
1383
+ vellum_ai-0.11.3.dist-info/entry_points.txt,sha256=HCH4yc_V3J_nDv3qJzZ_nYS8llCHZViCDP1ejgCc5Ak,42
1384
+ vellum_ai-0.11.3.dist-info/RECORD,,
@@ -1,6 +1,6 @@
1
1
  from dataclasses import dataclass
2
2
  from uuid import UUID
3
- from typing import Optional, TypeVar
3
+ from typing import TypeVar
4
4
 
5
5
 
6
6
  @dataclass
@@ -20,8 +20,6 @@ WorkflowMetaDisplayOverridesType = TypeVar("WorkflowMetaDisplayOverridesType", b
20
20
  @dataclass
21
21
  class WorkflowInputsDisplayOverrides:
22
22
  id: UUID
23
- required: Optional[bool] = None
24
- color: Optional[str] = None
25
23
 
26
24
 
27
25
  @dataclass
@@ -1,5 +1,5 @@
1
1
  from uuid import UUID
2
- from typing import Any, ClassVar, Generic, List, Optional, TypeVar
2
+ from typing import Any, ClassVar, Generic, List, Optional, Type, TypeVar
3
3
 
4
4
  from vellum.workflows.nodes.displayable import MergeNode
5
5
  from vellum.workflows.types.core import JsonObject
@@ -14,6 +14,10 @@ _MergeNodeType = TypeVar("_MergeNodeType", bound=MergeNode)
14
14
  class BaseMergeNodeDisplay(BaseNodeVellumDisplay[_MergeNodeType], Generic[_MergeNodeType]):
15
15
  target_handle_ids: ClassVar[List[UUID]]
16
16
 
17
+ def __init__(self, node: Type[_MergeNodeType]):
18
+ super().__init__(node)
19
+ self._target_handle_iterator = 0
20
+
17
21
  def serialize(self, display_context: WorkflowDisplayContext, **kwargs: Any) -> JsonObject:
18
22
  node = self._node
19
23
  node_id = self.node_id
@@ -46,3 +50,18 @@ class BaseMergeNodeDisplay(BaseNodeVellumDisplay[_MergeNodeType], Generic[_Merge
46
50
 
47
51
  def get_target_handle_ids(self) -> Optional[List[UUID]]:
48
52
  return self._get_explicit_node_display_attr("target_handle_ids", List[UUID])
53
+
54
+ def get_target_handle_id_by_source_node_id(self, source_node_id: UUID) -> UUID:
55
+ target_handle_ids = self.get_target_handle_ids()
56
+ if target_handle_ids is None:
57
+ return uuid4_from_hash(f"{self.node_id}|target_handle|{source_node_id}")
58
+
59
+ # Edges call this method to know which handle to connect to
60
+ # We use the order of the edges to determine the handle id. This is quite brittle to the order of the
61
+ # edges matching the order of the Merge Node's data.target_handles attribute. We should look into a
62
+ # longer term solution, or cutover Merge Nodes to Generic Nodes soon
63
+ target_handle_id = target_handle_ids[self._target_handle_iterator]
64
+ self._target_handle_iterator += 1
65
+ if self._target_handle_iterator >= len(self.target_handle_ids):
66
+ self._target_handle_iterator = 0
67
+ return target_handle_id
@@ -1,5 +1,5 @@
1
1
  from uuid import UUID
2
- from typing import ClassVar, Dict, Generic, Optional, TypeVar
2
+ from typing import ClassVar, Generic, Optional, TypeVar
3
3
 
4
4
  from vellum.workflows.nodes.core.templating_node import TemplatingNode
5
5
  from vellum.workflows.types.core import JsonObject
@@ -11,10 +11,11 @@ from vellum_ee.workflows.display.types import WorkflowDisplayContext
11
11
 
12
12
  _TemplatingNodeType = TypeVar("_TemplatingNodeType", bound=TemplatingNode)
13
13
 
14
+ TEMPLATE_INPUT_NAME = "template"
15
+
14
16
 
15
17
  class BaseTemplatingNodeDisplay(BaseNodeVellumDisplay[_TemplatingNodeType], Generic[_TemplatingNodeType]):
16
18
  template_input_id: ClassVar[Optional[UUID]] = None
17
- input_ids_by_name: ClassVar[Dict[str, UUID]] = {}
18
19
 
19
20
  def serialize(
20
21
  self, display_context: WorkflowDisplayContext, error_output_id: Optional[UUID] = None, **kwargs
@@ -22,12 +23,21 @@ class BaseTemplatingNodeDisplay(BaseNodeVellumDisplay[_TemplatingNodeType], Gene
22
23
  node = self._node
23
24
  node_id = self.node_id
24
25
 
26
+ template_input_id = self.template_input_id or next(
27
+ (
28
+ input_id
29
+ for input_name, input_id in self.node_input_ids_by_name.items()
30
+ if input_name == TEMPLATE_INPUT_NAME
31
+ ),
32
+ None,
33
+ )
34
+
25
35
  template_node_input = create_node_input(
26
36
  node_id=node_id,
27
37
  input_name="template",
28
38
  value=node.template,
29
39
  display_context=display_context,
30
- input_id=self.template_input_id,
40
+ input_id=template_input_id,
31
41
  )
32
42
  template_node_inputs = raise_if_descriptor(node.inputs)
33
43
  template_inputs = [
@@ -36,9 +46,10 @@ class BaseTemplatingNodeDisplay(BaseNodeVellumDisplay[_TemplatingNodeType], Gene
36
46
  input_name=variable_name,
37
47
  value=variable_value,
38
48
  display_context=display_context,
39
- input_id=self.input_ids_by_name.get("template"),
49
+ input_id=self.node_input_ids_by_name.get(variable_name),
40
50
  )
41
51
  for variable_name, variable_value in template_node_inputs.items()
52
+ if variable_name != TEMPLATE_INPUT_NAME
42
53
  ]
43
54
  node_inputs = [template_node_input, *template_inputs]
44
55
 
@@ -218,7 +218,7 @@ def test_serialize_workflow__await_all():
218
218
  "source_node_id": "59243c65-053f-4ea6-9157-3f3edb1477bf",
219
219
  "source_handle_id": "b9c5f52b-b714-46e8-a09c-38b4e770dd36",
220
220
  "target_node_id": "37c10e8a-771b-432b-a767-31f5007851f0",
221
- "target_handle_id": "0efd256f-f5f6-45fe-9adb-651780f5e63d",
221
+ "target_handle_id": "42eeb66c-9792-4609-8c71-3a56f668f4dc",
222
222
  "type": "DEFAULT",
223
223
  },
224
224
  {
@@ -226,7 +226,7 @@ def test_serialize_workflow__await_all():
226
226
  "source_node_id": "127ef456-91bc-43c6-bd8b-1772db5e3cb5",
227
227
  "source_handle_id": "b0bd17f3-4ce6-4232-9666-ec8afa161bf2",
228
228
  "target_node_id": "37c10e8a-771b-432b-a767-31f5007851f0",
229
- "target_handle_id": "0efd256f-f5f6-45fe-9adb-651780f5e63d",
229
+ "target_handle_id": "f40ff7fb-de1b-4aa4-ba3c-7630f7357cbf",
230
230
  "type": "DEFAULT",
231
231
  },
232
232
  {
@@ -74,7 +74,9 @@ class WorkflowMetaVellumDisplay(WorkflowMetaVellumDisplayOverrides):
74
74
 
75
75
  @dataclass
76
76
  class WorkflowInputsVellumDisplayOverrides(WorkflowInputsDisplay, WorkflowInputsDisplayOverrides):
77
- pass
77
+ name: Optional[str] = None
78
+ required: Optional[bool] = None
79
+ color: Optional[str] = None
78
80
 
79
81
 
80
82
  @dataclass
@@ -115,8 +117,6 @@ class WorkflowOutputVellumDisplayOverrides(WorkflowOutputDisplay, WorkflowOutput
115
117
  target_handle_id: UUID
116
118
  display_data: NodeDisplayData
117
119
  edge_id: UUID
118
- # source_node_id: Optional[UUID]
119
- # source_handle_id: Optional[UUID]
120
120
 
121
121
 
122
122
  @dataclass
@@ -12,6 +12,7 @@ from vellum.workflows.references import WorkflowInputReference
12
12
  from vellum.workflows.references.output import OutputReference
13
13
  from vellum.workflows.types.core import JsonArray, JsonObject
14
14
  from vellum.workflows.types.generics import WorkflowType
15
+ from vellum_ee.workflows.display.nodes import BaseMergeNodeDisplay
15
16
  from vellum_ee.workflows.display.nodes.base_node_vellum_display import BaseNodeVellumDisplay
16
17
  from vellum_ee.workflows.display.nodes.types import PortDisplay
17
18
  from vellum_ee.workflows.display.nodes.vellum.utils import create_node_input
@@ -66,7 +67,7 @@ class VellumWorkflowDisplay(
66
67
  input_variables.append(
67
68
  {
68
69
  "id": str(workflow_input_display.id),
69
- "key": workflow_input.name,
70
+ "key": workflow_input_display.name or workflow_input.name,
70
71
  "type": infer_vellum_variable_type(workflow_input),
71
72
  "default": default.dict() if default else None,
72
73
  "required": required,
@@ -366,7 +367,12 @@ class VellumWorkflowDisplay(
366
367
 
367
368
  target_node_display = node_displays[target_node]
368
369
  target_node_id = target_node_display.node_id
369
- target_handle_id = target_node_display.get_target_handle_id()
370
+
371
+ target_handle_id: UUID
372
+ if isinstance(target_node_display, BaseMergeNodeDisplay):
373
+ target_handle_id = target_node_display.get_target_handle_id_by_source_node_id(source_node_id)
374
+ else:
375
+ target_handle_id = target_node_display.get_target_handle_id()
370
376
 
371
377
  return self._generate_edge_display_from_source(
372
378
  source_node_id, source_handle_id, target_node_id, target_handle_id, overrides