SADL
Initialize SADL object with credentials, dataframe, context, and entity mappings for efficient data labeling. Enhance your workflow seamlessly
SADLClassifier(cred={}, platform='openai', entities_filepath=None, max_tokens=1024, temperature=0)
→
Bases: object
Class to take in a dataframe and create a data dictionary for it
Class to classify data columns using SADL
Parameters: - entities_filepath (str): The file path to the entities mapping file in JSON format. Default is None. - temperature (int): Control the temperature of the inference/API - max_tokens (int): Control the max_tokens in the inference/API
Output: Use classify_columns method
Source code in llmsdk/agents/sadl.py
classify_columns(context='')
→
Classify the columns.
Parameters: - context (str, optional): The context for classification. If not provided, the default context of the class instance is used.
Returns: - success (bool): Indicates whether the classification was successful. - result_type (str): The type of the classification result. Can be 'json' for JSON format or 'str' for string format. - result (str or dict): The classification result. If 'result_type' is 'json', it's a dictionary; otherwise, it's a string.
Source code in llmsdk/agents/sadl.py
classify_industry()
→
figure out what industry the dataframe is from
Source code in llmsdk/agents/sadl.py
generate_prompt_columns()
→
generate a prompt for labelling a dataframe given some context
Source code in llmsdk/agents/sadl.py
generate_prompt_columns_string()
→
generate prompt in string format
generate_prompt_industry()
→
generate a prompt for identifying the industry of a dataframe given some context
Source code in llmsdk/agents/sadl.py
load_data(content, source='df')
→
- source (str): The type of input data. Can be "df" for a DataFrame input or "csv" for a CSV file input. Default is "df".
- content: data file path (if source=='str') or DataFrame (if source=='df').
Source code in llmsdk/agents/sadl.py
load_entities(entities)
→
load any additional entity mappings and add them to the base entity map entities: path to entity mappings
Source code in llmsdk/agents/sadl.py
map_to_targets(data, targets, use_content=False)
→
map input column names to a defined set of target classes - data: input data to map, must come from the self.load_data(...) method - targets: list of target classes - use_content: if True, send a sample of data content values to LLM to do the mapping set this to True using caution, or data leakage is possible
Source code in llmsdk/agents/sadl.py
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 |
|