AS AgentScopeAPI 手册 / API Reference

DashScopeResponse

@JsonIgnoreProperties(ignoreUnknown = true) public class DashScopeResponse
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:48–163

DashScope 响应,与模型服务通信并返回生成或向量化结果。位于 io.agentscope.extensions.model.dashscope.dto 包。核心成员包括 getRequestId、setRequestId、getOutput、setOutput、getUsage、setUsage。

DashScope API response DTO.

This class represents the top-level response structure from DashScope's text-generation and multimodal-generation APIs.

Example JSON:

`{
"request_id": "xxx-xxx-xxx",
"output": {
"choices": [...]
},
"usage": {
"input_tokens": 10,
"output_tokens": 20
}
}
`

构造器摘要Constructor Summary

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

方法摘要Method Summary

方法Method说明Description
public String getRequestId()
获取请求标识。
Returns the request id.
public void setRequestId(String requestId)
设置请求标识。
Sets the request id.
public DashScopeOutput getOutput()
获取输出。
Returns the output.
public void setOutput(DashScopeOutput output)
设置输出。
Sets the output.
public DashScopeUsage getUsage()
获取用量。
Returns the usage.
public void setUsage(DashScopeUsage usage)
设置用量。
Sets the usage.
public String getCode()
获取 `getCode`。
Returns the code.
public void setCode(String code)
设置 `setCode`。
Sets the code.
public String getMessage()
获取消息。
Returns the message.
public void setMessage(String message)
设置消息。
Sets the message.
public boolean isError()
判断是否错误。
Check if this response represents an error.

构造器详情Constructor Detail

DashScopeResponse

public DashScopeResponse()

初始化 DashScopeResponse 实例。

Creates a new instance.

源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:72

方法详情Method Detail

getRequestId

public String getRequestId()

获取请求标识。

Returns the request id.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:74–76

setRequestId

public void setRequestId(String requestId)

设置请求标识。

Sets the request id.

参数Parameters
名称Name类型Type说明Description
requestIdString请求标识(类型 `String`)。The request id.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:78–80

getOutput

public DashScopeOutput getOutput()

获取输出。

Returns the output.

返回Returns DashScopeOutput
返回DashScopeOutput。Returns DashScope output.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:82–84

setOutput

public void setOutput(DashScopeOutput output)

设置输出。

Sets the output.

参数Parameters
名称Name类型Type说明Description
outputDashScopeOutput输出(类型 `DashScopeOutput`)。The output.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:86–88

getUsage

public DashScopeUsage getUsage()

获取用量。

Returns the usage.

返回Returns DashScopeUsage
返回DashScopeUsage。Returns DashScope usage.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:90–92

setUsage

public void setUsage(DashScopeUsage usage)

设置用量。

Sets the usage.

参数Parameters
名称Name类型Type说明Description
usageDashScopeUsage用量(类型 `DashScopeUsage`)。The usage.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:94–96

getCode

public String getCode()

获取 getCode。

Returns the code.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:98–100

setCode

public void setCode(String code)

设置 setCode。

Sets the code.

参数Parameters
名称Name类型Type说明Description
codeStringcode(类型 `String`)。The code.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:102–104

getMessage

public String getMessage()

获取消息。

Returns the message.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:106–108

setMessage

public void setMessage(String message)

设置消息。

Sets the message.

参数Parameters
名称Name类型Type说明Description
messageString消息(类型 `String`)。The message.
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:110–112

isError

public boolean isError()

判断是否错误。

Check if this response represents an error.

返回Returns boolean
返回布尔值,表示判断结果。true if the response contains an error code
源码Source io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:119–121
基于官方固定版本源码静态生成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.