gllm-pipeline-binary 0.4.30__cp312-cp312-win_amd64.whl → 0.4.32__cp312-cp312-win_amd64.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.
@@ -11,6 +11,7 @@ from gllm_pipeline.pipeline.pipeline import Pipeline as Pipeline
11
11
  from gllm_pipeline.schema import PipelineSteps as PipelineSteps
12
12
  from gllm_pipeline.steps.pipeline_step import BasePipelineStep as BasePipelineStep
13
13
  from gllm_pipeline.steps.step_error_handler.step_error_handler import BaseStepErrorHandler as BaseStepErrorHandler
14
+ from gllm_pipeline.types import Val as Val
14
15
  from typing import Any, Callable, Self, overload
15
16
 
16
17
  class Composer:
@@ -135,6 +136,34 @@ class Composer:
135
136
  name (str | None, optional): A unique identifier for this step. If None, a name will be
136
137
  auto-generated with the prefix "no_op_". Defaults to None.
137
138
 
139
+ Returns:
140
+ Self: The composer instance with this step appended.
141
+ '''
142
+ def goto(self, name: str, target: Val | str | Callable, input_map: InputMapSpec | None = None, output_state: str | None = None, allow_end: bool = True, retry_config: RetryConfig | None = None, error_handler: BaseStepErrorHandler | None = None, cache_store: BaseCache | None = None, cache_config: dict[str, Any] | None = None) -> Self:
143
+ '''Append a goto step for dynamic flow control.
144
+
145
+ Args:
146
+ name (str): A unique identifier for this step.
147
+ target (Val | str | Callable): The jump target specification.
148
+ 1. Val: Static target (unwrapped value)
149
+ 2. str: State key to read target from
150
+ 3. Callable: Function that computes the target
151
+ input_map (InputMapSpec | None): Input mapping for callable targets.
152
+ Only used when target is a callable. Defaults to None.
153
+ output_state (str | None): Optional key to store the resolved target in state.
154
+ If provided, the resolved target will be saved to this state key.
155
+ Defaults to None.
156
+ allow_end (bool): Whether jumping to "END" is allowed. If False and
157
+ target resolves to "END", a ValueError is raised. Defaults to True.
158
+ retry_config (RetryConfig | None): Configuration for retry behavior.
159
+ Defaults to None.
160
+ error_handler (BaseStepErrorHandler | None): Strategy for error handling.
161
+ Defaults to None.
162
+ cache_store (BaseCache | None): Cache store for step results.
163
+ Defaults to None.
164
+ cache_config (dict[str, Any] | None): Cache configuration.
165
+ Defaults to None.
166
+
138
167
  Returns:
139
168
  Self: The composer instance with this step appended.
140
169
  '''
@@ -7,12 +7,14 @@ from gllm_pipeline.pipeline.composer import Composer as Composer
7
7
  from gllm_pipeline.pipeline.states import RAGState as RAGState
8
8
  from gllm_pipeline.steps.pipeline_step import BasePipelineStep as BasePipelineStep
9
9
  from gllm_pipeline.steps.terminator_step import TerminatorStep as TerminatorStep
10
+ from gllm_pipeline.types import PipelineInvocation as PipelineInvocation
10
11
  from gllm_pipeline.utils.graph import create_edge as create_edge
11
12
  from gllm_pipeline.utils.mermaid import MERMAID_HEADER as MERMAID_HEADER, combine_mermaid_diagrams as combine_mermaid_diagrams, extract_step_diagrams as extract_step_diagrams
13
+ from gllm_pipeline.utils.schema import filter_output_by_schema as filter_output_by_schema, is_typeddict_or_basemodel as is_typeddict_or_basemodel
12
14
  from gllm_pipeline.utils.typing_compat import TypedDict as TypedDict, is_typeddict as is_typeddict
13
15
  from langgraph.graph import StateGraph
14
16
  from pydantic import BaseModel
15
- from typing import Any
17
+ from typing import Any, Callable
16
18
 
17
19
  DEFAULT_TOOL_NAME: str
18
20
  INDENTATION: str
@@ -194,36 +196,25 @@ class Pipeline:
194
196
  Returns:
195
197
  Composer: A composer instance that manages this pipeline.
196
198
  """
197
- def as_tool(self, description: str | None = None) -> Tool:
199
+ def as_tool(self, description: str | None = None, input_schema: type | None = None, output_schema: type | None = None, input_transform: Callable[[dict[str, Any]], dict[str, Any]] | None = None, output_transform: Callable[[dict[str, Any]], Any] | None = None) -> Tool:
198
200
  '''Convert the pipeline to a Tool instance.
199
201
 
200
- This method allows a Pipeline instance to be used as a tool, with the input schema
201
- being derived from the pipeline\'s input schema. The pipeline must have an input_type
202
- defined to be convertible as a tool.
202
+ This method allows a Pipeline instance to be used as a tool, with flexible input/output
203
+ transformation support. The pipeline must have an input_type defined unless a custom
204
+ input_schema is provided with input_transform.
203
205
 
