pub struct PythonicParser { /* private fields */ }Expand description
Parser for Pythonic tool call format
Implementations§
Trait Implementations§
Source§impl Default for PythonicParser
impl Default for PythonicParser
Source§impl ToolParser for PythonicParser
impl ToolParser for PythonicParser
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 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.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
Auto Trait Implementations§
impl Freeze for PythonicParser
impl RefUnwindSafe for PythonicParser
impl Send for PythonicParser
impl Sync for PythonicParser
impl Unpin for PythonicParser
impl UnwindSafe for PythonicParser
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