inspect_flow.api

Python API

config

Return the flow spec configuration.

def config(
    spec: FlowSpec,
    base_dir: str | None = None,
    *,
    log_level: str = DEFAULT_LOG_LEVEL,
) -> str
spec FlowSpec

The flow spec configuration.

base_dir str | None

The base directory for resolving relative paths. Defaults to the current working directory.

log_level str

The Inspect Flow log level to use. Use spec.options.log_level to set the Inspect AI log level.

load_spec

Load a spec from file.

def load_spec(
    file: str,
    *,
    log_level: str = DEFAULT_LOG_LEVEL,
    args: dict[str, Any] | None = None,
) -> FlowSpec
file str

The path to the spec file.

log_level str

The Inspect Flow log level to use. Use spec.options.log_level to set the Inspect AI log level.

args dict[str, Any] | None

A dictionary of arguments to pass as kwargs to the function in the flow config.

run

Run an inspect_flow evaluation.

def run(
    spec: FlowSpec,
    base_dir: str | None = None,
    *,
    dry_run: bool = False,
    log_level: str = DEFAULT_LOG_LEVEL,
    no_dotenv: bool = False,
) -> None
spec FlowSpec

The flow spec configuration.

base_dir str | None

The base directory for resolving relative paths. Defaults to the current working directory.

dry_run bool

If True, do not run eval, but show a count of tasks that would be run.

log_level str

The Inspect Flow log level to use. Use spec.options.log_level to set the Inspect AI log level.

no_dotenv bool

If True, do not load environment variables from a .env file.