204
- If the pipeline has a context_schema defined, the tool will accept a nested
205
- structure with \'input\' and optional \'context\' keys. Otherwise, it will accept
206
- flat kwargs matching the input schema (legacy behavior).
207
-
208
- Args:
209
- description (str | None, optional): Optional description to associate with the tool.
210
- Defaults to None, in which case a description will be generated automatically.
211
-
212
- Returns:
213
- Tool: A Tool instance that wraps the pipeline.
214
-
215
- Raises:
216
- ValueError: If the pipeline does not have an input schema defined.
206
+ Note that if the input_schema is not provided, the input schema will fall back to the
207
+ pipeline\'s input_type and context_schema. In this case, the input_transform is ignored.
217
208
 
218
209
  Examples:
219
210
  ```python
211
+ # Default behavior with context schema
220
212
  class InputState(TypedDict):
221
213
  user_query: str
222
214
 
223
215
  class ContextSchema(TypedDict):
224
216
  session_id: str
225
217
 
226
- # With context schema
227
218
  pipeline = Pipeline(
228
219
  [retrieval_step, generation_step],
229
220
  input_type=InputState,
@@ -236,15 +227,52 @@ class Pipeline:
236
227
  context={"session_id": "abc123"}
237
228
  )
238
229
 
239
- # Without context schema (legacy)
240
- pipeline = Pipeline(
241
- [retrieval_step, generation_step],
242
- input_type=InputState,
243
- name="rag_pipeline"
230
+ # Custom input schema with transforms
231
+ class ToolInput(TypedDict):
232
+ message: str
233
+ limit: int
234
+
235
+ def pre_transform(data):
236
+ return {
237
+ "input": {"user_query": data["message"]},
238
+ "config": {"max_results": data["limit"]}
239
+ }
240
+
241
+ def post_transform(data):
242
+ return {"processed": True, "result": data}
243
+
244
+ tool = pipeline.as_tool(
245
+ input_schema=ToolInput,
246
+ input_transform=pre_transform,
247
+ output_transform=post_transform
244
248
  )
245
- tool = pipeline.as_tool()
246
- result = await tool.invoke(user_query="What is AI?")
249
+ result = await tool.invoke(message="What is AI?", limit=5)
247
250
  ```
251
+
252
+ Args:
253
+ description (str | None, optional): Optional description to associate with the tool.
254
+ Defaults to None, in which case a description will be generated automatically.
255
+ input_schema (type | None, optional): Custom input schema for
256
+ the tool (TypedDict or Pydantic BaseModel). If provided,
257
+ input_transform must also be provided. Defaults to None.
258
+ output_schema (type | None, optional): Custom output schema for
259
+ the tool (TypedDict or Pydantic BaseModel). If provided,
260
+ the output will be filtered to match this schema after applying
261
+ output_transform. If not provided, uses the pipeline\'s output_type. Defaults to None.
262
+ input_transform (Callable | None, optional): Function to transform tool input
263
+ to pipeline invocation format. Must return dict with \'input\' key and optional
264
+ \'config\' key. Required if input_schema is provided. Defaults to None.
265
+ output_transform (Callable | None, optional): Function to transform pipeline
266
+ output before returning from tool. Can change the output type. Defaults to None.
267
+
268
+ Returns:
269
+ Tool: A Tool instance that wraps the pipeline.
270
+
271
+ Raises:
272
+ ValueError: If the pipeline does not have an input schema defined and no custom
273
+ input_schema is provided, or if input_schema is provided without
274
+ input_transform, or if input_schema/output_schema is not a TypedDict or BaseModel.
275
+
248
276
  '''
249
277
  def clear(self) -> None:
250
278
  """Clears the pipeline by resetting steps, graph, and app to their initial state.
@@ -5,6 +5,7 @@ from gllm_pipeline.alias import InputMapSpec as InputMapSpec, PipelineSteps as P
5
5
  from gllm_pipeline.pipeline.pipeline import Pipeline as Pipeline
6
6
  from gllm_pipeline.steps.component_step import ComponentStep as ComponentStep
7
7
  from gllm_pipeline.steps.conditional_step import ConditionType as ConditionType, ConditionalStep as ConditionalStep, DEFAULT_BRANCH as DEFAULT_BRANCH
8
+ from gllm_pipeline.steps.goto_step import GoToStep as GoToStep
8
9
  from gllm_pipeline.steps.guard_step import GuardStep as GuardStep
9
10
  from gllm_pipeline.steps.log_step import LogStep as LogStep
10
11
  from gllm_pipeline.steps.map_reduce_step import MapReduceStep as MapReduceStep
@@ -15,6 +16,7 @@ from gllm_pipeline.steps.state_operator_step import StateOperatorStep as StateOp
15
16
  from gllm_pipeline.steps.step_error_handler.step_error_handler import BaseStepErrorHandler as BaseStepErrorHandler
16
17
  from gllm_pipeline.steps.subgraph_step import SubgraphStep as SubgraphStep
17
18
  from gllm_pipeline.steps.terminator_step import TerminatorStep as TerminatorStep
19
+ from gllm_pipeline.types import Val as Val
18
20
  from typing import Any, Callable
19
21
 
20
22
  def step(component: Component, input_state_map: dict[str, str] | None = None, output_state: str | list[str] | None = None, runtime_config_map: dict[str, str] | None = None, fixed_args: dict[str, Any] | None = None, input_map: InputMapSpec | None = None, emittable: bool = True, retry_config: RetryConfig | None = None, error_handler: BaseStepErrorHandler | None = None, name: str | None = None, cache_store: BaseCache | None = None, cache_config: dict[str, Any] | None = None) -> ComponentStep:
@@ -1025,3 +1027,34 @@ def copy(input_state: str | list[str], output_state: str | list[str], retry_conf
1025
1027
  )
1026
1028
  ```
1027
1029
  '''
