AS AgentScopeAPI 手册 / API Reference

AutoContextConfig

public class AutoContextConfig
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:34–291

用于AutoContextMemory的配置类。位于 io.agentscope.core.memory.autocontext 包。核心成员包括 getLargePayloadThreshold、getMaxToken、getTokenRatio、getOffloadSinglePreview、getMsgThreshold、getLastKeep。

Configuration class for AutoContextMemory.

This class contains all configurable parameters for the AutoContextMemory system, including storage backends, compression thresholds, and offloading settings.

Key Configuration Areas:

  • Storage: Working storage and original history storage backends

  • Compression Triggers: Message count and token count thresholds

  • Offloading: Large payload thresholds and preview lengths

  • Protection: Number of recent messages to keep uncompressed

All fields have default values and can be customized via builder pattern.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Builder类class
构建器,用于构建并配置目标实例。
Builder class for constructing AutoContextConfig instances.

方法摘要Method Summary

方法Method说明Description
public long getLargePayloadThreshold()
获取 `getLargePayloadThreshold`。
Returns the large payload threshold.
public long getMaxToken()
获取最大令牌。
Returns the max token.
public double getTokenRatio()
获取 `getTokenRatio`。
Returns the token ratio.
public int getOffloadSinglePreview()
获取 `getOffloadSinglePreview`。
Returns the offload single preview.
public int getMsgThreshold()
获取消息阈值。
Returns the msg threshold.
public int getLastKeep()
获取 `getLastKeep`。
Returns the last keep.
public int getMinConsecutiveToolMessages()
获取 `getMinConsecutiveToolMessages`。
Returns the min consecutive tool messages.
public double getCurrentRoundCompressionRatio()
获取 `getCurrentRoundCompressionRatio`。
Returns the current round compression ratio.
public int getMinCompressionTokenThreshold()
获取最小压缩令牌阈值。
Returns the min compression token threshold.
public PromptConfig getCustomPrompt()
获取自定义提示词配置。
Gets the custom prompt configuration.
public static Builder builder()
static
返回构建器实例。
Creates a new Builder instance for constructing AutoContextConfig.

方法详情Method Detail

getLargePayloadThreshold

public long getLargePayloadThreshold()

获取 getLargePayloadThreshold。

Returns the large payload threshold.

返回Returns long
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:73–75

getMaxToken

public long getMaxToken()

获取最大令牌。

Returns the max token.

返回Returns long
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:77–79

getTokenRatio

public double getTokenRatio()

获取 getTokenRatio。

Returns the token ratio.

返回Returns double
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:81–83

getOffloadSinglePreview

public int getOffloadSinglePreview()

获取 getOffloadSinglePreview。

Returns the offload single preview.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:85–87

getMsgThreshold

public int getMsgThreshold()

获取消息阈值。

Returns the msg threshold.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:89–91

getLastKeep

public int getLastKeep()

获取 getLastKeep。

Returns the last keep.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:93–95

getMinConsecutiveToolMessages

public int getMinConsecutiveToolMessages()

获取 getMinConsecutiveToolMessages。

Returns the min consecutive tool messages.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:97–99

getCurrentRoundCompressionRatio

public double getCurrentRoundCompressionRatio()

获取 getCurrentRoundCompressionRatio。

Returns the current round compression ratio.

返回Returns double
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:101–103

getMinCompressionTokenThreshold

public int getMinCompressionTokenThreshold()

获取最小压缩令牌阈值。

Returns the min compression token threshold.

返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:105–107

getCustomPrompt

public PromptConfig getCustomPrompt()

获取自定义提示词配置。

Gets the custom prompt configuration.

返回Returns PromptConfig
返回PromptConfig。the custom prompt configuration, or null if using defaults
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:114–116

builder

public static Builder builder()
static

返回构建器实例。

Creates a new Builder instance for constructing AutoContextConfig.

返回Returns Builder
一种新的构建器实例。a new Builder instance
源码Source io/agentscope/core/memory/autocontext/AutoContextConfig.java:123–125

嵌套类详情Nested Class Detail

Builder

public static class Builder

构建器,用于构建并配置目标实例。位于 io.agentscope.core.memory.autocontext 包。核心成员包括 largePayloadThreshold、maxToken、tokenRatio、offloadSinglePreview、msgThreshold、lastKeep。

Builder class for constructing AutoContextConfig instances.

This builder provides a fluent API for configuring AutoContextMemory parameters. All fields have default values matching those in AutoContextConfig.

Example usage:

`AutoContextConfig config = AutoContextConfig.builder()
.msgThreshold(50)
.maxToken(64 * 1024)
.lastKeep(20)
.build();
`
基于官方固定版本源码静态生成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.