AS AgentScopeAPI 手册 / API Reference

BaseResponse

public class BaseResponse extends Event
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:28–149

基类响应,承载智能体的部署、调度与服务化运行。位于 io.agentscope.runtime.engine.schemas 包,继承自 Event。核心成员包括 getId、setId、getObject、setObject、getCreatedAt、setCreatedAt。

Base response class for agent responses. Extends Event to include response-specific fields.

构造器摘要Constructor Summary

构造器Constructor说明Description
public BaseResponse()
初始化 `BaseResponse` 实例。
Creates a new instance.
public BaseResponse(String id)
初始化 `BaseResponse` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String getId()
获取标识。
Returns the id.
public void setId(String id)
设置标识。
Sets the id.
public String getObject()
获取对象。
Returns the object.
public void setObject(String object)
设置对象。
Sets the object.
public Long getCreatedAt()
获取已创建 At。
Returns the created at.
public void setCreatedAt(Long createdAt)
设置已创建 At。
Sets the created at.
public Long getCompletedAt()
获取已完成 At。
Returns the completed at.
public void setCompletedAt(Long completedAt)
设置已完成 At。
Sets the completed at.
public List<Message> getOutput()
获取输出。
Returns the output.
public void setOutput(List<Message> output)
设置输出。
Sets the output.
public Map<String, Object> getUsage()
获取用量。
Returns the usage.
public void setUsage(Map<String, Object> usage)
设置用量。
Sets the usage.
public void addNewMessage(Message message)
添加新建消息。
Add a new message to the output list.
public BaseResponse created()
返回已创建。
Set status to created and return self.
public BaseResponse inProgress()
将响应状态设置为进行中。
Set status to in_progress and return self.
public BaseResponse completed()
返回已完成。
Set status to completed and return self.
public BaseResponse failed(Error error)
设置失败。
Set status to failed with error and return self.

构造器详情Constructor Detail

BaseResponse

public BaseResponse()

初始化 BaseResponse 实例。

Creates a new instance.

源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:47–51

BaseResponse

public BaseResponse(String id)

初始化 BaseResponse 实例。

Creates a new instance.

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

方法详情Method Detail

getId

public String getId()

获取标识。

Returns the id.

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

setId

public void setId(String id)

设置标识。

Sets the id.

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

getObject

public String getObject()

获取对象。

Returns the object.

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

setObject

public void setObject(String object)

设置对象。

Sets the object.

参数Parameters
名称Name类型Type说明Description
objectString对象(类型 `String`)。The object.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:71–73

getCreatedAt

public Long getCreatedAt()

获取已创建 At。

Returns the created at.

返回Returns Long
返回数值结果。Returns a numeric result.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:75–77

setCreatedAt

public void setCreatedAt(Long createdAt)

设置已创建 At。

Sets the created at.

参数Parameters
名称Name类型Type说明Description
createdAtLong已创建 At(类型 `Long`)。The created at.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:79–81

getCompletedAt

public Long getCompletedAt()

获取已完成 At。

Returns the completed at.

返回Returns Long
返回数值结果。Returns a numeric result.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:83–85

setCompletedAt

public void setCompletedAt(Long completedAt)

设置已完成 At。

Sets the completed at.

参数Parameters
名称Name类型Type说明Description
completedAtLong已完成 At(类型 `Long`)。The completed at.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:87–89

getOutput

public List<Message> getOutput()

获取输出。

Returns the output.

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

setOutput

public void setOutput(List<Message> output)

设置输出。

Sets the output.

参数Parameters
名称Name类型Type说明Description
outputList<Message>输出(类型 `List`)。The output.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:95–97

getUsage

public Map<String, Object> getUsage()

获取用量。

Returns the usage.

返回Returns Map<String, Object>
返回映射。Returns map.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:99–101

setUsage

public void setUsage(Map<String, Object> usage)

设置用量。

Sets the usage.

参数Parameters
名称Name类型Type说明Description
usageMap<String, Object>用量(类型 `Map`)。The usage.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:103–105

addNewMessage

public void addNewMessage(Message message)

添加新建消息。

Add a new message to the output list.

参数Parameters
名称Name类型Type说明Description
messageMessage消息(类型 `Message`)。The message.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:110–115

created

public BaseResponse created()

返回已创建。

Set status to created and return self.

返回Returns BaseResponse
返回BaseResponse。Returns base response.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:120–123

inProgress

public BaseResponse inProgress()

将响应状态设置为进行中。

Set status to in_progress and return self.

返回Returns BaseResponse
返回BaseResponse。Returns base response.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:128–131

completed

public BaseResponse completed()

返回已完成。

Set status to completed and return self.

返回Returns BaseResponse
返回BaseResponse。Returns base response.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:136–140

failed

public BaseResponse failed(Error error)

设置失败。

Set status to failed with error and return self.

参数Parameters
名称Name类型Type说明Description
errorError错误(类型 `Error`)。The error.
返回Returns BaseResponse
返回BaseResponse。Returns base response.
源码Source io/agentscope/runtime/engine/schemas/BaseResponse.java:145–148

继承成员Inherited Members

基于官方固定版本源码静态生成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.