1030
+ def goto(name: str, target: Val | str | Callable, input_map: InputMapSpec | None = None, output_state: str | None = None, allow_end: bool = True, retry_config: RetryConfig | None = None, error_handler: BaseStepErrorHandler | None = None, cache_store: BaseCache | None = None, cache_config: dict[str, Any] | None = None) -> GoToStep:
1031
+ '''Create a GoToStep for dynamic flow control.
1032
+
1033
+ This convenience function creates a GoToStep that enables dynamic flow control
1034
+ by jumping to specified nodes in the pipeline.
1035
+
1036
+ Args:
1037
+ name (str): A unique identifier for this pipeline step.
1038
+ target (Val | str | Callable): The jump target specification.
1039
+ 1. Val: Static target (unwrapped value)
1040
+ 2. str: State key to read target from
1041
+ 3. Callable: Function that computes the target
1042
+ input_map (InputMapSpec | None): Input mapping for callable targets.
1043
+ Only used when target is a callable. Defaults to None.
1044
+ output_state (str | None): Optional key to store the resolved target in state.
1045
+ If provided, the resolved target will be saved to this state key.
1046
+ Defaults to None.
1047
+ allow_end (bool): Whether jumping to "END" is allowed. If False and
1048
+ target resolves to "END", a ValueError is raised. Defaults to True.
1049
+ retry_config (RetryConfig | None): Configuration for retry behavior.
1050
+ Defaults to None.
1051
+ error_handler (BaseStepErrorHandler | None): Strategy for error handling.
1052
+ Defaults to None.
1053
+ cache_store (BaseCache | None): Cache store for step results.
1054
+ Defaults to None.
1055
+ cache_config (dict[str, Any] | None): Cache configuration.
1056
+ Defaults to None.
1057
+
1058
+ Returns:
1059
+ GoToStep: A configured GoToStep instance.
1060
+ '''
@@ -0,0 +1,114 @@
1
+ from _typeshed import Incomplete
2
+ from gllm_core.utils.retry import RetryConfig
3
+ from gllm_datastore.cache.cache import BaseCache
4
+ from gllm_pipeline.alias import InputMapSpec as InputMapSpec, PipelineState as PipelineState
5
+ from gllm_pipeline.exclusions import ExclusionSet as ExclusionSet
6
+ from gllm_pipeline.steps.pipeline_step import BasePipelineStep as BasePipelineStep
7
+ from gllm_pipeline.steps.step_error_handler.step_error_handler import BaseStepErrorHandler as BaseStepErrorHandler
8
+ from gllm_pipeline.types import Val as Val
9
+ from gllm_pipeline.utils.async_utils import execute_callable as execute_callable
10
+ from gllm_pipeline.utils.graph import create_edge as create_edge
11
+ from gllm_pipeline.utils.has_inputs_mixin import HasInputsMixin as HasInputsMixin
12
+ from gllm_pipeline.utils.input_map import shallow_dump as shallow_dump
13
+ from langchain_core.runnables import RunnableConfig as RunnableConfig
14
+ from langgraph.runtime import Runtime
15
+ from langgraph.types import Command, RetryPolicy
16
+ from typing import Any, Callable
17
+
18
+ class GoToStep(BasePipelineStep, HasInputsMixin):
19
+ '''A pipeline step that enables dynamic flow control by jumping to specified nodes.
20
+
21
+ This step allows for dynamic routing in pipelines by jumping to different nodes
22
+ based on runtime conditions. The target can be a static node name, a state key,
23
+ or a callable that determines the target at runtime.
24
+
25
+ Attributes:
26
+ name (str): A unique identifier for the pipeline step.
27
+ target (Val | str | Callable[[dict[str, Any]], str]): The target node specification.
28
+ input_map (dict[str, str | Val]): Mapping of argument names to either a state/config key (str)
29
+ or a fixed value (Val). Inherited from HasInputsMixin.
30
+ output_state (str | None): The state key to store the resolved target.
31
+ allow_end (bool): Whether jumping to \'END\' is allowed.
32
+ retry_policy (RetryPolicy | None): Configuration for retry behavior using LangGraph\'s RetryPolicy.
33
+ Inherited from BasePipelineStep.
34
+ cache_store ("BaseCache" | None): The cache store used for caching step results, if configured.
35
+ Inherited from BasePipelineStep.
36
+ is_cache_enabled (bool): Property indicating whether caching is enabled for this step.
37
+ Inherited from BasePipelineStep.
38
+ '''
39
+ target: Incomplete
40
+ output_state: Incomplete
41
+ allow_end: Incomplete
42
+ def __init__(self, name: str, target: Val | str | Callable[[dict[str, Any]], str], input_map: InputMapSpec | None = None, output_state: str | None = None, allow_end: bool = True, retry_config: RetryConfig | None = None, error_handler: BaseStepErrorHandler | None = None, cache_store: BaseCache | None = None, cache_config: dict[str, Any] | None = None) -> None:
43
+ """Initializes a new instance of the GoToStep class.
44
+
45
+ Args:
46
+ name (str): The name of the step.
47
+ target (Val | str | Callable): The target node specification.
48
+ input_map (InputMapSpec | None, optional): Unified input map. Defaults to None.
49
+ output_state (str | None, optional): State key to store resolved target. Defaults to None.
50
+ allow_end (bool, optional): Whether jumping to 'END' is allowed. Defaults to True.
51
+ retry_config (RetryConfig | None, optional): Retry configuration. Defaults to None.
52
+ error_handler (BaseStepErrorHandler | None, optional): Error handler. Defaults to None.
53
+ cache_store (BaseCache | None, optional): Cache store instance. Defaults to None.
54
+ cache_config (dict[str, Any] | None, optional): Cache configuration. Defaults to None.
55
+ """
56
+ async def execute(self, state: PipelineState, runtime: Runtime, config: RunnableConfig | None = None) -> Command:
57
+ """Executes the goto step and returns a LangGraph Command.
58
+
59
+ Args:
60
+ state (PipelineState): The current pipeline state.
61
+ runtime (Runtime): The runtime context containing config.
62
+ config (RunnableConfig | None, optional): Optional runnable configuration. Defaults to None.
63
+
64
+ Returns:
65
+ Command: A LangGraph Command with goto parameter for routing.
66
+
67
+ Raises:
68
+ ValueError: If the resolved target is invalid.
69
+ KeyError: If state key is missing for string targets.
70
+ """
71
+ async def execute_direct(self, state: PipelineState, runtime: Runtime, config: RunnableConfig | None = None) -> dict[str, Any] | None:
72
+ """Executes the goto step and returns a state update.
73
+
74
+ Args:
75
+ state (PipelineState): The current pipeline state.
76
+ runtime (Runtime): The runtime context containing config.
77
+ config (RunnableConfig | None, optional): Optional runnable configuration. Defaults to None.
78
+
79
+ Returns:
80
+ dict[str, Any] | None: State update with resolved target if output_state
81
+ is specified, None otherwise.
82
+
83
+ Raises:
84
+ ValueError: If the resolved target is invalid.
85
+ KeyError: If state key is missing for string targets.
86
+ """
87
+ def add_to_graph(self, graph: Any, previous_endpoints: list[str], retry_policy: RetryPolicy | None = None) -> list[str]:
88
+ """Adds the GoToStep to the graph and creates edges.
89
+
90
+ Args:
91
+ graph (Any): The LangGraph graph to add the step to.
92
+ previous_endpoints (list[str]): List of source node names to connect from.
93
+ retry_policy (RetryPolicy | None, optional): Optional retry policy to override
94
+ the step's default. Defaults to None.
95
+
96
+ Returns:
97
+ list[str]: List of endpoint names after adding this step.
98
+ """
99
+ def get_mermaid_diagram(self, indent: int = 0) -> str:
100
+ """Generates a Mermaid diagram representation of this goto step.
101
+
102
+ Args:
103
+ indent (int, optional): Number of spaces to indent the diagram. Defaults to 0.
104
+
105
+ Returns:
106
+ str: The Mermaid diagram string.
107
+ """
108
+ is_excluded: Incomplete
109
+ def apply_exclusions(self, exclusions: ExclusionSet) -> None:
110
+ """Applies exclusions to this goto step.
111
+
112
+ Args:
113
+ exclusions (ExclusionSet): The exclusion set to apply.
114
+ """
@@ -3,11 +3,12 @@ from gllm_core.utils.retry import RetryConfig
3
3
  from gllm_datastore.cache.cache import BaseCache
