Skip to main content
Version: v2.0

aixplain.v2.actions

Unified Actions / Inputs hierarchy for models and tools.

Object Hierarchy:

Actions                    — collection of Action objects
Action — metadata + owns its inputs
Inputs — collection of Input objects
Input — individual input with schema + current value

Models have a single implicit "run" action. The model.inputs shorthand skips the actions layer since there is nothing to disambiguate.

Tools have multiple actions, so the full path is always used.

Input Objects

class Input()

[view_source]

Individual input with schema and current value.

Attributes:

  • name - The input parameter name.
  • required - Whether this input is required.
  • type - The data type (e.g. "text", "number", "string").
  • value - The current value (mutable).
  • description - Human-readable description.

__init__

def __init__(name: str,
required: bool = False,
type: Optional[str] = None,
value: Any = None,
description: str = "",
*,
_validator: Optional[Callable[[Any], bool]] = None,
_metadata: Optional[Any] = None) -> None

[view_source]

Initialize an Input with schema metadata and an optional validator.

name

@property
def name() -> str

[view_source]

The input parameter name.

required

@property
def required() -> bool

[view_source]

Whether this input is required.

type

@property
def type() -> Optional[str]

[view_source]

The data type string (e.g. "text", "number").

value

@property
def value() -> Any

[view_source]

The current value.

value

@value.setter
def value(val: Any) -> None

[view_source]

Set the value, running the validator if one was provided.

description

@property
def description() -> str

[view_source]

Human-readable description of the input.

reset

def reset(default: Any = None) -> None

[view_source]

Reset the value to the given default (bypasses validation).

__eq__

def __eq__(other: object) -> bool

[view_source]

Compare by value so inputs['temperature'] == 0.7 works.

__hash__

def __hash__() -> int

[view_source]

Return an identity-based hash.

__repr__

def __repr__() -> str

[view_source]

Return a developer-friendly representation.

from_parameter

@classmethod
def from_parameter(cls, param: "Parameter") -> "Input"

[view_source]

Build an Input from a model Parameter.

from_action_input_spec

@classmethod
def from_action_input_spec(cls, spec: "ActionInputSpec") -> "Input"

[view_source]

Build an Input from a tool ActionInputSpec.

Inputs Objects

class Inputs()

[view_source]

Ordered collection of Input objects.

Supports dict-like access (inputs["key"], inputs["key"] = val) and dot-notation (inputs.key, inputs.key = val).

Iterating, .keys(), .values(), and .items() operate on raw values so that dict(inputs.items()) gives a plain {name: value} mapping suitable for API payloads.

__init__

def __init__(inputs: Optional[Dict[str, Input]] = None) -> None

[view_source]

Initialize from an optional ordered dict of Input objects.

__getitem__

def __getitem__(key: str) -> Input

[view_source]

Return the Input for key.

__setitem__

def __setitem__(key: str, value: Any) -> None

[view_source]

Set the value on the Input identified by key.

__contains__

def __contains__(key: object) -> bool

[view_source]

Return whether key is a known input name.

__len__

def __len__() -> int

[view_source]

Return the number of inputs.

__iter__

def __iter__()

[view_source]

Iterate over input names.

__getattr__

def __getattr__(name: str) -> Input

[view_source]

Dot-notation read: inputs.temperature.

__setattr__

def __setattr__(name: str, value: Any) -> None

[view_source]

Dot-notation write: inputs.temperature = 0.7.

keys

def keys() -> List[str]

[view_source]

Return input names.

values

def values() -> List[Any]

[view_source]

Return raw values for all inputs.

items

def items() -> List[tuple[str, Any]]

[view_source]

Return (name, value) pairs.

get

def get(key: str, default: Any = None) -> Optional[Input]

[view_source]

Return the Input for key, or default.

update

def update(**kwargs: Any) -> None

[view_source]

Update multiple input values at once.

reset

def reset(key: Optional[str] = None) -> None

[view_source]

Reset one or all inputs to their default values.

copy

def copy() -> Dict[str, Any]

[view_source]

Return a shallow copy of {name: value}.

validate

def validate(data: Optional[Dict[str, Any]] = None) -> List[str]

[view_source]

Validate data (or current values) against input specs.

Returns a list of error strings (empty means valid).

required

@property
def required() -> List[str]

[view_source]

Names of all required inputs.

__repr__

def __repr__() -> str

[view_source]

Return Inputs({'key': value, ...}).

from_parameters

@classmethod
def from_parameters(cls, params: Optional[list]) -> "Inputs"

[view_source]

Build from a list of model Parameter objects.

from_action_input_specs

@classmethod
def from_action_input_specs(cls, specs: Optional[list]) -> "Inputs"

[view_source]

Build from a list of tool ActionInputSpec objects.

Action Objects

class Action()

[view_source]

Metadata for a single action, owning its Inputs.

For models the single action is always "run". For tools there may be many (e.g. "search_agents", "search_models").

__init__

def __init__(name: str,
description: Optional[str] = None,
*,
inputs: Optional[Inputs] = None,
_inputs_loader: Optional[Callable[[], Inputs]] = None) -> None

[view_source]

Initialize an Action with name, description and optional lazy inputs.

name

@property
def name() -> str

[view_source]

The canonical action name.

description

@property
def description() -> Optional[str]

[view_source]

Human-readable description of the action.

inputs

@property
def inputs() -> Inputs

[view_source]

The action's Inputs (lazily loaded for tool actions).

__repr__

def __repr__() -> str

[view_source]

Return a multi-line representation showing the action and its inputs.

Actions Objects

class Actions()

[view_source]

Ordered collection of Action objects.

For models this contains a single "run" action. For tools it lazily discovers actions from the backend.

__init__

def __init__(
actions: Optional[Dict[str, Action]] = None,
*,
_action_factory: Optional[Callable[[str, Optional[str]], Action]] = None,
_actions_lister: Optional[Callable[[], List[tuple[str,
Optional[str]]]]] = None
) -> None

[view_source]

Initialize with either an eager dict or lazy factory/lister callbacks.

__getitem__

def __getitem__(key: str) -> Action

[view_source]

Return the Action for key (case-insensitive).

__getattr__

def __getattr__(name: str) -> Action

[view_source]

Dot-notation read: tool.actions.search (case-insensitive).

Only consulted when normal attribute lookup fails, so it never shadows the real instance attributes (_actions etc.). Private names are rejected to avoid recursion during initialization.

__contains__

def __contains__(key: object) -> bool

[view_source]

Return whether key matches an available action name.

__iter__

def __iter__()

[view_source]

Iterate over available action names.

__len__

def __len__() -> int

[view_source]

Return the number of available actions.

__repr__

def __repr__() -> str

[view_source]

Return Actions(['action1', 'action2', ...]).

refresh

def refresh() -> None

[view_source]

Clear caches and force re-fetch on next access.