pub struct BooleanParser { /* private fields */ }Expand description
Parses a yes/no answer into a bool.
Matching ignores case, surrounding whitespace, quotes/backticks and a trailing period.
Defaults: YES/TRUE are true, NO/FALSE are false. As a chain output parser it
yields "true" or "false".
Implementations§
Source§impl BooleanParser
impl BooleanParser
pub fn new() -> Self
Sourcepub fn with_values<T, F>(self, true_values: T, false_values: F) -> Self
pub fn with_values<T, F>(self, true_values: T, false_values: F) -> Self
Replaces the words read as true and false (compared case-insensitively).
Trait Implementations§
Source§impl Clone for BooleanParser
impl Clone for BooleanParser
Source§impl Debug for BooleanParser
impl Debug for BooleanParser
Source§impl Default for BooleanParser
impl Default for BooleanParser
Source§impl OutputParser for BooleanParser
impl OutputParser for BooleanParser
Source§impl TypedOutputParser for BooleanParser
impl TypedOutputParser for BooleanParser
type Output = bool
Source§fn format_instructions(&self) -> String
fn format_instructions(&self) -> String
Text to put in the prompt so the model answers in the expected format.
fn parse_output(&self, text: &str) -> Result<bool, OutputParserError>
Auto Trait Implementations§
impl Freeze for BooleanParser
impl RefUnwindSafe for BooleanParser
impl Send for BooleanParser
impl Sync for BooleanParser
impl Unpin for BooleanParser
impl UnsafeUnpin for BooleanParser
impl UnwindSafe for BooleanParser
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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