CompressionEvent
public class CompressionEvent implements State
io/agentscope/core/memory/autocontext/CompressionEvent.java:27–207压缩事件,描述执行过程中的事件。位于 io.agentscope.core.memory.autocontext 包,实现 State。核心成员包括 getEventType、getTimestamp、getCompressedMessageCount、getPreviousMessageId、getNextMessageId、getCompressedMessageId。
Represents a compression event that occurred in AutoContextMemory.
This class records information about context compression operations, including the type of compression, timing, token reduction, and message positioning information.
字段摘要Field Summary
| 字段Field | 类型Type | 说明Description |
|---|---|---|
TOOL_INVOCATION_COMPRESSstaticfinal | String | 工具 INVOCATION 压缩字段。 Event type: Compress historical tool invocations (Strategy 1). |
LARGE_MESSAGE_OFFLOAD_WITH_PROTECTIONstaticfinal | String | LARGE 消息卸载使用 PROTECTION字段。 Event type: Offload large messages with lastKeep protection (Strategy 2). |
LARGE_MESSAGE_OFFLOADstaticfinal | String | LARGE 消息卸载字段。 Event type: Offload large messages without protection (Strategy 3). |
PREVIOUS_ROUND_CONVERSATION_SUMMARYstaticfinal | String | 上一个 ROUND 会话摘要字段。 Event type: Summarize previous round conversations (Strategy 4). |
CURRENT_ROUND_LARGE_MESSAGE_SUMMARYstaticfinal | String | 当前 ROUND LARGE 消息摘要字段。 Event type: Summarize current round large messages (Strategy 5). |
CURRENT_ROUND_MESSAGE_COMPRESSstaticfinal | String | 当前 ROUND 消息压缩字段。 Event type: Compress current round messages (Strategy 6). |
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public CompressionEvent() | 初始化 `CompressionEvent` 实例。 Creates a new instance. |
public CompressionEvent(String eventType, long timestamp, int compressedMessageCount, String previousMessageId, String nextMessageId, String compressedMessageId, Map<String, Object> metadata) | 创建新的压缩事件。 Creates a new compression event. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public String getEventType() | 获取事件类型。 Gets the event type. |
public long getTimestamp() | 获取时间戳。 Gets the timestamp when the event occurred. |
public int getCompressedMessageCount() | 获取 `getCompressedMessageCount`。 Gets the number of messages that were compressed. |
public String getPreviousMessageId() | 获取上一个消息标识。 Gets the ID of the message before the compressed range. |
public String getNextMessageId() | 获取下一个消息标识。 Gets the ID of the message after the compressed range. |
public String getCompressedMessageId() | 获取 `getCompressedMessageId`。 Gets the ID of the compressed message (for compression types only). |
public Map<String, Object> getMetadata() | 获取元数据用于此事件。 Gets the metadata for this event. |
public int getTokenBefore() | 获取令牌数量之前压缩来自元数据。 Gets the token count before compression from metadata. |
public int getTokenAfter() | 获取令牌数量之后压缩来自元数据。 Gets the token count after compression from metadata. |
public int getTokenReduction() | 获取 `getTokenReduction`。 Gets the token reduction amount. |
public int getCompressInputToken() | 获取压缩输入令牌。 Gets the input tokens consumed by the compression operation from metadata. |
public int getCompressOutputToken() | 获取压缩输出令牌。 Gets the output tokens consumed by the compression operation from metadata. |
字段详情Field Detail
TOOL_INVOCATION_COMPRESS
public static final String TOOL_INVOCATION_COMPRESS
工具 INVOCATION 压缩字段。声明为 public static final String TOOL_INVOCATION_COMPRESS。
Event type: Compress historical tool invocations (Strategy 1).
io/agentscope/core/memory/autocontext/CompressionEvent.java:30LARGE_MESSAGE_OFFLOAD_WITH_PROTECTION
public static final String LARGE_MESSAGE_OFFLOAD_WITH_PROTECTION
LARGE 消息卸载使用 PROTECTION字段。声明为 public static final String LARGE_MESSAGE_OFFLOAD_WITH_PROTECTION。
Event type: Offload large messages with lastKeep protection (Strategy 2).
io/agentscope/core/memory/autocontext/CompressionEvent.java:33–34LARGE_MESSAGE_OFFLOAD
public static final String LARGE_MESSAGE_OFFLOAD
LARGE 消息卸载字段。声明为 public static final String LARGE_MESSAGE_OFFLOAD。
Event type: Offload large messages without protection (Strategy 3).
io/agentscope/core/memory/autocontext/CompressionEvent.java:37PREVIOUS_ROUND_CONVERSATION_SUMMARY
public static final String PREVIOUS_ROUND_CONVERSATION_SUMMARY
上一个 ROUND 会话摘要字段。声明为 public static final String PREVIOUS_ROUND_CONVERSATION_SUMMARY。
Event type: Summarize previous round conversations (Strategy 4).
io/agentscope/core/memory/autocontext/CompressionEvent.java:40–41CURRENT_ROUND_LARGE_MESSAGE_SUMMARY
public static final String CURRENT_ROUND_LARGE_MESSAGE_SUMMARY
当前 ROUND LARGE 消息摘要字段。声明为 public static final String CURRENT_ROUND_LARGE_MESSAGE_SUMMARY。
Event type: Summarize current round large messages (Strategy 5).
io/agentscope/core/memory/autocontext/CompressionEvent.java:44–45CURRENT_ROUND_MESSAGE_COMPRESS
public static final String CURRENT_ROUND_MESSAGE_COMPRESS
当前 ROUND 消息压缩字段。声明为 public static final String CURRENT_ROUND_MESSAGE_COMPRESS。
Event type: Compress current round messages (Strategy 6).
io/agentscope/core/memory/autocontext/CompressionEvent.java:48构造器详情Constructor Detail
CompressionEvent
public CompressionEvent()
初始化 CompressionEvent 实例。
Creates a new instance.
io/agentscope/core/memory/autocontext/CompressionEvent.java:58CompressionEvent
public CompressionEvent(String eventType, long timestamp, int compressedMessageCount, String previousMessageId, String nextMessageId, String compressedMessageId, Map<String, Object> metadata)
创建新的压缩事件。
Creates a new compression event.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
eventType | String | 压缩事件的类型。the type of compression event |
timestamp | long | 时间戳(类型 `long`)。the timestamp when the event occurred (milliseconds since epoch) |
compressedMessageCount | int | compressed 消息数量(类型 `int`)。the number of messages that were compressed |
previousMessageId | String | 上一个消息标识(类型 `String`)。the ID of the message before the compressed range (null if none) |
nextMessageId | String | 下一个消息标识(类型 `String`)。the ID of the message after the compressed range (null if none) |
compressedMessageId | String | compressed 消息标识(类型 `String`)。the ID of the compressed message (null if not a compression type) |
metadata | Map<String, Object> | 元数据(类型 `Map`)。additional metadata for the event (may contain tokenBefore, tokenAfter, inputToken, outputToken, etc.) |
io/agentscope/core/memory/autocontext/CompressionEvent.java:71–86方法详情Method Detail
getEventType
public String getEventType()
获取事件类型。
Gets the event type.
Stringio/agentscope/core/memory/autocontext/CompressionEvent.java:93–95getTimestamp
public long getTimestamp()
获取时间戳。
Gets the timestamp when the event occurred.
longio/agentscope/core/memory/autocontext/CompressionEvent.java:102–104getCompressedMessageCount
public int getCompressedMessageCount()
获取 getCompressedMessageCount。
Gets the number of messages that were compressed.
intio/agentscope/core/memory/autocontext/CompressionEvent.java:111–113getPreviousMessageId
public String getPreviousMessageId()
获取上一个消息标识。
Gets the ID of the message before the compressed range.
Stringio/agentscope/core/memory/autocontext/CompressionEvent.java:120–122getNextMessageId
public String getNextMessageId()
获取下一个消息标识。
Gets the ID of the message after the compressed range.
Stringio/agentscope/core/memory/autocontext/CompressionEvent.java:129–131getCompressedMessageId
public String getCompressedMessageId()
获取 getCompressedMessageId。
Gets the ID of the compressed message (for compression types only).
Stringio/agentscope/core/memory/autocontext/CompressionEvent.java:138–140getMetadata
public Map<String, Object> getMetadata()
获取元数据用于此事件。
Gets the metadata for this event.
Map<String, Object>io/agentscope/core/memory/autocontext/CompressionEvent.java:147–149getTokenBefore
public int getTokenBefore()
获取令牌数量之前压缩来自元数据。
Gets the token count before compression from metadata.
intio/agentscope/core/memory/autocontext/CompressionEvent.java:156–161getTokenAfter
public int getTokenAfter()
获取令牌数量之后压缩来自元数据。
Gets the token count after compression from metadata.
intio/agentscope/core/memory/autocontext/CompressionEvent.java:168–173getTokenReduction
public int getTokenReduction()
获取 getTokenReduction。
Gets the token reduction amount.
intio/agentscope/core/memory/autocontext/CompressionEvent.java:180–182getCompressInputToken
public int getCompressInputToken()
获取压缩输入令牌。
Gets the input tokens consumed by the compression operation from metadata.
intio/agentscope/core/memory/autocontext/CompressionEvent.java:189–194getCompressOutputToken
public int getCompressOutputToken()
获取压缩输出令牌。
Gets the output tokens consumed by the compression operation from metadata.
intio/agentscope/core/memory/autocontext/CompressionEvent.java:201–206