AS AgentScopeAPI 手册 / API Reference

Builder

public static final class Builder
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:321–416

用于ContextSnapshot的可变构建器。位于 io.agentscope.extensions.aistio.model 包。核心成员包括 sessionId、systemPrompt、messages、tools、compacted、compactionSummary。

Mutable builder for ContextSnapshot.

方法摘要Method Summary

方法Method说明Description
public Builder sessionId(String sessionId)
设置会话标识。
Performs the session id operation.
public Builder systemPrompt(String systemPrompt)
设置系统提示词。
Performs the system prompt operation.
public Builder messages(List<ContextMessage> messages)
设置消息。
Performs the messages operation.
public Builder tools(List<ToolInfo> tools)
设置工具。
Performs the tools operation.
public Builder compacted(boolean compacted)
设置该配置项。
Performs the compacted operation.
public Builder compactionSummary(String compactionSummary)
设置压缩摘要。
Performs the compaction summary operation.
public Builder originalMessageCount(int originalMessageCount)
设置该配置项。
Performs the original message count operation.
public Builder compactedAt(long compactedAt)
设置该配置项。
Performs the compacted at operation.
public Builder totalTokens(int totalTokens)
设置总数令牌数。
Performs the total tokens operation.
public Builder maxTokens(int maxTokens)
设置最大令牌数。
Performs the max tokens operation.
public Builder framework(String framework)
设置该配置项。
Performs the framework operation.
public Builder model(String model)
设置模型。
Performs the model operation.
public Builder frameworkState(byte[] frameworkState)
设置该配置项。
Performs the framework state operation.
public Builder capturedAt(long capturedAt)
设置该配置项。
Performs the captured at operation.
public Builder contextHash(String contextHash)
设置该配置项。
Performs the context hash operation.
public ContextSnapshot build()
构建并返回最终实例。
Creates and returns an instance.

方法详情Method Detail

sessionId

public Builder sessionId(String sessionId)

设置会话标识。

Performs the session id operation.

参数Parameters
名称Name类型Type说明Description
sessionIdString会话标识(类型 `String`)。The session id.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:338–341

systemPrompt

public Builder systemPrompt(String systemPrompt)

设置系统提示词。

Performs the system prompt operation.

参数Parameters
名称Name类型Type说明Description
systemPromptString系统提示词(类型 `String`)。The system prompt.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:343–346

messages

public Builder messages(List<ContextMessage> messages)

设置消息。

Performs the messages operation.

参数Parameters
名称Name类型Type说明Description
messagesList<ContextMessage>消息列表(类型 `List`)。The messages.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:348–351

tools

public Builder tools(List<ToolInfo> tools)

设置工具。

Performs the tools operation.

参数Parameters
名称Name类型Type说明Description
toolsList<ToolInfo>工具列表(类型 `List`)。The tools.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:353–356

compacted

public Builder compacted(boolean compacted)

设置该配置项。

Performs the compacted operation.

参数Parameters
名称Name类型Type说明Description
compactedbooleancompacted(类型 `boolean`)。The compacted.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:358–361

compactionSummary

public Builder compactionSummary(String compactionSummary)

设置压缩摘要。

Performs the compaction summary operation.

参数Parameters
名称Name类型Type说明Description
compactionSummaryString压缩摘要(类型 `String`)。The compaction summary.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:363–366

originalMessageCount

public Builder originalMessageCount(int originalMessageCount)

设置该配置项。

Performs the original message count operation.

参数Parameters
名称Name类型Type说明Description
originalMessageCountintoriginal 消息数量(类型 `int`)。The original message count.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:368–371

compactedAt

public Builder compactedAt(long compactedAt)

设置该配置项。

Performs the compacted at operation.

参数Parameters
名称Name类型Type说明Description
compactedAtlongcompacted At(类型 `long`)。The compacted at.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:373–376

totalTokens

public Builder totalTokens(int totalTokens)

设置总数令牌数。

Performs the total tokens operation.

参数Parameters
名称Name类型Type说明Description
totalTokensint总数令牌数(类型 `int`)。The total tokens.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:378–381

maxTokens

public Builder maxTokens(int maxTokens)

设置最大令牌数。

Performs the max tokens operation.

参数Parameters
名称Name类型Type说明Description
maxTokensint最大令牌数(类型 `int`)。The max tokens.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:383–386

framework

public Builder framework(String framework)

设置该配置项。

Performs the framework operation.

参数Parameters
名称Name类型Type说明Description
frameworkStringframework(类型 `String`)。The framework.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:388–391

model

public Builder model(String model)

设置模型。

Performs the model operation.

参数Parameters
名称Name类型Type说明Description
modelString模型实例(类型 `String`)。The model.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:393–396

frameworkState

public Builder frameworkState(byte[] frameworkState)

设置该配置项。

Performs the framework state operation.

参数Parameters
名称Name类型Type说明Description
frameworkStatebyte[]framework 状态(类型 `byte[]`)。The framework state.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:398–401

capturedAt

public Builder capturedAt(long capturedAt)

设置该配置项。

Performs the captured at operation.

参数Parameters
名称Name类型Type说明Description
capturedAtlongcaptured At(类型 `long`)。The captured at.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:403–406

contextHash

public Builder contextHash(String contextHash)

设置该配置项。

Performs the context hash operation.

参数Parameters
名称Name类型Type说明Description
contextHashString上下文 Hash(类型 `String`)。The context hash.
返回Returns Builder
返回当前实例,以支持链式调用。Returns the current instance for chaining.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:408–411

build

public ContextSnapshot build()

构建并返回最终实例。

Creates and returns an instance.

返回Returns ContextSnapshot
返回ContextSnapshot。Returns context snapshot.
源码Source io/agentscope/extensions/aistio/model/ContextSnapshot.java:413–415
基于官方固定版本源码静态生成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.