DashScopeResponse
@JsonIgnoreProperties(ignoreUnknown = true) public class DashScopeResponse
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:48–163DashScope 响应,与模型服务通信并返回生成或向量化结果。位于 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.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:74–76setRequestId
public void setRequestId(String requestId)
设置请求标识。
Sets the request id.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
requestId | String | 请求标识(类型 `String`)。The request id. |
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:78–80getOutput
public DashScopeOutput getOutput()
获取输出。
Returns the output.
DashScopeOutput返回DashScopeOutput。Returns DashScope output.
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:82–84setOutput
public void setOutput(DashScopeOutput output)
设置输出。
Sets the output.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
output | DashScopeOutput | 输出(类型 `DashScopeOutput`)。The output. |
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:86–88getUsage
public DashScopeUsage getUsage()
获取用量。
Returns the usage.
DashScopeUsage返回DashScopeUsage。Returns DashScope usage.
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:90–92setUsage
public void setUsage(DashScopeUsage usage)
设置用量。
Sets the usage.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
usage | DashScopeUsage | 用量(类型 `DashScopeUsage`)。The usage. |
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:94–96getCode
public String getCode()
获取 getCode。
Returns the code.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:98–100setCode
public void setCode(String code)
设置 setCode。
Sets the code.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
code | String | code(类型 `String`)。The code. |
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:102–104getMessage
public String getMessage()
获取消息。
Returns the message.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:106–108setMessage
public void setMessage(String message)
设置消息。
Sets the message.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | String | 消息(类型 `String`)。The message. |
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:110–112isError
public boolean isError()
判断是否错误。
Check if this response represents an error.
boolean返回布尔值,表示判断结果。true if the response contains an error code
源码Source
io/agentscope/extensions/model/dashscope/dto/DashScopeResponse.java:119–121