Skip to content

Commit

Permalink
fix: adjust default when json tool choice is
Browse files Browse the repository at this point in the history
  • Loading branch information
drbh committed Oct 20, 2024
1 parent 16e4c38 commit 193ad66
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ pub enum ToolChoice {
///
/// `none` is the default when no tools are present. `auto` is the default if tools are present."
enum ToolTypeDeserializer {
/// `none` means the model will not call any tool and instead generates a message.
/// None means `null` was passed in the JSON, and the default choice is applied based on the presence of tools.
Null,

/// `auto` means the model can pick between generating a message or calling one or more tools.
Expand All @@ -1038,7 +1038,7 @@ enum ToolTypeDeserializer {
impl From<ToolTypeDeserializer> for ToolChoice {
fn from(value: ToolTypeDeserializer) -> Self {
match value {
ToolTypeDeserializer::Null => ToolChoice::NoTool,
ToolTypeDeserializer::Null => ToolChoice::Auto,
ToolTypeDeserializer::String(s) => match s.as_str() {
"none" => ToolChoice::NoTool,
"auto" => ToolChoice::Auto,
Expand Down

0 comments on commit 193ad66

Please sign in to comment.