pub struct ChatResource { /* private fields */ }Expand description
Streaming chat, stop, and HITL-decision operations scoped to one conversation.
Obtain via [LlmrixClient::chat].
Implementations§
Source§impl ChatResource
impl ChatResource
Sourcepub async fn send<F>(&self, message: &str, handler: F) -> Result<()>
pub async fn send<F>(&self, message: &str, handler: F) -> Result<()>
Send a plain-text message and stream the agent’s response.
handler is called synchronously for each received StreamEvent.
Return Err from the handler to abort streaming early.
client.chat(conv_id).send("Hello!", |event| {
if let StreamEvent::MessageChunk(e) = event {
print!("{}", e.content);
}
Ok(())
}).await?;Sourcepub async fn send_request<F>(&self, req: ChatRequest, handler: F) -> Result<()>
pub async fn send_request<F>(&self, req: ChatRequest, handler: F) -> Result<()>
Send a fully-specified ChatRequest and stream the response.
Use this overload to supply agent_id, metadata, or HITL decisions inline.
Auto Trait Implementations§
impl !RefUnwindSafe for ChatResource
impl !UnwindSafe for ChatResource
impl Freeze for ChatResource
impl Send for ChatResource
impl Sync for ChatResource
impl Unpin for ChatResource
impl UnsafeUnpin for ChatResource
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