data_models.strategies.api

data_models.strategies.api

Classes

Name Description
DoEStrategy
FactorialStrategy Factorial design strategy.
FractionalFactorialStrategy Fractional factorial design strategy.
ActiveLearningStrategy Datamodel for an ActiveLearningStrategy that focusses on pure exploration of the input space.
BotorchStrategy
EntingStrategy
MoboStrategy
MultiFidelityStrategy
MultiobjectiveStrategy
AdditiveSoboStrategy
CustomSoboStrategy
LLMStrategy Strategy that uses a large language model to propose optimization candidates.

DoEStrategy

data_models.strategies.api.DoEStrategy()

Attributes

Name Description
return_fixed_candidates Datamodel for strategy for design of experiments. This strategy is used to generate a set of

FactorialStrategy

data_models.strategies.api.FactorialStrategy()

Factorial design strategy.

This strategy is deprecated, please use FractionalFactorialStrategy instead.

FractionalFactorialStrategy

data_models.strategies.api.FractionalFactorialStrategy()

Fractional factorial design strategy.

This strategy generates a fractional factorial two level design for the continuous part of the domain, which is then combined with the categorical part of the domain. For every categorical combination, the continuous part of the design is repeated.

ActiveLearningStrategy

data_models.strategies.api.ActiveLearningStrategy()

Datamodel for an ActiveLearningStrategy that focusses on pure exploration of the input space. This type of strategy chooses new candidate points in order to minimize the uncertainty.

Methods

Name Description
is_feature_implemented Method to check if a specific feature type is implemented for the strategy
is_objective_implemented Method to check if a objective type is implemented for the strategy
is_feature_implemented
data_models.strategies.api.ActiveLearningStrategy.is_feature_implemented(
    my_type,
)

Method to check if a specific feature type is implemented for the strategy

Parameters
Name Type Description Default
my_type Type[Feature] Feature class required
Returns
Name Type Description
bool bool True if the feature type is valid for the strategy chosen, False otherwise
is_objective_implemented
data_models.strategies.api.ActiveLearningStrategy.is_objective_implemented(
    my_type,
)

Method to check if a objective type is implemented for the strategy

Parameters
Name Type Description Default
my_type Type[Objective] Objective class required
Returns
Name Type Description
bool bool True if the objective type is valid for the strategy chosen, False otherwise

BotorchStrategy

data_models.strategies.api.BotorchStrategy()

Methods

Name Description
is_constraint_implemented Method to check if a specific constraint type is implemented for the strategy. For optimizer-specific
validate_multitask_allowed Ensures that if a multitask model is used there is only a single allowed task category
validate_outlier_detection_specs_for_domain Ensures that a outlier_detection model is specified for each output feature
validate_surrogate_specs Ensures that a prediction model is specified for each output feature
is_constraint_implemented
data_models.strategies.api.BotorchStrategy.is_constraint_implemented(my_type)

Method to check if a specific constraint type is implemented for the strategy. For optimizer-specific strategies, this is passed to the optimizer check.

Parameters
Name Type Description Default
my_type Type[Constraint] Constraint class required
Returns
Name Type Description
bool bool True if the constraint type is valid for the strategy chosen, False otherwise
validate_multitask_allowed
data_models.strategies.api.BotorchStrategy.validate_multitask_allowed()

Ensures that if a multitask model is used there is only a single allowed task category

validate_outlier_detection_specs_for_domain
data_models.strategies.api.BotorchStrategy.validate_outlier_detection_specs_for_domain(
)

Ensures that a outlier_detection model is specified for each output feature

validate_surrogate_specs
data_models.strategies.api.BotorchStrategy.validate_surrogate_specs()

Ensures that a prediction model is specified for each output feature

EntingStrategy

data_models.strategies.api.EntingStrategy()

MoboStrategy

data_models.strategies.api.MoboStrategy()

Methods

Name Description
is_feature_implemented Method to check if a specific feature type is implemented for the strategy
is_objective_implemented Method to check if a objective type is implemented for the strategy
validate_ref_point Validate that the provided refpoint matches the provided domain.
is_feature_implemented
data_models.strategies.api.MoboStrategy.is_feature_implemented(my_type)

Method to check if a specific feature type is implemented for the strategy

Parameters
Name Type Description Default
my_type Type[Feature] Feature class required
Returns
Name Type Description
bool bool True if the feature type is valid for the strategy chosen, False otherwise
is_objective_implemented
data_models.strategies.api.MoboStrategy.is_objective_implemented(my_type)

Method to check if a objective type is implemented for the strategy

Parameters
Name Type Description Default
my_type Type[Objective] Objective class required
Returns
Name Type Description
bool bool True if the objective type is valid for the strategy chosen, False otherwise
validate_ref_point
data_models.strategies.api.MoboStrategy.validate_ref_point()

Validate that the provided refpoint matches the provided domain.

