AS AgentScopeAPI 手册 / API Reference

Session

public class Session
源码Source io/agentscope/runtime/engine/schemas/Session.java:27–75

会话,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.engine.schemas 包。核心成员包括 getId、setId、getUserId、setUserId、getMessages、setMessages。

Session class, represents a conversation session Contains conversation history, including all messages, uniquely identified by ID

构造器摘要Constructor Summary

构造器Constructor说明Description
public Session()
初始化 `Session` 实例。
Creates a new instance.
public Session(String id, String userId)
初始化 `Session` 实例。
Creates a new instance.
public Session(String id, String userId, List<Message> messages)
初始化 `Session` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String getId()
获取标识。
Returns the id.
public void setId(String id)
设置标识。
Sets the id.
public String getUserId()
获取用户标识。
Returns the user id.
public void setUserId(String userId)
设置用户标识。
Sets the user id.
public List<Message> getMessages()
获取消息。
Returns the messages.
public void setMessages(List<Message> messages)
设置消息。
Sets the messages.

构造器详情Constructor Detail

Session

public Session()

初始化 Session 实例。

Creates a new instance.

源码Source io/agentscope/runtime/engine/schemas/Session.java:38

Session

public Session(String id, String userId)

初始化 Session 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
userIdString用户标识(类型 `String`)。The user id.
源码Source io/agentscope/runtime/engine/schemas/Session.java:40–44

Session

public Session(String id, String userId, List<Message> messages)

初始化 Session 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
userIdString用户标识(类型 `String`)。The user id.
messagesList<Message>消息列表(类型 `List`)。The messages.
源码Source io/agentscope/runtime/engine/schemas/Session.java:46–50

方法详情Method Detail

getId

public String getId()

获取标识。

Returns the id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/Session.java:52–54

setId

public void setId(String id)

设置标识。

Sets the id.

参数Parameters
名称Name类型Type说明Description
idString标识(类型 `String`)。The id.
源码Source io/agentscope/runtime/engine/schemas/Session.java:56–58

getUserId

public String getUserId()

获取用户标识。

Returns the user id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/runtime/engine/schemas/Session.java:60–62

setUserId

public void setUserId(String userId)

设置用户标识。

Sets the user id.

参数Parameters
名称Name类型Type说明Description
userIdString用户标识(类型 `String`)。The user id.
源码Source io/agentscope/runtime/engine/schemas/Session.java:64–66

getMessages

public List<Message> getMessages()

获取消息。

Returns the messages.

返回Returns List<Message>
返回列出。Returns list.
源码Source io/agentscope/runtime/engine/schemas/Session.java:68–70

setMessages

public void setMessages(List<Message> messages)

设置消息。

Sets the messages.

参数Parameters
名称Name类型Type说明Description
messagesList<Message>消息列表(类型 `List`)。The messages.
源码Source io/agentscope/runtime/engine/schemas/Session.java:72–74
基于官方固定版本源码静态生成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.