Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions lib/parsers/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,6 @@ openai-harmony = "0.0.3"
lazy_static = "1.5.0"
rustpython-parser = "0.4.0"
num-traits = "0.2"

[dev-dependencies]
rstest = "0.25"
9 changes: 9 additions & 0 deletions lib/parsers/src/tool_calling/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ impl Default for JsonParserConfig {
}

/// Configuration for parsing tool calls with different formats
// TODO(2ez4bz): refactor to allow other parser configs than `JsonParserConfig`.
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
pub struct ToolCallConfig {
/// The format type for tool calls
Expand Down Expand Up @@ -176,4 +177,12 @@ impl ToolCallConfig {
},
}
}

pub fn qwen3_coder() -> Self {
// <tool_call><function=name><parameter=key>value</parameter></function></tool_call>
Self {
format: ToolCallParserType::Xml,
json: JsonParserConfig::default(), // Not used for qwen3_coder but kept for consistency.
}
}
}
2 changes: 2 additions & 0 deletions lib/parsers/src/tool_calling/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub mod json;
pub mod parsers;
pub mod pythonic;
pub mod response;
pub mod xml;
#[cfg(test)]
pub mod tests;
pub mod tools;
Expand All @@ -22,3 +23,4 @@ pub use parsers::{
pub use pythonic::try_tool_call_parse_pythonic;
pub use response::{CalledFunction, ToolCallResponse, ToolCallType};
pub use tools::{try_tool_call_parse_aggregate, try_tool_call_parse_stream};
pub use xml::try_tool_call_parse_xml;
Loading