4
4
  from gllm_pipeline.alias import InputMapSpec as InputMapSpec, PipelineSteps as PipelineSteps
5
5
  from gllm_pipeline.steps.branching_step import BranchingStep as BranchingStep
6
+ from gllm_pipeline.steps.goto_step import GoToStep as GoToStep
6
7
  from gllm_pipeline.steps.pipeline_step import BasePipelineStep as BasePipelineStep
7
8
  from gllm_pipeline.steps.step_error_handler.step_error_handler import BaseStepErrorHandler as BaseStepErrorHandler
8
9
  from gllm_pipeline.utils.copy import safe_deepcopy as safe_deepcopy
9
10
  from gllm_pipeline.utils.error_handling import ValidationError as ValidationError, create_error_context as create_error_context
10
- from gllm_pipeline.utils.graph import create_edge as create_edge
11
+ from gllm_pipeline.utils.graph import check_non_parallelizable_steps as check_non_parallelizable_steps, create_edge as create_edge
11
12
  from gllm_pipeline.utils.has_inputs_mixin import HasInputsMixin as HasInputsMixin
12
13
  from gllm_pipeline.utils.input_map import shallow_dump as shallow_dump
13
14
  from gllm_pipeline.utils.mermaid import MERMAID_HEADER as MERMAID_HEADER
