fix: update test for tool_call_id in Message

This commit is contained in:
drbh 2025-03-14 15:23:07 +00:00
parent 042a6bc365
commit e721574729
3 changed files with 12 additions and 1 deletions

View File

@ -1181,6 +1181,7 @@ TOOL CALL ID: 0
"I'd like to show off how chat templating works!".to_string(), "I'd like to show off how chat templating works!".to_string(),
), ),
}, },
tool_call_id: None,
}, },
Message { Message {
name: None, name: None,
@ -1190,6 +1191,7 @@ TOOL CALL ID: 0
"Great! How can I help you today?".to_string(), "Great! How can I help you today?".to_string(),
), ),
}, },
tool_call_id: None,
}, },
Message { Message {
name: None, name: None,
@ -1197,6 +1199,7 @@ TOOL CALL ID: 0
body: MessageBody::Content { body: MessageBody::Content {
content: MessageContent::SingleText("Just testing".to_string()), content: MessageContent::SingleText("Just testing".to_string()),
}, },
tool_call_id: None,
}, },
]; ];
let tools_string = r#"[{"type": "function","function": {"name": "get_current_weather","description": "Get the current weather","parameters": {"type": "object","properties": {"location": {"type": "string","description": "The city and state, e.g. San Francisco, CA"},"format": {"type": "string","enum": ["celsius", "fahrenheit"],"description": "The temperature unit to use. Infer this from the users location."}},"required": ["location", "format"]}}}]"#.to_string(); let tools_string = r#"[{"type": "function","function": {"name": "get_current_weather","description": "Get the current weather","parameters": {"type": "object","properties": {"location": {"type": "string","description": "The city and state, e.g. San Francisco, CA"},"format": {"type": "string","enum": ["celsius", "fahrenheit"],"description": "The temperature unit to use. Infer this from the users location."}},"required": ["location", "format"]}}}]"#.to_string();
@ -1226,6 +1229,7 @@ TOOL CALL ID: 0
.to_string(), .to_string(),
), ),
}, },
tool_call_id: None,
}, },
Message { Message {
name: None, name: None,
@ -1235,6 +1239,7 @@ TOOL CALL ID: 0
"What is the weather like in Brooklyn, New York?".to_string(), "What is the weather like in Brooklyn, New York?".to_string(),
), ),
}, },
tool_call_id: None,
}, },
]; ];
let tools_string = r#"[{"type": "function","function": {"name": "get_current_weather","description": "Get the current weather","parameters": {"type": "object","properties": {"location": {"type": "string","description": "The city and state, e.g. San Francisco, CA"},"format": {"type": "string","enum": ["celsius", "fahrenheit"],"description": "The temperature unit to use. Infer this from the users location."}},"required": ["location", "format"]}}}]"#.to_string(); let tools_string = r#"[{"type": "function","function": {"name": "get_current_weather","description": "Get the current weather","parameters": {"type": "object","properties": {"location": {"type": "string","description": "The city and state, e.g. San Francisco, CA"},"format": {"type": "string","enum": ["celsius", "fahrenheit"],"description": "The temperature unit to use. Infer this from the users location."}},"required": ["location", "format"]}}}]"#.to_string();
@ -1305,6 +1310,7 @@ TOOL CALL ID: 0
text: "You are a helpful assistant.".to_string(), text: "You are a helpful assistant.".to_string(),
}]), }]),
}, },
tool_call_id: None,
}, },
Message { Message {
name: None, name: None,
@ -1332,6 +1338,7 @@ TOOL CALL ID: 0
}, },
]), ]),
}, },
tool_call_id: None,
}, },
]; ];

View File

@ -1644,6 +1644,7 @@ mod tests {
body: MessageBody::Content { body: MessageBody::Content {
content: MessageContent::SingleText("What is Deep Learning?".to_string()) content: MessageContent::SingleText("What is Deep Learning?".to_string())
}, },
tool_call_id: None,
} }
); );
} }
@ -1703,6 +1704,7 @@ mod tests {
MessageChunk::ImageUrl { image_url: Url { url: "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png".to_string() }}, MessageChunk::ImageUrl { image_url: Url { url: "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png".to_string() }},
]), ]),
}, },
tool_call_id: None,
} }
); );
} }
@ -1717,7 +1719,8 @@ mod tests {
MessageChunk::Text { text: "Whats in this image?".to_string() }, MessageChunk::Text { text: "Whats in this image?".to_string() },
MessageChunk::ImageUrl { image_url: Url { url: "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png".to_string() } } MessageChunk::ImageUrl { image_url: Url { url: "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png".to_string() } }
]), ]),
} },
tool_call_id: None
}; };
let textmsg: TextMessage = message.into(); let textmsg: TextMessage = message.into();
assert_eq!(textmsg.content, "Whats in this image?![](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png)"); assert_eq!(textmsg.content, "Whats in this image?![](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/rabbit.png)");

View File

@ -175,6 +175,7 @@ mod tests {
"What's Deep Learning?".to_string() "What's Deep Learning?".to_string()
) )
}, },
tool_call_id: None,
},], },],
max_tokens: Some(128), max_tokens: Some(128),
top_p: Some(0.95), top_p: Some(0.95),