AS AgentScopeAPI 手册 / API Reference

TrainingAnnotation

public class TrainingAnnotation
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:38–207

Training 注解,对智能体行为进行评测、追踪与可观测性分析。位于 io.agentscope.core.training.strategy 包。核心成员包括 isEnabled、getTaskId、getLabels、getMetadata、getTimestamp、isExpired。

TrainingAnnotation represents a training annotation for an agent call.

It contains:

  • enabled: whether this call should be used for training

  • taskId: (optional) user-specified task ID for this request

  • labels: user-defined labels for categorizing training data

  • metadata: additional context information

  • timestamp: when this annotation was created

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
用于TrainingAnnotation的构建器类。
Builder class for TrainingAnnotation.

方法摘要Method Summary

方法Method说明Description
public boolean isEnabled()
判断是否已启用。
Returns whether the enabled.
public String getTaskId()
获取任务标识。
Returns the task id.
public List<String> getLabels()
获取 `getLabels`。
Returns the labels.
public Map<String, Object> getMetadata()
获取元数据。
Returns the metadata.
public long getTimestamp()
获取时间戳。
Returns the timestamp.
public boolean isExpired(long ttlMillis)
判断是否已过期。
Check if this annotation has expired based on the given TTL.
public static TrainingAnnotation enabled()
static
返回已启用。
Create a simple enabled annotation without labels or metadata.
public static TrainingAnnotation withLabels(String... labels)
static
执行 `withLabels` 方法。
Create an enabled annotation with labels.
public static TrainingAnnotation withLabelsAndMetadata(List<String> labels, Map<String, Object> metadata)
static
执行 `withLabelsAndMetadata` 方法。
Create an enabled annotation with labels and metadata.
public static Builder builder()
static
创建构建器用于 TrainingAnnotation。
Create a builder for TrainingAnnotation.
public boolean equals(Object o)
设置该参数。
Performs the equals operation.
public int hashCode()
返回 `hashCode` 结果。
Returns the hash code.
public String toString()
返回 `toString` 结果。
Returns the to string.

方法详情Method Detail

isEnabled

public boolean isEnabled()

判断是否已启用。

Returns whether the enabled.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:72–74

getTaskId

public String getTaskId()

获取任务标识。

Returns the task id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:76–78

getLabels

public List<String> getLabels()

获取 getLabels。

Returns the labels.

返回Returns List<String>
返回列出。Returns list.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:80–82

getMetadata

public Map<String, Object> getMetadata()

获取元数据。

Returns the metadata.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:84–86

getTimestamp

public long getTimestamp()

获取时间戳。

Returns the timestamp.

返回Returns long
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:88–90

isExpired

public boolean isExpired(long ttlMillis)

判断是否已过期。

Check if this annotation has expired based on the given TTL.

参数Parameters
名称Name类型Type说明Description
ttlMillislong存活时间毫秒(类型 `long`)。Time-to-live in milliseconds
返回Returns boolean
返回布尔值,表示判断结果。true if expired, false otherwise
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:98–100

enabled

public static TrainingAnnotation enabled()
static

返回已启用。

Create a simple enabled annotation without labels or metadata.

返回Returns TrainingAnnotation
返回TrainingAnnotation。Returns training annotation.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:105–107

withLabels

public static TrainingAnnotation withLabels(String... labels)
static

执行 withLabels 方法。

Create an enabled annotation with labels.

参数Parameters
名称Name类型Type说明Description
labels varargsString...labels(类型 `String...`)。The labels.
返回Returns TrainingAnnotation
返回TrainingAnnotation。Returns training annotation.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:112–114

withLabelsAndMetadata

public static TrainingAnnotation withLabelsAndMetadata(List<String> labels, Map<String, Object> metadata)
static

执行 withLabelsAndMetadata 方法。

Create an enabled annotation with labels and metadata.

参数Parameters
名称Name类型Type说明Description
labelsList<String>labels(类型 `List`)。The labels.
metadataMap<String, Object>元数据(类型 `Map`)。The metadata.
返回Returns TrainingAnnotation
返回TrainingAnnotation。Returns training annotation.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:119–126

builder

public static Builder builder()
static

创建构建器用于 TrainingAnnotation。

Create a builder for TrainingAnnotation.

返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:131–133

equals

public boolean equals(Object o)

设置该参数。

Performs the equals operation.

参数Parameters
名称Name类型Type说明Description
oObjecto(类型 `Object`)。The o.
返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:135–145

hashCode

public int hashCode()

返回 hashCode 结果。

Returns the hash code.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:147–150

toString

public String toString()

返回 toString 结果。

Returns the to string.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/core/training/strategy/TrainingAnnotation.java:152–166

嵌套类详情Nested Class Detail

Builder

public static class Builder

用于TrainingAnnotation的构建器类。位于 io.agentscope.core.training.strategy 包。核心成员包括 enabled、taskId、labels、metadata、timestamp、build。

Builder class for TrainingAnnotation.

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.