@@ -19,6 +20,8 @@ from langgraph.types import RetryPolicy
19
20
  from pydantic import BaseModel as BaseModel
20
21
  from typing import Any
21
22
 
23
+ NON_PARALLELIZABLE_STEPS: Incomplete
24
+
22
25
  class ParallelStep(BranchingStep, HasInputsMixin):
23
26
  """A pipeline step that executes multiple branches in parallel.
24
27
 
@@ -14,7 +14,6 @@ from langchain_core.runnables import RunnableConfig as RunnableConfig
14
14
  from langgraph.graph import StateGraph
15
15
  from langgraph.runtime import Runtime
16
16
  from langgraph.types import RetryPolicy
17
- from pydantic import BaseModel as BaseModel
18
17
  from typing import Any
19
18
 
20
19
  LANGGRAPH_CONFIG_PREFIX: str
@@ -153,14 +152,14 @@ class BasePipelineStep(ABC):
153
152
  list[str]: The exit points (endpoints) of this step.
154
153
  """
155
154
  @abstractmethod
156
- async def execute(self, state: PipelineState, runtime: Runtime[dict[str, Any] | BaseModel], config: RunnableConfig | None = None) -> dict[str, Any] | None:
155
+ async def execute(self, state: PipelineState, runtime: Runtime, config: RunnableConfig | None = None) -> dict[str, Any] | None:
157
156
  """Executes the operation defined for this pipeline step.
158
157
 
159
158
  This method should be implemented by subclasses to perform the actual processing or computation for this step.
160
159
 
161
160
  Args:
162
161
  state (PipelineState): The current state of the pipeline, containing all data.
163
- runtime (Runtime[dict[str, Any] | BaseModel]): Runtime information for this step's execution.
162
+ runtime (Runtime): Runtime information for this step's execution.
164
163
  config (RunnableConfig | None, optional): Runnable configuration containing thread_id and other
165
164
  LangGraph config. This allows steps to access invocation-level configuration like thread_id for
166
165
  tracking and checkpointing. Defaults to None.
@@ -173,7 +172,7 @@ class BasePipelineStep(ABC):
173
172
  Raises:
174
173
  NotImplementedError: If the subclass does not implement this method.
175
174
  """
176
- async def execute_direct(self, state: dict[str, Any], runtime: Runtime[dict[str, Any] | BaseModel], config: RunnableConfig | None = None) -> dict[str, Any] | None:
175
+ async def execute_direct(self, state: dict[str, Any], runtime: Runtime, config: RunnableConfig | None = None) -> dict[str, Any] | None:
177
176
  """Execute this step directly, bypassing graph-based execution.
178
177
 
179
178
  This method is used when a step needs to be executed directly, such as in parallel execution.
@@ -181,7 +180,7 @@ class BasePipelineStep(ABC):
181
180
 
182
181
  Args:
183
182
  state (dict[str, Any]): The current state of the pipeline.
184
- runtime (Runtime[dict[str, Any] | BaseModel]): Runtime information for this step's execution.
183
+ runtime (Runtime): Runtime information for this step's execution.
185
184
  config (RunnableConfig | None, optional): The runnable configuration to pass to the step.
186
185
 
187
186
  Returns:
gllm_pipeline/types.pyi CHANGED
@@ -1,4 +1,7 @@
1
+ from _typeshed import Incomplete
1
2
  from dataclasses import dataclass
3
+ from pydantic import BaseModel
4
+ from typing import Any
2
5
 
3
6
  @dataclass(frozen=True)
4
7
  class Val:
@@ -8,3 +11,31 @@ class Val:
8
11
  value (object): The literal value of the input.
9
12
  """
10
13
  value: object
