pub struct Agent {
pub id: String,
pub persona: Identity,
pub repository: Option<u64>,
/* private fields */
}Fields§
§id: String§persona: Identity§repository: Option<u64>A repository picked for this agent, used directly; None when it follows the chat’s.
Implementations§
Source§impl Agent
impl Agent
pub fn parent(&self) -> Option<AntChatRoom>
Sourcepub fn set_repository(&self, repository: Option<&Repository>)
pub fn set_repository(&self, repository: Option<&Repository>)
Pick a repository for this agent (used directly), or None to follow the chat’s again.
pub async fn observe(&self, content: &str) -> Result<Memory>
Sourcepub async fn generate(
&self,
messages: &[Content],
opts: AgentGenerateOptions,
) -> Result<BoxStream<'static, StreamEvent>>
pub async fn generate( &self, messages: &[Content], opts: AgentGenerateOptions, ) -> Result<BoxStream<'static, StreamEvent>>
Stream a reply as this agent, under the room’s own authorization. tools answer the persona’s calls to them.
pub fn to_json(&self) -> Value
pub fn from_json(json: &Value, parent: &AntChatRoom) -> Option<Agent>
Trait Implementations§
Auto Trait Implementations§
impl Forget for Agent
impl Freeze for Agentwhere
*const ArcInner<RoomInner> is !null: Freeze,
PhantomData<ArcInner<RoomInner>>: Freeze,
*const ArcInner<AntChatState> is !null: Freeze,
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Ethnicity>: Freeze,
impl Move for Agent
impl RefUnwindSafe for Agentwhere
Atomic<usize>: RefUnwindSafe,
Chan<Message, Semaphore>: RefUnwindSafe,
Mutex<Vec<Presence>>: RefUnwindSafe,
RwLock<bool>: RefUnwindSafe,
AtomicUsize: RefUnwindSafe,
Notify: RefUnwindSafe,
Atomic<bool>: RefUnwindSafe,
Mutex<AntChat>: RefUnwindSafe,
Mutex<Vec<(u64, Arc<dyn Fn(Option<u64>) + Sync + Send>)>>: RefUnwindSafe,
Atomic<u64>: RefUnwindSafe,
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agentwhere
*const ArcInner<RoomInner> is !null: UnsafeUnpin,
PhantomData<ArcInner<RoomInner>>: UnsafeUnpin,
*const ArcInner<AntChatState> is !null: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Ethnicity>: UnsafeUnpin,
impl UnwindSafe for Agentwhere
Arc<RoomInner>: UnwindSafe,
NonNull<ArcInner<AntChatState>>: UnwindSafe,
RawVecInner: UnwindSafe,
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