Semantic extract operator
SemanticExtractOperator
Bases: Operator, ServiceClient
Semantic extract operator extracts entities from natural language text fields using LLM models.
Attributes:
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
entities |
list[dict] | N/A | List of entities to extract. Each dict has 'name', 'description' (optional), 'extract_on_fields' (optional list of field names - if not provided, extracts from all fields), and 'type' (optional) | |
context |
str | "" | Additional context information that provides domain knowledge or additional instructions for the extraction | |
demonstrations |
str | "" | Additional demonstrations to help in-context learning | |
extract_with_single_prompt |
bool | True | If true, extract all entities in a single prompt, else extract each entity with individual prompt |
Source code in blue/operators/semantic_extract_operator.py
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
semantic_extract_operator_explainer(output, input_data, attributes)
Generate explanation for semantic extract operator execution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output
|
Any
|
The output result from the operator execution. |
required |
input_data
|
List[List[Dict[str, Any]]]
|
The input data that was processed. |
required |
attributes
|
Dict[str, Any]
|
The attributes used for the operation. |
required |
Returns:
| Type | Description |
|---|---|
Dict[str, Any]
|
Dictionary containing explanation of the operation. |
Source code in blue/operators/semantic_extract_operator.py
91 92 93 94 95 96 97 98 99 100 101 102 | |
semantic_extract_operator_function(input_data, attributes, properties=None)
Extract entities from natural language text fields using LLM models.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
List[List[Dict[str, Any]]]
|
List of JSON arrays (List[List[Dict[str, Any]]]) containing records with text fields to extract entities from. |
required |
attributes
|
Dict[str, Any]
|
Dictionary containing extraction parameters including entities, context, demonstrations, and extract_with_single_prompt. |
required |
properties
|
Dict[str, Any]
|
Optional properties dictionary containing service configuration. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
List[List[Dict[str, Any]]]
|
List containing extracted entities for each record in the input data. |
Source code in blue/operators/semantic_extract_operator.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |
semantic_extract_operator_validator(input_data, attributes, properties=None)
Validate semantic extract operator attributes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_data
|
List[List[Dict[str, Any]]]
|
List of JSON arrays (List[List[Dict[str, Any]]]) to validate. |
required |
attributes
|
Dict[str, Any]
|
Dictionary containing operator attributes to validate. |
required |
properties
|
Dict[str, Any]
|
Optional properties dictionary. Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if attributes are valid, False otherwise. |
Source code in blue/operators/semantic_extract_operator.py
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 | |