pub struct ChatBot { /* private fields */ }Expand description
A terminal chat loop over an Agent that streams each answer as it is
produced; see ChatBot::run.
Implementations§
Source§impl ChatBot
impl ChatBot
Sourcepub fn new(agent: Agent) -> Self
pub fn new(agent: Agent) -> Self
A chatbot over agent with a budget of one model call per prompt.
Sourcepub fn max_turns(self, max_turns: usize) -> Self
pub fn max_turns(self, max_turns: usize) -> Self
Set the total model-call budget for each prompt, including the initial call and every retry or continuation. Zero emits no model calls.
Sourcepub fn show_usage(self) -> Self
pub fn show_usage(self) -> Self
Print the token usage after every answer.
Sourcepub async fn run(self) -> Result<(), StreamToStdoutError>
pub async fn run(self) -> Result<(), StreamToStdoutError>
Read prompts from stdin and print answers until exit or end of input.
Returns prompt failures, stdout flush errors, and
StreamToStdoutError::Incomplete when a stream ends without a final
response; input read errors are printed.
Auto Trait Implementations§
impl !RefUnwindSafe for ChatBot
impl !UnwindSafe for ChatBot
impl Forget for ChatBot
impl Freeze for ChatBot
impl Move for ChatBot
impl Send for ChatBot
impl Sync for ChatBot
impl Unpin for ChatBot
impl UnsafeUnpin for ChatBot
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