14
+
15
+ class PipelineInvocation(BaseModel):
16
+ '''A model representing the invocation parameters for a pipeline.
17
+
18
+ This model is used to validate the structure of data returned by
19
+ pre_invoke_transform functions. It ensures the data has the correct
20
+ format for pipeline invocation.
21
+
22
+ Examples:
23
+ ```python
24
+ invocation = PipelineInvocation(
25
+ input={"user_query": "What is AI?"},
26
+ config={"session_id": "abc123"}
27
+ )
28
+
29
+ # With no config
30
+ invocation = PipelineInvocation(input={"query": "test"})
31
+ ```
32
+
33
+ Attributes:
34
+ input (dict[str, Any]): The input data to pass to the pipeline.
35
+ This is a required field and must be a dictionary.
36
+ config (dict[str, Any] | None): Optional configuration for the
37
+ pipeline execution. Must be a dictionary if provided.
38
+ '''
39
+ model_config: Incomplete
40
+ input: dict[str, Any]
41
+ config: dict[str, Any] | None
@@ -1,4 +1,5 @@
1
1
  from langgraph.graph import StateGraph
2
+ from typing import Any
2
3
 
3
4
  def create_edge(graph: StateGraph, sources: str | list[str], target: str) -> None:
4
5
  """Create edges from source nodes to target node in the graph.
@@ -14,3 +15,19 @@ def create_edge(graph: StateGraph, sources: str | list[str], target: str) -> Non
14
15
  do nothing.
15
16
  target (str): The target node.
16
17
  """
18
+ def check_non_parallelizable_steps(branches: dict[str, Any], non_parallelizable_types: tuple[type, ...]) -> list[str]:
19
+ """Check branches for non-parallelizable step instances.
20
+
21
+ This function recursively searches through branches to find any steps that
22
+ are instances of the specified non-parallelizable types.
23
+
24
+ Args:
25
+ branches (dict[str, Any]): Dictionary mapping branch names to branch contents.
26
+ Branch contents can be single steps or lists of steps.
27
+ non_parallelizable_types (tuple[type, ...]): Tuple of step types that cannot
28
+ be safely executed in parallel.
29
+
30
+ Returns:
31
+ list[str]: List of descriptions of found non-parallelizable steps, including
32
+ their name, type, location, and branch name.
33
+ """
@@ -0,0 +1,25 @@
1
+ from gllm_pipeline.utils.typing_compat import is_typeddict as is_typeddict
2
+ from typing import Any
3
+
4
+ def is_typeddict_or_basemodel(type_hint: type) -> bool:
5
+ """Check if a type is a TypedDict or Pydantic BaseModel.
6
+
7
+ Args:
8
+ type_hint (type): The type to check.
9
+
10
+ Returns:
11
+ bool: True if the type is a TypedDict or BaseModel, False otherwise.
12
+ """
13
+ def filter_output_by_schema(result: Any, schema: type) -> dict[str, Any]:
14
+ """Filter the output result to match the provided schema.
15
+
16
+ Args:
17
+ result (Any): The result to filter.
18
+ schema (type): The schema (TypedDict or BaseModel) to filter against.
19
+
20
+ Returns:
21
+ dict[str, Any]: The filtered result as a dictionary.
22
+
23
+ Raises:
24
+ ValueError: If the schema is not a TypedDict or Pydantic BaseModel.
25
+ """
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: gllm-pipeline-binary
3
- Version: 0.4.30
3
+ Version: 0.4.32
4
4
  Summary: A library containing components related to Gen AI applications pipeline orchestration.
5
5
  Author-email: Dimitrij Ray <dimitrij.ray@gdplabs.id>, Henry Wicaksono <henry.wicaksono@gdplabs.id>, Kadek Denaya <kadek.d.r.diana@gdplabs.id>
6
6
  Requires-Python: <3.13,>=3.11
@@ -1,16 +1,16 @@
1
- gllm_pipeline.cp312-win_amd64.pyd,sha256=h-n_PK5GuCPrgbTrSf78b3mbELtwZJggFzOk_yUdavs,2197504
1
+ gllm_pipeline.cp312-win_amd64.pyd,sha256=PS6QG5jkGrj-PmLLHnRJjBIs_Hu68h3S92DL8yNWO_g,2306048
2
2
  gllm_pipeline.pyi,sha256=MD-D3Elp4GWlKPM1ms2pMGJRhtYf1bI84rYAjJSPEbM,2378
3
3
  gllm_pipeline/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  gllm_pipeline/alias.pyi,sha256=FbALRYZpDlmQMsKNUvgCi6ji11PrEtNo2kgzbt0iT7g,237
5
- gllm_pipeline/types.pyi,sha256=CV3cEAxlNsnVatYz5iCxqmEFPEqeKW5vv-qUD3FpF54,241
5
+ gllm_pipeline/types.pyi,sha256=kGIvyPpmCEu--R3mAtQjsUBCVGTHTYMcycMXqS06evs,1311
6
6
  gllm_pipeline/exclusions/__init__.pyi,sha256=_LwIlqmH4Iiksn7p09d2vZG4Ek8CdKC8UcDRMw6zs_Y,224
7
7
  gllm_pipeline/exclusions/exclusion_manager.pyi,sha256=DzoL-2KeTRmFgJEo8rzYViFYKbzZVTZGJmKvzaoTC0M,2960
