gllm-pipeline-binary 0.4.29__cp312-cp312-win_amd64.whl → 0.4.31__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.
- gllm_pipeline/pipeline/pipeline.pyi +54 -26
- gllm_pipeline/steps/pipeline_step.pyi +4 -5
- gllm_pipeline/types.pyi +31 -0
- gllm_pipeline/utils/schema.pyi +25 -0
- gllm_pipeline.cp312-win_amd64.pyd +0 -0
- {gllm_pipeline_binary-0.4.29.dist-info → gllm_pipeline_binary-0.4.31.dist-info}/METADATA +2 -2
- {gllm_pipeline_binary-0.4.29.dist-info → gllm_pipeline_binary-0.4.31.dist-info}/RECORD +9 -8
- {gllm_pipeline_binary-0.4.29.dist-info → gllm_pipeline_binary-0.4.31.dist-info}/WHEEL +0 -0
- {gllm_pipeline_binary-0.4.29.dist-info → gllm_pipeline_binary-0.4.31.dist-info}/top_level.txt +0 -0
|
@@ -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
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
|
|
205
|
-
|
|
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
|
-
#
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
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
|
-
|
|
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.
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
@@ -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.
|
|
3
|
+
Version: 0.4.31
|
|
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
|
|
@@ -8,7 +8,7 @@ Description-Content-Type: text/markdown
|
|
|
8
8
|
Requires-Dist: pydantic<2.12.0,>=2.11.7
|
|
9
9
|
Requires-Dist: gllm-core-binary<0.4.0,>=0.3.0
|
|
10
10
|
Requires-Dist: gllm-inference-binary<0.6.0,>=0.5.0
|
|
11
|
-
Requires-Dist: aiohttp<3.
|
|
11
|
+
Requires-Dist: aiohttp<3.14.0,>=3.13.3
|
|
12
12
|
Requires-Dist: langgraph<0.7.0,>=0.6.0
|
|
13
13
|
Requires-Dist: typing-extensions<5.0.0,>=4.5.0
|
|
14
14
|
Provides-Extra: dev
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
gllm_pipeline.cp312-win_amd64.pyd,sha256=
|
|
1
|
+
gllm_pipeline.cp312-win_amd64.pyd,sha256=miWFX5HGoH_gHho40b0UCDODlVeg_2qyv_9vb2VpJcs,2228736
|
|
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=
|
|
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=
|
|
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
13
|
gllm_pipeline/pipeline/composer/composer.pyi,sha256=RilABdb4JN_XusRv_0rfG2ziyOPf-YqmbRjCCk0A9z8,28674
|
|
@@ -50,7 +50,7 @@ gllm_pipeline/steps/log_step.pyi,sha256=lXOd5VAjfi2cs5yFMQrFgZlnV1Wj9EIeuZa6SIje
|
|
|
50
50
|
gllm_pipeline/steps/map_reduce_step.pyi,sha256=lZ1dnG6-TNt4iMRWXSfmpJkVVqHlN2GTUXcOsxi4Kls,6205
|
|
51
51
|
gllm_pipeline/steps/no_op_step.pyi,sha256=8iepve5pJB02d-yG78-eIQuBajsl-i2ovBTluFq5pCo,1578
|
|
52
52
|
gllm_pipeline/steps/parallel_step.pyi,sha256=13VK3h_CGB11pQEFrUroy2FM-J86U3sR2JP_R9yaNoo,8524
|
|
53
|
-
gllm_pipeline/steps/pipeline_step.pyi,sha256=
|
|
53
|
+
gllm_pipeline/steps/pipeline_step.pyi,sha256=fBxIcmEDr-cj54KSn6ZvPCESetHz9vbefXOgj97b5QY,11488
|
|
54
54
|
gllm_pipeline/steps/state_operator_step.pyi,sha256=rtzfedK5mDszHpFusXHUiNG3-3fO-mBvmPqDxLvk67A,5293
|
|
55
55
|
gllm_pipeline/steps/subgraph_step.pyi,sha256=f99kx8Vo2foDg6CRqzObvRCetcvzvUQIxW9M6SEZRUs,5996
|
|
56
56
|
gllm_pipeline/steps/terminator_step.pyi,sha256=RLBpARftJNOCB10WS_q1L87m5R-xm8k-F7n3l_hGWs8,2684
|
|
@@ -69,10 +69,11 @@ gllm_pipeline/utils/has_inputs_mixin.pyi,sha256=vaoRFzZgKdXwJNe7KHziezeHgWkUMORc
|
|
|
69
69
|
gllm_pipeline/utils/input_map.pyi,sha256=mPWU9_b3VGhszuTjB3yQggZWJCxjZth4_WQdKeckA0Y,413
|
|
70
70
|
gllm_pipeline/utils/mermaid.pyi,sha256=B096GTXxVAO--kw3UDsbysOsnjGOytYfozX39YaM21A,1174
|
|
71
71
|
gllm_pipeline/utils/retry_converter.pyi,sha256=TeWG-fsBNtk-rVaV2BZtzvM-y_drf4kGHpVyiZH40L8,1113
|
|
72
|
+
gllm_pipeline/utils/schema.pyi,sha256=9348MO93aEB18vybowOYLtNys8Ee59luuKxFQnfH9Vk,837
|
|
72
73
|
gllm_pipeline/utils/step_execution.pyi,sha256=pic3DyYF8zIBeLkZ6H_lpq5HOioMoKtPC08rfNDs65M,985
|
|
73
74
|
gllm_pipeline/utils/typing_compat.pyi,sha256=V4812i25ncSqZ0o_30lUX65tU07bWEs4LIpdLPt2ngg,116
|
|
74
75
|
gllm_pipeline.build/.gitignore,sha256=aEiIwOuxfzdCmLZe4oB1JsBmCUxwG8x-u-HBCV9JT8E,1
|
|
75
|
-
gllm_pipeline_binary-0.4.
|
|
76
|
-
gllm_pipeline_binary-0.4.
|
|
77
|
-
gllm_pipeline_binary-0.4.
|
|
78
|
-
gllm_pipeline_binary-0.4.
|
|
76
|
+
gllm_pipeline_binary-0.4.31.dist-info/METADATA,sha256=ovOQk8lGR80el9ch7DIWi6kXcuiXv3TWW_zrk7v_Ygk,4661
|
|
77
|
+
gllm_pipeline_binary-0.4.31.dist-info/WHEEL,sha256=x5rgv--I0NI0IT1Lh9tN1VG2cI637p3deednwYLKnxc,96
|
|
78
|
+
gllm_pipeline_binary-0.4.31.dist-info/top_level.txt,sha256=C3yeOtoE6ZhuOnBEq_FFc_Rp954IHJBlB6fBgSdAWYI,14
|
|
79
|
+
gllm_pipeline_binary-0.4.31.dist-info/RECORD,,
|
|
File without changes
|
{gllm_pipeline_binary-0.4.29.dist-info → gllm_pipeline_binary-0.4.31.dist-info}/top_level.txt
RENAMED
|
File without changes
|