Nl2query router operator
NL2QueryRouterOperator
Bases: Operator
NL2Query router operator refines to the right nl2q operator based on source.
Attributes:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
search_query |
str | - | Natural language query to process | |
columns |
list[dict] | [] | List of attribute specifications (dicts with name and optional type) | |
execute_query |
bool | True | Whether to execute query or just translate NL to query | |
protocol |
str | "" | Protocol of the source |
Source code in blue/operators/nl2query_router_operator.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
nl2query_router_operator_explainer(output, input_data, attributes)
Explain nl2query router operator output.
Source code in blue/operators/nl2query_router_operator.py
163 164 165 166 167 168 169 170 171 | |
nl2query_router_operator_function(input_data, attributes, properties=None)
Route the execution of query to the right nl2q operator based on source.
NL2QueryRouterOperator only does plan refinement. This function simply returns empty output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
List[List[Dict[str, Any]]]
|
List of JSON arrays (List[List[Dict[str, Any]]]), uses first data source as base. |
required |
attributes
|
Dict[str, Any]
|
Dictionary containing operator attributes including search_query, columns, execute_query, protocol. |
required |
properties
|
Dict[str, Any]
|
Optional properties dictionary. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
List[List[Dict[str, Any]]]
|
Empty list. |
Source code in blue/operators/nl2query_router_operator.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | |
nl2query_router_operator_refiner(input_data, attributes, properties=None)
Refine the nl2query router plan by constructing a data pipeline for each source or collection.
Depending on the protocol of the source/collection, it routes to either nl2llm or nl2sql operator, and may do additional data discovery.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
List[List[Dict[str, Any]]]
|
List of JSON arrays (List[List[Dict[str, Any]]]), each array represents a source or collection to route the query to. |
required |
attributes
|
Dict[str, Any]
|
Dictionary containing operator attributes including search_query, columns, execute_query, protocol. |
required |
properties
|
Dict[str, Any]
|
Optional properties dictionary. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List of data pipelines (as dictionaries) representing the refined nl2query router plans. |
Source code in blue/operators/nl2query_router_operator.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |