pub struct AgentHandle { /* private fields */ }Expand description
A handle to the agent that can be used by the interpreter.
This is cloneable so it can be passed to different interpreter threads. Uses tokio’s UnboundedSender which allows non-blocking sends from sync code.
Implementations§
Source§impl AgentHandle
impl AgentHandle
Sourcepub fn new(tx: UnboundedSender<ThinkRequest>) -> Self
pub fn new(tx: UnboundedSender<ThinkRequest>) -> Self
Create a new agent handle from a sender.
Sourcepub fn think(
&self,
prompt: String,
bindings: HashMap<String, Value>,
expect: String,
) -> Result<Receiver<ThinkResponse>, String>
pub fn think( &self, prompt: String, bindings: HashMap<String, Value>, expect: String, ) -> Result<Receiver<ThinkResponse>, String>
Send a think request to the agent.
Returns a receiver for ThinkResponse messages. The send is non-blocking (uses tokio unbounded channel), but the returned receiver is std::sync for blocking receive.
Trait Implementations§
Source§impl Clone for AgentHandle
impl Clone for AgentHandle
Source§fn clone(&self) -> AgentHandle
fn clone(&self) -> AgentHandle
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for AgentHandle
impl RefUnwindSafe for AgentHandle
impl Send for AgentHandle
impl Sync for AgentHandle
impl Unpin for AgentHandle
impl UnsafeUnpin for AgentHandle
impl UnwindSafe for AgentHandle
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