Model TargetSpec
class TargetSpec(BaseModel) # adk.models.model
Pydantic model for one entry in target_specifications.json and
GenieModel.target_specifications. Describes what targets an agent was trained for
and how observations are ordered.
Not the same as the runtime TargetSpec inside
OptimizationContext. Model specs are authored on disk; runtime specs
are built by the ADK when an optimization starts.
Definition
class TargetSpec(BaseModel):
label: str
kind: RuntimeType
points: int
precisions: float | list[float] | list[list[float]]
precision_kind: PrecisionType = PrecisionType.Absolute
fn: Fn = Fn.Range
description: str = ""
order: int
In JSON, fn, kind, and precision_kind are usually strings (see below). The Python types are
Fn, RuntimeType, and PrecisionType enums.
Members
label
label: str
A unique identifier which can be used to map user defined expressions (on the web interface) to actual agent specifications.
description
description: str = ""
Human-readable description describing the purpose of the target specification. For informal purposes only.
fn
fn: Fn
Objective function for the target. JSON accepts "min", "max", "range", or "equals" (or integer codes 1–4).
kind
kind: RuntimeType
Data shape for the target. JSON accepts "scalar", "vector", or "series" (or integer codes 0–2). Two-dimensional data is represented as series.
points
points: int
Number of points required by the target. For vector and series targets, this represents the length. For series, this is the total number of elements across all rows. Not validated when kind is scalar.
precisions
precisions: float | list[float] | list[list[float]]
Tolerance or precision for optimization:
- When
kindisscalar: a single float - When
kindisvector: a list of floats (one per point) - When
kindisseries: a 2D list matching the series shape
Only applicable for range and equals objective functions.
precision_kind
precision_kind: PrecisionType = PrecisionType.Absolute
Whether precisions are absolute values or percentages of the target mean. JSON accepts "absolute" / "percent" (or 1 / 2). Used when flattening target spaces in OptimizationEnv.
order
order: int
Used to sort observations before they are provided to the agent; must be unique across all target specifications on a model.
Related
- Runtime TargetSpec — shape of
OptimizationContext.targetsat run time - Target specifications on disk