use super::{GlmXmlToolParser, Separator};
use crate::vllm_tool_parser::{Result, Tool, ToolParser, ToolParserOutput};
pub struct Glm47MoeToolParser(GlmXmlToolParser);
impl Glm47MoeToolParser {
fn new(tools: &[Tool]) -> Self {
Self(GlmXmlToolParser::new(tools, Separator::Flexible))
}
}
impl ToolParser for Glm47MoeToolParser {
fn create(tools: &[Tool]) -> Result<Box<dyn ToolParser>>
where
Self: Sized + 'static,
{
Ok(Box::new(Self::new(tools)))
}
fn parse_into(&mut self, chunk: &str, output: &mut ToolParserOutput) -> Result<()> {
self.0.parse_into(chunk, output)
}
fn finish(&mut self) -> Result<ToolParserOutput> {
self.0.finish()
}
fn reset(&mut self) -> String {
self.0.reset()
}
}