Back to models
Forecaster

AutoResearchForecaster

Categorical in XInsamplePred int insampleExogenous

Forecaster that uses an LLM to generate and refine sktime pipeline blueprints.

Quickstart

python
from sktime.forecasting.agentic import AutoResearchForecaster

estimator = AutoResearchForecaster(cv, model='openai/gpt-4o-mini', n_iterations=3, n_blueprints=5, n_fix_attempts=0, api_params=None, system_prompt=None, refinement_prompt=None, llm_func=None, description_method='basic', estimator_info='names')

Parameters(9)

modelstr, default=”openai/gpt-4o-mini”
LLM model identifier compatible with litellm (e.g., “openai/gpt-4o-mini”, “anthropic/claude-sonnet-4-20250514”).
n_iterationsint, default=3
Number of generate-evaluate-refine iterations.
n_blueprintsint, default=5
Number of blueprints to generate per iteration.
n_fix_attemptsint, default=0

Number of additional LLM calls to attempt fixing each failed blueprint. For each blueprint that fails evaluation, the LLM is asked to correct the spec up to n_fix_attempts times. Set to 0 to disable.

api_paramsdict or None, default=None
Additional keyword arguments passed to litellm.completion (e.g., temperature, max_tokens, api_key).
system_promptstr or None, default=None
Custom system prompt for the LLM. If None, uses the default prompt. The prompt should contain placeholders for {n_blueprints}, {forecaster_names}, and {transformer_names} which are filled in automatically.
refinement_promptstr or None, default=None
Custom refinement prompt template for the LLM. If None, uses the default prompt. The prompt should contain placeholders for {results_summary}, {all_results_ranked}, {best_name}, {best_score}, and {n_blueprints} which are filled in automatically.
llm_funccallable or None, default=None

Custom callable to invoke the LLM. If None, uses litellm.completion via the internal _call_llm function. The callable must have the signature llm_func(messages, model, api_params) -> str, where messages is a list of chat message dicts, model is the model identifier string, api_params is a dict of extra kwargs, and the return value is the raw response text. Primarily useful for testing without an API key.

description_methodstr, default=”basic”

Method for generating dataset description for the LLM. Options:

  • “basic”: Text-only statistics (length, frequency, mean, std, etc.)

  • “described_plot”: Generates a plot and uses a vision LLM to describe it, combined with basic statistics.

  • “image”: Generates a plot and provides it as an image to the blueprint generation LLM (requires vision-capable model).

Vision-based methods (“described_plot”, “image”) require a model that supports image input, which is checked during initialization.

Examples

>>> from sktime_autoresearch import AutoResearchForecaster
>>> from sktime.datasets import load_airline
>>> from sktime.split import SingleWindowSplitter
>>> y = load_airline ()
>>> forecaster = AutoResearchForecaster (
... cv = SingleWindowSplitter (fh = [1, 2, 3 ]),
... model = "openai/gpt-4o-mini",
... n_iterations = 2,
... n_blueprints = 3,
... )
>>> forecaster. fit (y, fh = [1, 2, 3 ])
>>> y_pred = forecaster. predict (fh = [1, 2, 3 ])