llmp.components.optimizer.instructions.InstructionOptimizer¶
- class llmp.components.optimizer.instructions.InstructionOptimizer(job: JobRecord, test_set: list[llmp.data_model.example_record.ExampleRecord] = None, display_progress: bool = True, debug: bool = False, **kwargs)[source]¶
Instruction Optimizer for a given job.
The InstructionOptimizer is used to optimize the instructions for a given job. It runs an TestSet of Examples with different instructions and returns the best instruction.
Attributes
INSTRUCTION_TEST_SIZEMIN_EXAMPLESPROMPT_SAMPLE_SIZERUN_PER_SAMPLESELECT_MODETEST_SIZEtest_set_idsMethods
__init__(job[, test_set, display_progress, ...])evaluate(job_settings[, num_workers])examples_to_prompt(examples)get_progress_bar(length, description[, sub, ...])optimize([mode, metric])Optimize the prompts and examples for a specific job.
- __init__(job: JobRecord, test_set: list[llmp.data_model.example_record.ExampleRecord] = None, display_progress: bool = True, debug: bool = False, **kwargs)[source]¶
- examples_to_prompt(examples: list[llmp.data_model.example_record.ExampleRecord])[source]¶
- get_progress_bar(length: int, description: str, sub: bool = False, desc_length: int = 40, leave: bool = True)¶