Skip to main content
Version: 1.0

aixplain.factories.finetune_factory.prompt_validator

validate_prompt

def validate_prompt(prompt: Text, dataset_list: List[Dataset]) -> Text

[view_source]

Validate and normalize a prompt template against a list of datasets.

This function processes a prompt template that contains references to dataset columns in the format <<COLUMN_NAME>> or <<COLUMN_ID>>. It validates that all referenced columns exist in the provided datasets and normalizes column IDs to their corresponding names.

Arguments:

  • prompt Text - Prompt template containing column references in <<COLUMN_NAME>> or <<COLUMN_ID>> format.
  • dataset_list List[Dataset] - List of datasets to validate the prompt template against.

Returns:

  • Text - Normalized prompt template with column references converted to {COLUMN_NAME} format.

Raises:

  • AssertionError - If any of these conditions are met:
    • Multiple datasets have the same referenced column name
    • Referenced columns are not found in any dataset