Skip to main content

aip_sdk.RunTarget

aip_sdk.RunTarget

One partition target a trace_metric_invoke run scores at.

Pass a list of these to aip.run(targets=[...])/aip.arun(targets=[...]) to score several granularities in one run. span_kind cannot be set — scope which spans are scored with partition_id instead (see aip.create_partition()).

aip.run(**config.to_run_kwargs()) accepts a stored v2 config's targets directly; from_eval_target() converts one when building the list by hand.

metric_configs remains a plain, mutable dict — avoid mutating it in place. It is kept out of repr()/str(), and masked in model_dump()/model_dump_json(), since it can carry an inline judge key (see metric_configs["judge_api_key"] on aip_sdk.run.run()) — access the attribute directly to read the real value.

Attributes

  • partition_type PartitionType | None: The target's granularity. Required once more than one target is supplied, so each target's results stay distinguishable.
  • partition_id str | None: A saved Partition's id. For a SESSION/TRACE target it only labels the resulting rows with the partition scored — the selector narrows nothing at that granularity. For a SPAN target it additionally narrows scoring to the spans that partition's selector resolves to.
  • span_kind SpanKind | None: Always rejected — name a SPAN partition_id instead.
  • metrics tuple[str, ...] | None: Metrics to score at this target, overriding the run-level metrics for it. Omit to score the run-level selection.
  • metric_configs dict[str, MetricConfigValue] | None: Per-metric judge configuration for this target, overriding the run-level metric_configs for the same metric. A metric maps to one parameter set, or to a list of them at config schema "3".

aip_sdk.RunTarget.from_eval_target​

aip_sdk.RunTarget.from_eval_target(target: EvalTarget) -> RunTarget

Build a run target from a stored config's EvalTarget.

The two models are field-congruent, so this is a straight copy; span_kind is copied rather than dropped, so run() refuses it instead of silently widening the target to every span.

Parameters

  • target EvalTarget: One entry from EvalConfig.resolved_targets().

Returns

  • RunTarget: The equivalent RunTarget, ready to pass to aip.run(targets=[...]).

aip_sdk.RunTarget.metric_configs​

aip_sdk.RunTarget.metric_configs: dict[str, MetricConfigValue] | None = Field(default=None, repr=False)

No docstring is defined in the source.

aip_sdk.RunTarget.metrics​

aip_sdk.RunTarget.metrics: tuple[str, ...] | None = None

No docstring is defined in the source.

aip_sdk.RunTarget.model_config​

aip_sdk.RunTarget.model_config = ConfigDict(extra='forbid', frozen=True)

No docstring is defined in the source.

aip_sdk.RunTarget.partition_id​

aip_sdk.RunTarget.partition_id: str | None = None

No docstring is defined in the source.

aip_sdk.RunTarget.partition_type​

aip_sdk.RunTarget.partition_type: PartitionType | None = None

No docstring is defined in the source.

aip_sdk.RunTarget.span_kind​

aip_sdk.RunTarget.span_kind: SpanKind | None = None

No docstring is defined in the source.

aip_sdk.RunTarget.to_wire_dict​

aip_sdk.RunTarget.to_wire_dict() -> dict[str, Any]

Serialise this target for the POST /runs request body.

The single owner of context={"wire": True} — the one opt-out that makes metric_configs reach the platform unmasked (see _serialize_metric_configs()) — so no other call site can forget it and silently POST a masked "***" judge key.