Skip to content

Commit 60ec637

Browse files
updated based on changelog
1 parent 1d535a2 commit 60ec637

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Sources/OpenAI/Public/Parameters/Chat/ChatCompletionParameters.swift

+22
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ public struct ChatCompletionParameters: Encodable {
2929
public var functions: [ChatFunction]?
3030
/// A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.
3131
public var tools: [Tool]?
32+
/// Whether to enable parallel function calling during tool use. Defaults to true.
33+
public var parallelToolCalls: Bool?
3234
/// Modify the likelihood of specified tokens appearing in the completion.
3335
/// Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token. Defaults to null.
3436
public var logitBias: [Int: Double]?
@@ -48,6 +50,11 @@ public struct ChatCompletionParameters: Encodable {
4850
/// Setting to `{ type: "json_object" }` enables `JSON` mode, which guarantees the message the model generates is valid JSON.
4951
///Important: when using `JSON` mode you must still instruct the model to produce `JSON` yourself via some conversation message, for example via your system message. If you don't do this, the model may generate an unending stream of whitespace until the generation reaches the token limit, which may take a lot of time and give the appearance of a "stuck" request. Also note that the message content may be partial (i.e. cut off) if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.
5052
public var responseFormat: ResponseFormat?
53+
/// Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:
54+
/// If set to 'auto', the system will utilize scale tier credits until they are exhausted.
55+
/// If set to 'default', the request will be processed in the shared cluster.
56+
/// When this parameter is set, the response body will include the service_tier utilized.
57+
public var serviceTier: String?
5158
/// This feature is in `Beta`. If specified, our system will make a best effort to sample deterministically, such that repeated requests with the same `seed` and parameters should return the same result.
5259
/// Determinism is not guaranteed, and you should refer to the `system_fingerprint` response parameter to monitor changes in the backend.
5360
public var seed: Int?
@@ -418,6 +425,15 @@ public struct ChatCompletionParameters: Encodable {
418425
}
419426
}
420427

428+
public enum ServiceTier: String, Encodable {
429+
/// Specifies the latency tier to use for processing the request. This parameter is relevant for customers subscribed to the scale tier service:
430+
/// If set to 'auto', the system will utilize scale tier credits until they are exhausted.
431+
/// If set to 'default', the request will be processed in the shared cluster.
432+
/// When this parameter is set, the response body will include the service_tier utilized.
433+
case auto
434+
case `default`
435+
}
436+
421437
public struct StreamOptions: Encodable {
422438
/// If set, an additional chunk will be streamed before the data: [DONE] message.
423439
/// The usage field on this chunk shows the token usage statistics for the entire request,
@@ -437,6 +453,7 @@ public struct ChatCompletionParameters: Encodable {
437453
case toolChoice = "tool_choice"
438454
case functionCall = "function_call"
439455
case tools
456+
case parallelToolCalls = "parallel_tool_calls"
440457
case functions
441458
case logitBias = "logit_bias"
442459
case logprobs
@@ -446,6 +463,7 @@ public struct ChatCompletionParameters: Encodable {
446463
case responseFormat = "response_format"
447464
case presencePenalty = "presence_penalty"
448465
case seed
466+
case serviceTier = "service_tier"
449467
case stop
450468
case stream
451469
case streamOptions = "stream_options"
@@ -462,13 +480,15 @@ public struct ChatCompletionParameters: Encodable {
462480
toolChoice: ToolChoice? = nil,
463481
functions: [ChatFunction]? = nil,
464482
tools: [Tool]? = nil,
483+
parallelToolCalls: Bool? = nil,
465484
logitBias: [Int: Double]? = nil,
466485
logProbs: Bool? = nil,
467486
topLogprobs: Int? = nil,
468487
maxTokens: Int? = nil,
469488
n: Int? = nil,
470489
responseFormat: ResponseFormat? = nil,
471490
presencePenalty: Double? = nil,
491+
serviceTier: ServiceTier? = nil,
472492
seed: Int? = nil,
473493
stop: [String]? = nil,
474494
temperature: Double? = nil,
@@ -482,13 +502,15 @@ public struct ChatCompletionParameters: Encodable {
482502
self.toolChoice = toolChoice
483503
self.functions = functions
484504
self.tools = tools
505+
self.parallelToolCalls = parallelToolCalls
485506
self.logitBias = logitBias
486507
self.logprobs = logProbs
487508
self.topLogprobs = topLogprobs
488509
self.maxTokens = maxTokens
489510
self.n = n
490511
self.responseFormat = responseFormat
491512
self.presencePenalty = presencePenalty
513+
self.serviceTier = serviceTier?.rawValue
492514
self.seed = seed
493515
self.stop = stop
494516
self.temperature = temperature

0 commit comments

Comments
 (0)