Skip to content

Commit ad283a2

Browse files
Set ParallelToolCalls flag to false
1 parent 30eaa07 commit ad283a2

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

Kattbot.Common/Models/KattGpt/ChatCompletionCreateRequest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public record ChatCompletionCreateRequest
5050
/// https://platform.openai.com/docs/api-reference/chat/create#chat-create-parallel_tool_calls
5151
/// </summary>
5252
[JsonPropertyName("parallel_tool_calls")]
53-
public bool ParallelToolCalls { get; set; } = false;
53+
public bool ParallelToolCalls { get; set; }
5454

5555
/// <summary>
5656
/// Gets or sets what sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more

Kattbot/NotificationHandlers/KattGptMessageHandler.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ private static ChatCompletionCreateRequest BuildRequest(
170170
Temperature = DefaultTemperature,
171171
MaxTokens = MaxTokensToGenerate,
172172
Tools = chatCompletionTools,
173+
ParallelToolCalls = false,
173174
};
174175

175176
return request;
@@ -258,8 +259,7 @@ private async Task<List<ChatCompletionMessage>> HandleToolCallResponse(
258259

259260
if (chatGptToolCallResponse.ToolCalls.Count > 1)
260261
{
261-
_discordErrorLogger.LogError($"Too many tool calls: {chatGptToolCallResponse.ToolCalls.Count.ToString()}");
262-
chatGptToolCallResponse.ToolCalls.RemoveRange(index: 1, chatGptToolCallResponse.ToolCalls.Count - 1);
262+
throw new Exception($"Too many tool calls: {chatGptToolCallResponse.ToolCalls.Count.ToString()}");
263263
}
264264

265265
// Parse the function call arguments

0 commit comments

Comments
 (0)