AS AgentScopeAPI 手册 / API Reference

CompressionEvent

public class CompressionEvent implements State
源码Source 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_COMPRESS
staticfinal
String
工具 INVOCATION 压缩字段。
Event type: Compress historical tool invocations (Strategy 1).
LARGE_MESSAGE_OFFLOAD_WITH_PROTECTION
staticfinal
String
LARGE 消息卸载使用 PROTECTION字段。
Event type: Offload large messages with lastKeep protection (Strategy 2).
LARGE_MESSAGE_OFFLOAD
staticfinal
String
LARGE 消息卸载字段。
Event type: Offload large messages without protection (Strategy 3).
PREVIOUS_ROUND_CONVERSATION_SUMMARY
staticfinal
String
上一个 ROUND 会话摘要字段。
Event type: Summarize previous round conversations (Strategy 4).
CURRENT_ROUND_LARGE_MESSAGE_SUMMARY
staticfinal
String
当前 ROUND LARGE 消息摘要字段。
Event type: Summarize current round large messages (Strategy 5).
CURRENT_ROUND_MESSAGE_COMPRESS
staticfinal
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
staticfinal

工具 INVOCATION 压缩字段。声明为 public static final String TOOL_INVOCATION_COMPRESS。

Event type: Compress historical tool invocations (Strategy 1).

源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:30

LARGE_MESSAGE_OFFLOAD_WITH_PROTECTION

public static final String LARGE_MESSAGE_OFFLOAD_WITH_PROTECTION
staticfinal

LARGE 消息卸载使用 PROTECTION字段。声明为 public static final String LARGE_MESSAGE_OFFLOAD_WITH_PROTECTION。

Event type: Offload large messages with lastKeep protection (Strategy 2).

源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:33–34

LARGE_MESSAGE_OFFLOAD

public static final String LARGE_MESSAGE_OFFLOAD
staticfinal

LARGE 消息卸载字段。声明为 public static final String LARGE_MESSAGE_OFFLOAD。

Event type: Offload large messages without protection (Strategy 3).

源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:37

PREVIOUS_ROUND_CONVERSATION_SUMMARY

public static final String PREVIOUS_ROUND_CONVERSATION_SUMMARY
staticfinal

上一个 ROUND 会话摘要字段。声明为 public static final String PREVIOUS_ROUND_CONVERSATION_SUMMARY。

Event type: Summarize previous round conversations (Strategy 4).

源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:40–41

CURRENT_ROUND_LARGE_MESSAGE_SUMMARY

public static final String CURRENT_ROUND_LARGE_MESSAGE_SUMMARY
staticfinal

当前 ROUND LARGE 消息摘要字段。声明为 public static final String CURRENT_ROUND_LARGE_MESSAGE_SUMMARY。

Event type: Summarize current round large messages (Strategy 5).

源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:44–45

CURRENT_ROUND_MESSAGE_COMPRESS

public static final String CURRENT_ROUND_MESSAGE_COMPRESS
staticfinal

当前 ROUND 消息压缩字段。声明为 public static final String CURRENT_ROUND_MESSAGE_COMPRESS。

Event type: Compress current round messages (Strategy 6).

源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:48

构造器详情Constructor Detail

CompressionEvent

public CompressionEvent()

初始化 CompressionEvent 实例。

Creates a new instance.

源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:58

CompressionEvent

public CompressionEvent(String eventType, long timestamp, int compressedMessageCount, String previousMessageId, String nextMessageId, String compressedMessageId, Map<String, Object> metadata)

创建新的压缩事件。

Creates a new compression event.

参数Parameters
名称Name类型Type说明Description
eventTypeString压缩事件的类型。the type of compression event
timestamplong时间戳(类型 `long`)。the timestamp when the event occurred (milliseconds since epoch)
compressedMessageCountintcompressed 消息数量(类型 `int`)。the number of messages that were compressed
previousMessageIdString上一个消息标识(类型 `String`)。the ID of the message before the compressed range (null if none)
nextMessageIdString下一个消息标识(类型 `String`)。the ID of the message after the compressed range (null if none)
compressedMessageIdStringcompressed 消息标识(类型 `String`)。the ID of the compressed message (null if not a compression type)
metadataMap<String, Object>元数据(类型 `Map`)。additional metadata for the event (may contain tokenBefore, tokenAfter, inputToken, outputToken, etc.)
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:71–86

方法详情Method Detail

getEventType

public String getEventType()

获取事件类型。

Gets the event type.

返回Returns String
事件类型。the event type
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:93–95

getTimestamp

public long getTimestamp()

获取时间戳。

Gets the timestamp when the event occurred.

返回Returns long
返回数值结果。the timestamp in milliseconds since epoch
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:102–104

getCompressedMessageCount

public int getCompressedMessageCount()

获取 getCompressedMessageCount。

Gets the number of messages that were compressed.

返回Returns int
返回数值结果。the compressed message count
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:111–113

getPreviousMessageId

public String getPreviousMessageId()

获取上一个消息标识。

Gets the ID of the message before the compressed range.

返回Returns String
返回字符串结果。the previous message ID, or null if there is no previous message
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:120–122

getNextMessageId

public String getNextMessageId()

获取下一个消息标识。

Gets the ID of the message after the compressed range.

返回Returns String
返回字符串结果。the next message ID, or null if there is no next message
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:129–131

getCompressedMessageId

public String getCompressedMessageId()

获取 getCompressedMessageId。

Gets the ID of the compressed message (for compression types only).

返回Returns String
返回字符串结果。the compressed message ID, or null if not a compression type
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:138–140

getMetadata

public Map<String, Object> getMetadata()

获取元数据用于此事件。

Gets the metadata for this event.

返回Returns Map<String, Object>
返回映射。the metadata map, which may contain tokenBefore, tokenAfter, inputToken, outputToken, etc.
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:147–149

getTokenBefore

public int getTokenBefore()

获取令牌数量之前压缩来自元数据。

Gets the token count before compression from metadata.

返回Returns int
令牌数量之前压缩,或 0 if 不可用。the token count before compression, or 0 if not available
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:156–161

getTokenAfter

public int getTokenAfter()

获取令牌数量之后压缩来自元数据。

Gets the token count after compression from metadata.

返回Returns int
令牌数量之后压缩,或 0 if 不可用。the token count after compression, or 0 if not available
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:168–173

getTokenReduction

public int getTokenReduction()

获取 getTokenReduction。

Gets the token reduction amount.

返回Returns int
返回数值结果。the difference between tokenBefore and tokenAfter
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:180–182

getCompressInputToken

public int getCompressInputToken()

获取压缩输入令牌。

Gets the input tokens consumed by the compression operation from metadata.

返回Returns int
返回数值结果。the input tokens consumed during compression, or 0 if not available
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:189–194

getCompressOutputToken

public int getCompressOutputToken()

获取压缩输出令牌。

Gets the output tokens consumed by the compression operation from metadata.

返回Returns int
返回数值结果。the output tokens consumed during compression, or 0 if not available
源码Source io/agentscope/core/memory/autocontext/CompressionEvent.java:201–206
基于官方固定版本源码静态生成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.