pub struct StreamingStdOutCallbackHandler;Expand description
Callback handler for streaming. Only works with LLMs that support streaming.
This handler prints tokens to stdout as they are generated.
Implementations§
Trait Implementations§
Source§impl BaseCallbackHandler for StreamingStdOutCallbackHandler
impl BaseCallbackHandler for StreamingStdOutCallbackHandler
Source§fn name(&self) -> &str
fn name(&self) -> &str
Get a unique name for this handler.
Note: This is a Rust-specific addition for debugging purposes.
Source§fn raise_error(&self) -> bool
fn raise_error(&self) -> bool
Whether to raise an error if an exception occurs.
Source§fn run_inline(&self) -> bool
fn run_inline(&self) -> bool
Whether to run the callback inline.
Source§fn ignore_llm(&self) -> bool
fn ignore_llm(&self) -> bool
Whether to ignore LLM callbacks.
Source§fn ignore_retry(&self) -> bool
fn ignore_retry(&self) -> bool
Whether to ignore retry callbacks.
Source§fn ignore_chain(&self) -> bool
fn ignore_chain(&self) -> bool
Whether to ignore chain callbacks.
Source§fn ignore_agent(&self) -> bool
fn ignore_agent(&self) -> bool
Whether to ignore agent callbacks.
Source§fn ignore_retriever(&self) -> bool
fn ignore_retriever(&self) -> bool
Whether to ignore retriever callbacks.
Source§fn ignore_chat_model(&self) -> bool
fn ignore_chat_model(&self) -> bool
Whether to ignore chat model callbacks.
Source§fn ignore_custom_event(&self) -> bool
fn ignore_custom_event(&self) -> bool
Whether to ignore custom events.
Source§impl CallbackManagerMixin for StreamingStdOutCallbackHandler
impl CallbackManagerMixin for StreamingStdOutCallbackHandler
Source§fn on_llm_start(
&mut self,
serialized: &HashMap<String, Value>,
prompts: &[String],
run_id: Uuid,
parent_run_id: Option<Uuid>,
tags: Option<&[String]>,
metadata: Option<&HashMap<String, Value>>,
)
fn on_llm_start( &mut self, serialized: &HashMap<String, Value>, prompts: &[String], run_id: Uuid, parent_run_id: Option<Uuid>, tags: Option<&[String]>, metadata: Option<&HashMap<String, Value>>, )
Run when LLM starts running.
Source§fn on_chat_model_start(
&mut self,
serialized: &HashMap<String, Value>,
messages: &[Vec<BaseMessage>],
run_id: Uuid,
parent_run_id: Option<Uuid>,
tags: Option<&[String]>,
metadata: Option<&HashMap<String, Value>>,
)
fn on_chat_model_start( &mut self, serialized: &HashMap<String, Value>, messages: &[Vec<BaseMessage>], run_id: Uuid, parent_run_id: Option<Uuid>, tags: Option<&[String]>, metadata: Option<&HashMap<String, Value>>, )
Run when a chat model starts running.
Source§fn on_retriever_start(
&mut self,
serialized: &HashMap<String, Value>,
query: &str,
run_id: Uuid,
parent_run_id: Option<Uuid>,
tags: Option<&[String]>,
metadata: Option<&HashMap<String, Value>>,
)
fn on_retriever_start( &mut self, serialized: &HashMap<String, Value>, query: &str, run_id: Uuid, parent_run_id: Option<Uuid>, tags: Option<&[String]>, metadata: Option<&HashMap<String, Value>>, )
Run when the Retriever starts running.
Source§impl ChainManagerMixin for StreamingStdOutCallbackHandler
impl ChainManagerMixin for StreamingStdOutCallbackHandler
Source§fn on_chain_end(
&mut self,
outputs: &HashMap<String, Value>,
run_id: Uuid,
parent_run_id: Option<Uuid>,
)
fn on_chain_end( &mut self, outputs: &HashMap<String, Value>, run_id: Uuid, parent_run_id: Option<Uuid>, )
Run when chain ends running.
Source§fn on_chain_error(
&mut self,
error: &dyn Error,
run_id: Uuid,
parent_run_id: Option<Uuid>,
)
fn on_chain_error( &mut self, error: &dyn Error, run_id: Uuid, parent_run_id: Option<Uuid>, )
Run when chain errors.
Source§impl Clone for StreamingStdOutCallbackHandler
impl Clone for StreamingStdOutCallbackHandler
Source§fn clone(&self) -> StreamingStdOutCallbackHandler
fn clone(&self) -> StreamingStdOutCallbackHandler
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for StreamingStdOutCallbackHandler
impl Default for StreamingStdOutCallbackHandler
Source§fn default() -> StreamingStdOutCallbackHandler
fn default() -> StreamingStdOutCallbackHandler
Returns the “default value” for a type. Read more
Source§impl LLMManagerMixin for StreamingStdOutCallbackHandler
impl LLMManagerMixin for StreamingStdOutCallbackHandler
Source§fn on_llm_new_token(
&mut self,
token: &str,
_run_id: Uuid,
_parent_run_id: Option<Uuid>,
_chunk: Option<&Value>,
)
fn on_llm_new_token( &mut self, token: &str, _run_id: Uuid, _parent_run_id: Option<Uuid>, _chunk: Option<&Value>, )
Run on new output token. Only available when streaming is enabled.
Source§fn on_llm_end(
&mut self,
response: &ChatResult,
run_id: Uuid,
parent_run_id: Option<Uuid>,
)
fn on_llm_end( &mut self, response: &ChatResult, run_id: Uuid, parent_run_id: Option<Uuid>, )
Run when LLM ends running.
Source§impl RunManagerMixin for StreamingStdOutCallbackHandler
impl RunManagerMixin for StreamingStdOutCallbackHandler
Auto Trait Implementations§
impl Freeze for StreamingStdOutCallbackHandler
impl RefUnwindSafe for StreamingStdOutCallbackHandler
impl Send for StreamingStdOutCallbackHandler
impl Sync for StreamingStdOutCallbackHandler
impl Unpin for StreamingStdOutCallbackHandler
impl UnwindSafe for StreamingStdOutCallbackHandler
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