llmp.components.base.BaseGenerator

class llmp.components.base.BaseGenerator(job: JobRecord, job_settings: dict = None, **kwargs)[source]

Base class for the Generator component.

A Generator is a wrapper for executing job-specific completion with a job specific input object.

Initialize the generator with a job and job settings.

Parameters
  • job (JobRecord) – the job to be executed

  • job_settings (dict) – the job settings to be used

  • **kwargs – any - passed to load_engine_from_job

Attributes

verification_type

Return the validation type for the generator.

Methods

__init__(job[, job_settings])

Initialize the generator with a job and job settings.

generate(input_object, **kwargs)

Generate text based on the job and input object.

log_generation(input_object, ...)

Log the generation result.

__init__(job: JobRecord, job_settings: dict = None, **kwargs)[source]

Initialize the generator with a job and job settings.

Parameters
  • job (JobRecord) – the job to be executed

  • job_settings (dict) – the job settings to be used

  • **kwargs – any - passed to load_engine_from_job

abstract generate(input_object: dict, **kwargs)[source]

Generate text based on the job and input object.

log_generation(input_object: dict, generated_object: dict, run_metrics: dict, **kwargs) Optional[Event][source]

Log the generation result.

Parameters
  • input_object (dict) – the input object

  • generated_object (dict) – the generated object

  • run_metrics (dict) – the run metrics

  • **kwargs – any - passed to JobRecord.log_generation