8
8
  gllm_pipeline/exclusions/exclusion_set.pyi,sha256=11XTt6IfkHpzomcNybA78SfWlp752Z3AGhXfm2rL0Fk,1685
9
9
  gllm_pipeline/pipeline/__init__.pyi,sha256=1IKGdMvmLWEiOOmAKFNUPm-gdw13zrnU1gs7tDNzgEU,168
10
- gllm_pipeline/pipeline/pipeline.pyi,sha256=hORa2VLM05sQaTktOqteO3a80Vbqu7LwKvmkN-vshPg,17051
10
+ gllm_pipeline/pipeline/pipeline.pyi,sha256=_Opo1LtSiELKbMeW_l_myU5MMgMAjwwlxQ8dwAIj014,19090
11
11
  gllm_pipeline/pipeline/states.pyi,sha256=NuWs7-Q6gGIHV32o-conwTtKXrbd0FpKE1d8Hg4OAt0,6459
12
12
  gllm_pipeline/pipeline/composer/__init__.pyi,sha256=-hcOUQgpTRt1QjQfRurTf-UApFnTrhilx6vN-gYd5J0,666
13
- gllm_pipeline/pipeline/composer/composer.pyi,sha256=RilABdb4JN_XusRv_0rfG2ziyOPf-YqmbRjCCk0A9z8,28674
13
+ gllm_pipeline/pipeline/composer/composer.pyi,sha256=FW_lQ0ex7zen2OcKY1TmzEQEng_Ma9YMbrlCsqA8pq4,30528
14
14
  gllm_pipeline/pipeline/composer/guard_composer.pyi,sha256=xYJyepAu80VSr0JdQSetwi4_lx6v76zXLdxDxFWsTQk,3294
15
15
  gllm_pipeline/pipeline/composer/if_else_composer.pyi,sha256=iXpswHcwp7DEmC67rSwGaTUeh5FUnQqgv-AGDHdMBAQ,3155
16
16
  gllm_pipeline/pipeline/composer/parallel_composer.pyi,sha256=_DNz90IDM9U5AcPC-101CupeRKkFQMAp5Z_1-FEnPy0,2565
@@ -40,17 +40,18 @@ gllm_pipeline/router/preset/aurelio/router_image_domain_specific.pyi,sha256=6pm2
40
40
  gllm_pipeline/router/preset/lm_based/__init__.pyi,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
41
  gllm_pipeline/router/preset/lm_based/router_image_domain_specific.pyi,sha256=UdiuoSXm2MVAL8AspAaSkyXYkE59bYj1y4xRRgKwavE,655
42
42
  gllm_pipeline/steps/__init__.pyi,sha256=5HtVA5CODr_9_7_OGEXFXU40edqhHa9YlCV5qVx3xbU,1989
43
- gllm_pipeline/steps/_func.pyi,sha256=Nt_kWdAVlvTNsOiPejCF8j4AtiBPqxJr4lDieETfzr8,64124
43
+ gllm_pipeline/steps/_func.pyi,sha256=vKoAZXDh8X0k00m2YkPwK4jQY6fbAD2gPnOt7u8Ah8Q,66071
44
44
  gllm_pipeline/steps/branching_step.pyi,sha256=ZT4uJVxvUbmTnOOMst95qtPduigTC9ykzOcpE34oHwo,1006
45
45
  gllm_pipeline/steps/component_step.pyi,sha256=BEViLhf874KqylPRaKFMIMeZ6uy4xOol0I68N07bdZo,5716
46
46
  gllm_pipeline/steps/composite_step.pyi,sha256=2-iLtaAaa77Ur2HqANlcqPIpOAclAoBG4h2a8yNP33g,3452
47
47
  gllm_pipeline/steps/conditional_step.pyi,sha256=qKlXfVuAhyyZPO8_A67TyXVgbdUpUWhjnfvafaBQZKE,10401
48
+ gllm_pipeline/steps/goto_step.pyi,sha256=DLCR-aptEF8CS-SyYPYHpgd6icbzmqBGjXXMjRmsLSI,6353
48
49
  gllm_pipeline/steps/guard_step.pyi,sha256=R7h4yKrU1M_zeHqaUH9oCqk3s-nLBTcf8J5tyrQOzGM,4751
49
50
  gllm_pipeline/steps/log_step.pyi,sha256=lXOd5VAjfi2cs5yFMQrFgZlnV1Wj9EIeuZa6SIjeaRI,3271
50
51
  gllm_pipeline/steps/map_reduce_step.pyi,sha256=lZ1dnG6-TNt4iMRWXSfmpJkVVqHlN2GTUXcOsxi4Kls,6205
51
52
  gllm_pipeline/steps/no_op_step.pyi,sha256=8iepve5pJB02d-yG78-eIQuBajsl-i2ovBTluFq5pCo,1578
