public class ChatCompletion extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ChatCompletion.Model
model
|
| Modifier and Type | Field and Description |
|---|---|
(package private) Double |
frequencyPenalty
-2.0 ~~ 2.0 Defaults to 0
|
(package private) Map |
logitBias
Optional
Defaults to null
|
(package private) Boolean |
logprobs
boolean or null
|
(package private) Integer |
maxTokens
3.5 最大支持4096
4.0 最大32k
|
private @NonNull List<Message> |
messages |
private @NonNull String |
model |
(package private) Integer |
n
结果数。
|
(package private) Boolean |
parallelToolCalls |
(package private) Double |
presencePenalty
Optional
Defaults to 0
Number between -2.0 and 2.0.
|
(package private) ResponseFormat |
responseFormat
返回格式 当前只有gpt-3.5-turbo-1106和gpt-4-1106-preview 支持json_object格式返回
|
(package private) Integer |
seed |
(package private) String |
serviceTier
Specifies the latency tier to use for processing the request.
|
(package private) List<String> |
stop
停用词
|
(package private) Boolean |
stream
是否流式输出.
|
(package private) StreamOption |
streamOptions |
private Double |
temperature
使用什么取样温度,0到2之间。越高越奔放。越低越保守。
|
(package private) String |
toolChoice |
(package private) List<ChatTool> |
tools |
(package private) Integer |
topLogprobs
integer or null
|
private Double |
topP
0-1
建议0.9
不要同时改这个和temperature
|
(package private) String |
user
用户唯一值,确保接口不被重复调用
|
| Constructor and Description |
|---|
ChatCompletion() |
| Modifier and Type | Method and Description |
|---|---|
int |
countTokens()
计算token
|
@NonNull private @NonNull String model
private Double temperature
不要同时改这个和topP
private Double topP
String toolChoice
Integer n
Boolean stream
List<String> stop
stop 参数用于指定 API 生成令牌时应停止的序列。该参数可以是字符串、字符串数组或 null,最多可以包含 4 个序列。这是一个可选参数,默认值为 null。
参数说明 类型:string、array 或 null 可选:是 默认值:null 用途:指定在生成的文本中,API 遇到这些序列时停止生成后续令牌 使用场景 单个停止序列:
如果指定一个字符串,API 在生成文本时遇到该字符串就会停止。例如,如果设置 stop 参数为 "END", 当生成的文本包含 "END" 时,API 将停止生成后续文本。 多个停止序列:
如果指定一个字符串数组,API 在生成文本时遇到任何一个字符串都会停止。例如,如果设置 stop 参数为 ["END", "STOP"], 当生成的文本包含 "END" 或 "STOP" 时,API 将停止生成后续文本。 不使用停止序列:
如果将 stop 参数设置为 null 或不设置,API 将根据其默认行为生成文本,直到达到最大令牌限制或结束标记。
Integer maxTokens
Double presencePenalty
Double frequencyPenalty
Map logitBias
String user
ResponseFormat responseFormat
Boolean logprobs
Optional Defaults to false
Integer topLogprobs
Optional
Integer seed
String serviceTier
If set to 'auto', the system will utilize scale tier credits until they are exhausted. If set to 'default', the request will be processed using the default service tier with a lower uptime SLA and no latency guarentee. When this parameter is set, the response body will include the service_tier utilized.
StreamOption streamOptions
Boolean parallelToolCalls
Copyright © 2024. All rights reserved.