Detailed reference documentation for the callback system in the Plexe Python library.
Callback
base class:
BuildStateInfo
dataclass provides context about the current state of the build process and is passed to all callback methods:
Attribute | Type | Description |
---|---|---|
intent | str | The natural language description of the model’s intent |
provider | str | The provider (LLM) used for generating the model |
input_schema | Optional[Type[BaseModel]] | The input schema for the model |
output_schema | Optional[Type[BaseModel]] | The output schema for the model |
run_timeout | Optional[int] | Maximum time in seconds for each individual training run |
max_iterations | Optional[int] | Maximum number of iterations for the model building process |
timeout | Optional[int] | Maximum total time in seconds for the entire model building process |
iteration | int | Current iteration number (0-indexed) |
datasets | Optional[Dict[str, TabularConvertible]] | Dictionary of datasets used for training |
node | Optional[Node] | The solution node being evaluated in the current iteration |
ChainOfThoughtModelCallback
Parameter | Type | Description |
---|---|---|
emitter | Optional[Emitter] | Object that handles outputting the chain of thought logs. Default: ConsoleEmitter() |
include_code | bool | Whether to include generated code in the logs. Default: True |
chain_of_thought=True
is set in model.build()
.
Example:
MLFlowCallback
Parameter | Type | Description |
---|---|---|
tracking_uri | Optional[str] | MLflow tracking server URI. Default: None (uses default MLflow URI) |
experiment_name | Optional[str] | MLflow experiment name. Default: None (uses/creates “Default”) |
run_name_prefix | str | Prefix for MLflow run names. Default: "plexe_" |
log_code | bool | Whether to log generated code as artifacts. Default: True |
log_artifacts | bool | Whether to log model artifacts. Default: True |
Callback
and implementing the desired methods:
on_build_start
methods are called in the order they appear in the liston_iteration_start
methods are called in order
b. The iteration runs
c. All callbacks’ on_iteration_end
methods are called in orderon_build_end
methods are called in orderChainOfThoughtModelCallback
uses a ChainOfThoughtEmitter
to output the chain of thought logs. Built-in emitters include:
ConsoleEmitter
LoggingEmitter
MultiEmitter
ChainOfThoughtEmitter
: