pub struct Context { /* private fields */ }Implementations§
Source§impl Context
impl Context
pub fn new(llm: Arc<dyn LLMProvider>, tx: Option<Sender<Event>>) -> Self
pub async fn publish<M: ActorMessage>( &self, topic: Topic<M>, message: M, ) -> Result<(), ContextError>
pub fn with_memory( self, memory: Option<Arc<Mutex<Box<dyn MemoryProvider>>>>, ) -> Self
pub fn with_tools(self, tools: Vec<Box<dyn ToolT>>) -> Self
pub fn with_config(self, config: AgentConfig) -> Self
pub fn with_messages(self, messages: Vec<ChatMessage>) -> Self
pub fn with_stream(self, stream: bool) -> Self
pub fn llm(&self) -> &Arc<dyn LLMProvider>
pub fn messages(&self) -> &[ChatMessage]
pub fn memory(&self) -> Option<Arc<Mutex<Box<dyn MemoryProvider>>>>
pub fn tools(&self) -> &[Box<dyn ToolT>]
pub fn config(&self) -> &AgentConfig
pub fn state(&self) -> Arc<Mutex<AgentState>>
pub fn tx(&self) -> Result<Sender<Event>, ContextError>
pub fn stream(&self) -> bool
Auto Trait Implementations§
impl Freeze for Context
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
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
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> Message for T
impl<T> Message for T
Source§fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
fn from_boxed(m: BoxedMessage) -> Result<Self, BoxedDowncastErr>
Convert a BoxedMessage to this concrete type
Source§fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
fn box_message(self, pid: &ActorId) -> Result<BoxedMessage, BoxedDowncastErr>
Convert this message to a BoxedMessage