Complete reference documentation for the Plexe Python library API.
Model
Parameter | Type | Description | |
---|---|---|---|
intent | str | Natural language description of what the model should do. | |
input_schema | `Type[BaseModel] | Dict[str, type]` | Schema defining input data structure. Can be a dictionary or Pydantic model. Default: None . |
output_schema | `Type[BaseModel] | Dict[str, type]` | Schema defining output data structure. Can be a dictionary or Pydantic model. Default: None . |
constraints | List[Constraint] | List of constraints the model should adhere to. Default: None . | |
distributed | bool | Whether to use distributed execution (Ray) when building. Default: False . |
build
Parameter | Type | Description |
---|---|---|
datasets | List[Union[pd.DataFrame, DatasetGenerator]] | List of pandas DataFrames or DatasetGenerator objects for training data. |
provider | Union[str, ProviderConfig] | LLM provider to use, either as a string (“openai/gpt-4o-mini”) or ProviderConfig object. Default: “openai/gpt-4o-mini”. |
timeout | Optional[int] | Maximum total time (in seconds) for the entire build process (all iterations). |
max_iterations | Optional[int] | Maximum number of iterations to attempt. |
run_timeout | int | Maximum time (in seconds) for each individual training run. Default: 1800 (30 minutes). |
callbacks | Optional[List[Callback]] | List of callback objects for monitoring the build process. |
verbose | bool | Whether to display detailed agent logs. Default: False . |
chain_of_thought | bool | Whether to enable verbose output of agent reasoning. Default: True . |
None
Note: At least one of timeout
or max_iterations
must be provided.
predict
Parameter | Type | Description |
---|---|---|
x | Dict[str, Any] | Input data for prediction. |
validate_input | bool | Whether to validate input against schema. Default: False . |
validate_output | bool | Whether to validate output against schema. Default: False . |
Dict[str, Any]
- Prediction result
get_state
str
representing model state: "draft"
, "building"
, "ready"
, or "error"
get_metadata
get_metrics
None
describe
ModelDescription
object
DatasetGenerator
Parameter | Type | Description | |
---|---|---|---|
description | str | Human-readable description of the dataset. | |
provider | str | LLM provider used for synthetic data generation. | |
schema | `Type[BaseModel] | Dict[str, type]` | The schema the data should match, if any. Default: None . |
data | pd.DataFrame | A dataset of real data on which to base the generation, if available. Default: None . |
Method | Description |
---|---|
generate(num_samples: int) | Generates the specified number of synthetic data samples. |
data property | Returns the dataset as a pandas DataFrame. |
Callback
Constraint
Parameter | Type | Description |
---|---|---|
condition | Callable[[Any, Any], bool] | Function that evaluates the constraint. |
description | str | Human-readable description of the constraint. |
save_model
Parameter | Type | Description | |
---|---|---|---|
model | Model | The model to save. | |
path | `str | Path` | Path where the model should be saved. Must end with .tar.gz. |
str
- Path where the model was saved
load_model
Parameter | Type | Description | |
---|---|---|---|
path | `str | Path` | Path to the saved model archive (.tar.gz file). |
Model
- The loaded model
configure_logging
Parameter | Type | Description |
---|---|---|
level | Union[str, int] | Logging level (from logging module or as string). |
file | Optional[str] | Path to a log file. If provided, logs will be written to this file in addition to stdout. |
None
ModelState
get_state()
method returns the string value.
ProviderConfig
plexe.internal.common.provider
).
Parameter | Type | Description |
---|---|---|
default_provider | str | Default provider for all roles (e.g., “openai/gpt-4o-mini”). |
orchestrator_provider | Optional[str] | Provider for the orchestrator agent (coordinates the overall process). |
research_provider | Optional[str] | Provider for the research agent (analyzes problems and plans solutions). |
engineer_provider | Optional[str] | Provider for the engineer agent (generates training code). |
ops_provider | Optional[str] | Provider for the ops agent (generates inference code). |
tool_provider | Optional[str] | Provider for tool agents (performs specialized tasks). |
Metric
Parameter | Type | Description |
---|---|---|
name | str | Name of the metric (e.g., “accuracy”, “rmse”). |
value | float | Numeric value of the metric. Default: None . |
comparator | MetricComparator | Comparison logic for determining which metric values are better. Default: None . |
is_worst | bool | Whether this is the worst possible value for the metric. Default: False . |
MetricComparator
Parameter | Type | Description |
---|---|---|
comparison_method | ComparisonMethod | The method used to compare metrics (HIGHER_IS_BETTER, LOWER_IS_BETTER, etc.). |
target | float | The target value for TARGET_IS_BETTER comparisons. Default: None . |
epsilon | float | Small value used for floating point comparisons. Default: 1e-9 . |