pub struct Step3Parser { /* private fields */ }Expand description
Step3 format parser for tool calls
Handles the Step3 specific format with steptml XML:
<|tool_calls_begin|><|tool_call_begin|>function<|tool_sep|><steptml:invoke name="{name}"><steptml:parameter name="{k}">{v}</steptml:parameter></steptml:invoke><|tool_call_end|><|tool_calls_end|>
Features:
- Unicode token delimiters
- StepTML XML format for invocations
- Support for multiple sequential tool calls
Implementations§
Source§impl Step3Parser
impl Step3Parser
Trait Implementations§
Source§impl Default for Step3Parser
impl Default for Step3Parser
Source§impl ToolParser for Step3Parser
impl ToolParser for Step3Parser
Source§fn parse_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = ParserResult<(String, Vec<ToolCall>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn parse_complete<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = ParserResult<(String, Vec<ToolCall>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Parse complete tool calls from final output
Returns (remaining_normal_text, tool_calls) tuple
Source§fn parse_incremental<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
chunk: &'life1 str,
tools: &'life2 [Tool],
) -> Pin<Box<dyn Future<Output = ParserResult<StreamingParseResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn parse_incremental<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
chunk: &'life1 str,
tools: &'life2 [Tool],
) -> Pin<Box<dyn Future<Output = ParserResult<StreamingParseResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Parse tool calls from model output (streaming)
Parsers now maintain internal state, so self is mutable Read more
Source§fn has_tool_markers(&self, text: &str) -> bool
fn has_tool_markers(&self, text: &str) -> bool
Check if text contains tool calls in this parser’s format
Source§fn get_unstreamed_tool_args(&self) -> Option<Vec<ToolCallItem>>
fn get_unstreamed_tool_args(&self) -> Option<Vec<ToolCallItem>>
Get unstreamed tool call arguments
Returns tool call items for arguments that have been parsed but not yet streamed
Source§fn reset(&mut self)
fn reset(&mut self)
Reset the parser state for reuse across requests.
This should clear all buffers and reset state to initial values.
Source§fn as_token_parser(&self) -> Option<&dyn TokenToolParser>
fn as_token_parser(&self) -> Option<&dyn TokenToolParser>
Optionally expose a token-aware parser implementation.
Default returns
None, meaning the parser only supports text input.Auto Trait Implementations§
impl Freeze for Step3Parser
impl RefUnwindSafe for Step3Parser
impl Send for Step3Parser
impl Sync for Step3Parser
impl Unpin for Step3Parser
impl UnsafeUnpin for Step3Parser
impl UnwindSafe for Step3Parser
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more