Skip to content

Commit

Permalink
[ Fix ] fixed the tool_choice in other chat completion methods
Browse files Browse the repository at this point in the history
  • Loading branch information
anasfik committed Feb 21, 2024
1 parent c91a9c6 commit 76fa736
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/src/instance/chat/chat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 76fa736

Please sign in to comment.