MultiFidelityStrategy

data_models.strategies.api.MultiFidelityStrategy()

Methods

Name Description
validate_multitask_allowed Overwrites BotorchSurrogate.validate_multitask_allowed, as multiple tasks are allowed.
validate_only_one_target_fidelity Ensures that there is only one target fidelity (task where fidelity==0).
validate_surrogate_specs Ensures that a multi-task model is specified for each output feature
validate_tasks_and_fidelity_thresholds Ensures that there is one threshold per fidelity
validate_multitask_allowed
data_models.strategies.api.MultiFidelityStrategy.validate_multitask_allowed()

Overwrites BotorchSurrogate.validate_multitask_allowed, as multiple tasks are allowed.

validate_only_one_target_fidelity
data_models.strategies.api.MultiFidelityStrategy.validate_only_one_target_fidelity(
)

Ensures that there is only one target fidelity (task where fidelity==0).

validate_surrogate_specs
data_models.strategies.api.MultiFidelityStrategy.validate_surrogate_specs()

Ensures that a multi-task model is specified for each output feature

validate_tasks_and_fidelity_thresholds
data_models.strategies.api.MultiFidelityStrategy.validate_tasks_and_fidelity_thresholds(
)

Ensures that there is one threshold per fidelity

MultiobjectiveStrategy

data_models.strategies.api.MultiobjectiveStrategy()

Methods

Name Description
validate_domain_is_multiobjective Validate that the domain is multiobjective.
validate_domain_is_multiobjective
data_models.strategies.api.MultiobjectiveStrategy.validate_domain_is_multiobjective(
    v,
)

Validate that the domain is multiobjective.

AdditiveSoboStrategy

data_models.strategies.api.AdditiveSoboStrategy()

CustomSoboStrategy

data_models.strategies.api.CustomSoboStrategy()

LLMStrategy

data_models.strategies.api.LLMStrategy()

Strategy that uses a large language model to propose optimization candidates.

Instead of fitting a surrogate and optimizing an acquisition function, this strategy lets an LLM read the optimization problem — feature bounds, constraints, objectives, contextual descriptions, and prior experiments — and directly propose candidate points. It is useful for cold-start designs, mixed / categorical / molecular spaces where domain knowledge helps, and exploration informed by written context (Feature.context and Domain.context).

It is not a replacement for a Bayesian optimizer on well-understood numerical problems: there is no calibrated uncertainty model and no acquisition function. Treat candidates as informed heuristics, not optima.

On each ask(), a pydantic output schema is generated from the domain’s input features and the LLM is prompted with a textual problem description plus, optionally, a selection of prior experiments. Returned candidates are validated against the domain; bound or constraint violations are sent back to the LLM as retry messages via pydantic-ai’s output_retries.

Currently supports single-objective optimization with MaximizeObjective or MinimizeObjective, and LinearEquality, LinearInequality, and NChooseK constraints. All feature types are supported.

Example

Basic usage::

strategy = LLMStrategy.make(
    domain=domain,
    llm=AnthropicLLMProvider(model="claude-sonnet-4-5"),
)

Enable extended reasoning for harder problems (many constraints, rich context). thinking is pydantic-ai’s cross-provider capability key — it maps to Anthropic’s extended thinking, OpenAI’s reasoning_effort, and similar mechanisms on other providers. Reasoning increases cost and latency considerably, so it is not enabled by default::

strategy = LLMStrategy.make(
    domain=domain,
    llm=AnthropicLLMProvider(model="claude-sonnet-4-5"),
    model_settings={"thinking": "high"},
)

Attributes

Name Type Description
llm AnyLLMProvider LLM provider configuration.
model_settings Optional[Dict[str, Any]] Optional dict forwarded directly to pydantic-ai’s model_settings. Useful keys include temperature, max_tokens, top_p, seed, timeout, and the cross-provider capability thinking ("low" / "medium" / "high"). Provider-prefixed keys such as anthropic_thinking or openai_reasoning_effort are also accepted as escape hatches for finer control. Keys are not validated by BoFire — pydantic-ai and the underlying provider SDK are the source of truth.
output_retries PositiveInt Number of retries when output validation fails (constraint or bound violations). Each retry sends the LLM the invalid candidates and the error so it can correct.
n_recent_experiments Optional[Annotated[int, Field(gt=0)]] If set, only the most recent N experiments are shown to the LLM. Keeps prompt size bounded on long campaigns.
n_top_experiments Optional[Annotated[int, Field(gt=0)]] If set, the top N experiments by objective value are shown to the LLM. Combine with n_recent_experiments to mix recency and quality.
system_prompt Optional[str] Optional override for the default system prompt.

Methods

Name Description
validate_single_objective Validate that the domain has exactly one output with a supported objective.
validate_single_objective
data_models.strategies.api.LLMStrategy.validate_single_objective()

Validate that the domain has exactly one output with a supported objective.