52
- gllm_pipeline/steps/parallel_step.pyi,sha256=13VK3h_CGB11pQEFrUroy2FM-J86U3sR2JP_R9yaNoo,8524
53
- gllm_pipeline/steps/pipeline_step.pyi,sha256=5VZIBEoMEXwoeHLifdtmjoLeydnqXwi7wY_C_mJQsDw,11645
53
+ gllm_pipeline/steps/parallel_step.pyi,sha256=YPlj4E_KkM63FTS4n4kKTH80_hQZe9nUcyAw5lRN5SU,8694
54
+ gllm_pipeline/steps/pipeline_step.pyi,sha256=fBxIcmEDr-cj54KSn6ZvPCESetHz9vbefXOgj97b5QY,11488
54
55
  gllm_pipeline/steps/state_operator_step.pyi,sha256=rtzfedK5mDszHpFusXHUiNG3-3fO-mBvmPqDxLvk67A,5293
55
56
  gllm_pipeline/steps/subgraph_step.pyi,sha256=f99kx8Vo2foDg6CRqzObvRCetcvzvUQIxW9M6SEZRUs,5996
56
57
  gllm_pipeline/steps/terminator_step.pyi,sha256=RLBpARftJNOCB10WS_q1L87m5R-xm8k-F7n3l_hGWs8,2684
@@ -64,15 +65,16 @@ gllm_pipeline/utils/__init__.pyi,sha256=34a24yfX5Wwh3Tw7HuxnSQ1AX0L7-qa0rrXiE1Fq
64
65
  gllm_pipeline/utils/async_utils.pyi,sha256=IB8slUq3tk9tTX7UM1uj7Z6UBXuXRNbQCJzCNp3pwug,899
65
66
  gllm_pipeline/utils/copy.pyi,sha256=IW--DcDVCv87-6-gAlDgo3QybeFoNXEtSASK2P21k0c,260
66
67
  gllm_pipeline/utils/error_handling.pyi,sha256=xeVodtVhoWaPhivY6joWJe1vlxHtMW2csm8ShkoHxHU,2477
67
- gllm_pipeline/utils/graph.pyi,sha256=33HI_9jUJA8FGZi67lUCnXfvGOuRBCp94Hygyra9vM8,682
68
+ gllm_pipeline/utils/graph.pyi,sha256=WUw_jIQ_RhjBbCucCw5Af7HuaDiC89lOLPyXWvO2Uyw,1501
68
69
  gllm_pipeline/utils/has_inputs_mixin.pyi,sha256=vaoRFzZgKdXwJNe7KHziezeHgWkUMORcSxuI5gGUbfU,2585
69
70
  gllm_pipeline/utils/input_map.pyi,sha256=mPWU9_b3VGhszuTjB3yQggZWJCxjZth4_WQdKeckA0Y,413
70
71
  gllm_pipeline/utils/mermaid.pyi,sha256=B096GTXxVAO--kw3UDsbysOsnjGOytYfozX39YaM21A,1174
71
72
  gllm_pipeline/utils/retry_converter.pyi,sha256=TeWG-fsBNtk-rVaV2BZtzvM-y_drf4kGHpVyiZH40L8,1113
73
+ gllm_pipeline/utils/schema.pyi,sha256=9348MO93aEB18vybowOYLtNys8Ee59luuKxFQnfH9Vk,837
72
74
  gllm_pipeline/utils/step_execution.pyi,sha256=pic3DyYF8zIBeLkZ6H_lpq5HOioMoKtPC08rfNDs65M,985
73
75
  gllm_pipeline/utils/typing_compat.pyi,sha256=V4812i25ncSqZ0o_30lUX65tU07bWEs4LIpdLPt2ngg,116
74
76
  gllm_pipeline.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
75
- gllm_pipeline_binary-0.4.30.dist-info/METADATA,sha256=KIvzFVUk-tYhWzMydqyKUNBo2gGBLNtPqzVgO3ZYKsQ,4661
76
- gllm_pipeline_binary-0.4.30.dist-info/WHEEL,sha256=x5rgv--I0NI0IT1Lh9tN1VG2cI637p3deednwYLKnxc,96
77
- gllm_pipeline_binary-0.4.30.dist-info/top_level.txt,sha256=C3yeOtoE6ZhuOnBEq_FFc_Rp954IHJBlB6fBgSdAWYI,14
78
- gllm_pipeline_binary-0.4.30.dist-info/RECORD,,
77
+ gllm_pipeline_binary-0.4.32.dist-info/METADATA,sha256=2J5E90dvX0WHXUdx3gWnVT_VNUX2ohoPYZq5vWyDNBc,4661
78
+ gllm_pipeline_binary-0.4.32.dist-info/WHEEL,sha256=x5rgv--I0NI0IT1Lh9tN1VG2cI637p3deednwYLKnxc,96
79
+ gllm_pipeline_binary-0.4.32.dist-info/top_level.txt,sha256=C3yeOtoE6ZhuOnBEq_FFc_Rp954IHJBlB6fBgSdAWYI,14
80
+ gllm_pipeline_binary-0.4.32.dist-info/RECORD,,