From da8e9811570c9a6e07164dd0dc769a88ef9a504c Mon Sep 17 00:00:00 2001 From: Toshiaki Takeuchi Date: Thu, 29 Feb 2024 17:16:12 -0500 Subject: [PATCH] Fix ToolChoice bug --- openAIChat.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openAIChat.m b/openAIChat.m index 54db2a0..55c19a5 100644 --- a/openAIChat.m +++ b/openAIChat.m @@ -311,8 +311,8 @@ function mustBeValidFunctionCall(this, functionCall) if ~isempty(this.Tools) toolChoice = "auto"; end - elseif ToolChoice ~= "auto" - % if toolChoice is not empty, then it must be in the format + elseif ~ismember(ToolChoice,["auto","none"]) + % if toolChoice is not empty, then it must be "auto", "none" or in the format % {"type": "function", "function": {"name": "my_function"}} toolChoice = struct("type","function","function",struct("name",toolChoice)); end