conversation: require tool calls

This commit is contained in:
2026-08-05 12:57:36 +08:00
parent 1aa6939893
commit 795b6620c6
2 changed files with 20 additions and 0 deletions
@@ -5,6 +5,7 @@ import com.aallam.openai.api.chat.ChatCompletionRequest
import com.aallam.openai.api.chat.ChatMessage
import com.aallam.openai.api.chat.ChatRole
import com.aallam.openai.api.chat.ToolCall
import com.aallam.openai.api.chat.ToolChoice
import com.aallam.openai.api.core.Usage
import com.aallam.openai.api.model.ModelId
import io.ktor.util.collections.ConcurrentSet
@@ -284,6 +285,7 @@ internal object ConversationEngine {
temperature = endpoint.temperature,
messages = history,
tools = availableTools,
toolChoice = ToolChoice.Required,
)
JChatGPT.logger.info("API Requesting... Model=${endpoint.model} [${endpoint.label}]")
return endpoint.service.chatCompletions(request, onCacheUsage)