Unverified Commit f93a7cad authored by Ayush Agarwal's avatar Ayush Agarwal Committed by GitHub
Browse files

fix: fix hermes tool call config (#2915)


Signed-off-by: default avatarayushag <ayushag@nvidia.com>
parent 1477f6ef
......@@ -81,7 +81,7 @@ impl ToolCallConfig {
format: ToolCallParserType::Json,
json: JsonParserConfig {
tool_call_start_tokens: vec!["<tool_call>".to_string()],
tool_call_end_tokens: vec!["\n</tool_call>".to_string()],
tool_call_end_tokens: vec!["</tool_call>".to_string()],
..Default::default()
},
}
......
......@@ -1186,4 +1186,17 @@ Remember, San Francisco weather can be quite unpredictable, particularly with it
assert_eq!(name, "get_current_weather");
assert_eq!(args["location"], "Paris");
}
#[test]
fn test_hermes_parser_without_new_line() {
let input = r#"<tool_call>{"name": "get_weather", "arguments": {"location": "San Francisco, CA", "unit": "celsius"}}</tool_call>"
"#;
let (result, content) = detect_and_parse_tool_call(input, Some("hermes")).unwrap();
assert_eq!(content, Some("".to_string()));
assert_eq!(result.len(), 1);
let (name, args) = extract_name_and_args(result[0].clone());
assert_eq!(name, "get_weather");
assert_eq!(args["location"], "San Francisco, CA");
assert_eq!(args["unit"], "celsius");
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment