ChatChoice
@JsonInclude(JsonInclude.Include.NON_NULL) public class ChatChoice
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:48–105聊天选项,保存相关配置项。位于 io.agentscope.core.chat.completions.model 包。核心成员包括 getIndex、setIndex、getMessage、setMessage、getDelta、setDelta。
Single choice in a Chat Completions style response.
This class follows OpenAI's Chat Completions API format.
Example:
`{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! How can I help you?"
},
"finish_reason": "stop"
}
`
Possible finish_reason values:
-
"stop" - Natural end of message
-
"length" - Max tokens reached
-
"tool_calls" - Model wants to call tools
-
"content_filter" - Content was filtered
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public int getIndex() | 获取索引。 Returns the index. |
public void setIndex(int index) | 设置索引。 Sets the index. |
public ChatMessage getMessage() | 获取消息。 Returns the message. |
public void setMessage(ChatMessage message) | 设置消息。 Sets the message. |
public ChatMessage getDelta() | 获取增量。 Returns the delta. |
public void setDelta(ChatMessage delta) | 设置增量。 Sets the delta. |
public String getFinishReason() | 获取 `getFinishReason`。 Returns the finish reason. |
public void setFinishReason(String finishReason) | 设置 `setFinishReason`。 Sets the finish reason. |
public Object getLogprobs() | 获取 `getLogprobs`。 Returns the logprobs. |
public void setLogprobs(Object logprobs) | 设置 `setLogprobs`。 Sets the logprobs. |
方法详情Method Detail
getIndex
public int getIndex()
获取索引。
Returns the index.
int返回数值结果。Returns a numeric result.
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:66–68setIndex
public void setIndex(int index)
设置索引。
Sets the index.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
index | int | 索引(类型 `int`)。The index. |
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:70–72getMessage
public ChatMessage getMessage()
获取消息。
Returns the message.
ChatMessage返回ChatMessage。Returns chat message.
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:74–76setMessage
public void setMessage(ChatMessage message)
设置消息。
Sets the message.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
message | ChatMessage | 消息(类型 `ChatMessage`)。The message. |
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:78–80getDelta
public ChatMessage getDelta()
获取增量。
Returns the delta.
ChatMessage返回ChatMessage。Returns chat message.
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:82–84setDelta
public void setDelta(ChatMessage delta)
设置增量。
Sets the delta.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
delta | ChatMessage | 增量(类型 `ChatMessage`)。The delta. |
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:86–88getFinishReason
public String getFinishReason()
获取 getFinishReason。
Returns the finish reason.
String返回字符串结果。Returns a string.
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:90–92setFinishReason
public void setFinishReason(String finishReason)
设置 setFinishReason。
Sets the finish reason.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
finishReason | String | finish 推理(类型 `String`)。The finish reason. |
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:94–96getLogprobs
public Object getLogprobs()
获取 getLogprobs。
Returns the logprobs.
Object返回对象。Returns object.
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:98–100setLogprobs
public void setLogprobs(Object logprobs)
设置 setLogprobs。
Sets the logprobs.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
logprobs | Object | logprobs(类型 `Object`)。The logprobs. |
源码Source
io/agentscope/core/chat/completions/model/ChatChoice.java:102–104