TrainingAnnotation
public class TrainingAnnotation
io/agentscope/core/training/strategy/TrainingAnnotation.java:38–207Training 注解,对智能体行为进行评测、追踪与可观测性分析。位于 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.
booleanio/agentscope/core/training/strategy/TrainingAnnotation.java:72–74getTaskId
public String getTaskId()
获取任务标识。
Returns the task id.
Stringio/agentscope/core/training/strategy/TrainingAnnotation.java:76–78getLabels
public List<String> getLabels()
获取 getLabels。
Returns the labels.
List<String>io/agentscope/core/training/strategy/TrainingAnnotation.java:80–82getMetadata
public Map<String, Object> getMetadata()
获取元数据。
Returns the metadata.
Map<String, Object>io/agentscope/core/training/strategy/TrainingAnnotation.java:84–86getTimestamp
public long getTimestamp()
获取时间戳。
Returns the timestamp.
longio/agentscope/core/training/strategy/TrainingAnnotation.java:88–90isExpired
public boolean isExpired(long ttlMillis)
判断是否已过期。
Check if this annotation has expired based on the given TTL.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
ttlMillis | long | 存活时间毫秒(类型 `long`)。Time-to-live in milliseconds |
booleanio/agentscope/core/training/strategy/TrainingAnnotation.java:98–100enabled
public static TrainingAnnotation enabled()
返回已启用。
Create a simple enabled annotation without labels or metadata.
TrainingAnnotationio/agentscope/core/training/strategy/TrainingAnnotation.java:105–107withLabels
public static TrainingAnnotation withLabels(String... labels)
执行 withLabels 方法。
Create an enabled annotation with labels.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
labels varargs | String... | labels(类型 `String...`)。The labels. |
TrainingAnnotationio/agentscope/core/training/strategy/TrainingAnnotation.java:112–114withLabelsAndMetadata
public static TrainingAnnotation withLabelsAndMetadata(List<String> labels, Map<String, Object> metadata)
执行 withLabelsAndMetadata 方法。
Create an enabled annotation with labels and metadata.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
labels | List<String> | labels(类型 `List`)。The labels. |
metadata | Map<String, Object> | 元数据(类型 `Map`)。The metadata. |
TrainingAnnotationio/agentscope/core/training/strategy/TrainingAnnotation.java:119–126builder
public static Builder builder()
创建构建器用于 TrainingAnnotation。
Create a builder for TrainingAnnotation.
Builderio/agentscope/core/training/strategy/TrainingAnnotation.java:131–133equals
public boolean equals(Object o)
设置该参数。
Performs the equals operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
o | Object | o(类型 `Object`)。The o. |
booleanio/agentscope/core/training/strategy/TrainingAnnotation.java:135–145hashCode
public int hashCode()
返回 hashCode 结果。
Returns the hash code.
intio/agentscope/core/training/strategy/TrainingAnnotation.java:147–150toString
public String toString()
返回 toString 结果。
Returns the to string.
Stringio/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.