From 6acbe958b55fe4532b853772989eb286f46cf7b2 Mon Sep 17 00:00:00 2001 From: Sejal Patel Date: Fri, 21 Feb 2025 15:31:42 -0500 Subject: [PATCH] Update to support required toolchoice mode As defined in https://platform.openai.com/docs/guides/function-calling#additional-configurations --- .../commonMain/kotlin/com.aallam.openai.api/chat/ToolChoice.kt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ToolChoice.kt b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ToolChoice.kt index 60eccc04..adf32db3 100644 --- a/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ToolChoice.kt +++ b/openai-core/src/commonMain/kotlin/com.aallam.openai.api/chat/ToolChoice.kt @@ -36,6 +36,9 @@ public sealed interface ToolChoice { /** Represents the `none` mode. */ public val None: ToolChoice = Mode("none") + /** Represents the `required` mode. */ + public val Required: ToolChoice = Mode("required") + /** Specifies a function for the model to call **/ public fun function(name: String): ToolChoice = Named(type = ToolType.Function, function = FunctionToolChoice(name = name))