[ Fix ] fixed the tool_choice in other chat completion methods

This commit is contained in:
Anas Fikhi
2024-02-22 00:13:17 +01:00
parent c91a9c65b8
commit 76fa736389

View File

@ -91,8 +91,7 @@ interface class OpenAIChat implements OpenAIChatBase {
"messages": messages.map((message) => message.toMap()).toList(),
if (tools != null)
"tools": tools.map((tool) => tool.toMap()).toList(growable: false),
if (toolChoice != null)
"tool_choice": toolChoice is String ? toolChoice : toolChoice.value,
if (toolChoice != null) "tool_choice": toolChoice,
if (temperature != null) "temperature": temperature,
if (topP != null) "top_p": topP,
if (n != null) "n": n,
@ -233,7 +232,7 @@ interface class OpenAIChat implements OpenAIChatBase {
"messages": messages.map((message) => message.toMap()).toList(),
if (tools != null)
"tools": tools.map((tool) => tool.toMap()).toList(growable: false),
if (toolChoice != null) "tool_choice": toolChoice.value,
if (toolChoice != null) "tool_choice": toolChoice,
if (temperature != null) "temperature": temperature,
if (topP != null) "top_p": topP,
if (n != null) "n": n,