Blocks
GLLM RAG Blocks.
Modular building blocks for constructing RAG pipelines.
MultiQueryRoutingPipeline(decomposer, router, max_sub_queries=4, on_empty_decomposition=PASSTHROUGH)
Multi-query routing pipeline block.
The pipeline follows the pattern: Decompose -> Normalize Decomposition -> Route.
When on_empty_decomposition is "passthrough", an empty decomposition result is replaced by
the original query as a single sub-query. When on_empty_decomposition is "error", a ValueError
is raised. Sub-queries are capped at max_sub_queries before routing.
Attributes:
| Name | Type | Description |
|---|---|---|
decomposer |
BaseQueryTransformer
|
Stage used to decompose the query into sub-queries. |
router |
BaseRouter
|
Stage used to route each sub-query to a named branch. |
max_sub_queries |
int
|
Maximum number of sub-queries to route. |
on_empty_decomposition |
OnEmptyDecompositionPolicy
|
Terminal behavior when decomposer returns no sub-queries. |
Initialize the multi-query routing pipeline block.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
decomposer
|
BaseQueryTransformer
|
Stage used to decompose the query into sub-queries. |
required |
router
|
BaseRouter
|
Stage used to route each sub-query. |
required |
max_sub_queries
|
int
|
Maximum number of sub-queries to route. |
4
|
on_empty_decomposition
|
OnEmptyDecompositionPolicy
|
Terminal behavior when decomposer returns no sub-queries. |
PASSTHROUGH
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
TypeError
|
If |
build()
Materialize the multi-query routing pipeline.
Returns:
| Name | Type | Description |
|---|---|---|
Pipeline |
Pipeline
|
Materialized pipeline implementing Decompose → Normalize Decomposition → Route behavior. |
MultiQueryRoutingState
Bases: BaseModel
Pipeline state for multi-query routing.
Attributes:
| Name | Type | Description |
|---|---|---|
query |
str
|
Original user query. |
sub_queries |
list[str]
|
Decomposed sub-query strings after cap is applied. |
routing_plan |
list[SubQueryRoute]
|
Final routing assignments. |
SubQueryRoute
Bases: BaseModel
Normalized router output for a single sub-query.
Attributes:
| Name | Type | Description |
|---|---|---|
sub_query |
str
|
The sub-query string that was routed. |
route |
str
|
The route name assigned to the sub-query. |