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 in this agent’s own chat, used directly; None when it follows the timeline’s.
Implementations§
Source§impl Agent
impl Agent
pub fn parent(&self) -> Option<TimelineRoom>
pub fn from_json(json: &Value, parent: &TimelineRoom) -> Option<Agent>
Sourcepub fn set_repository(&self, repository: Option<&Repository>)
pub fn set_repository(&self, repository: Option<&Repository>)
Pick a repository for this agent’s chats (used directly), or None to follow the timeline’s again.
Sourcepub async fn get_chat(
&self,
hooks: Option<Arc<dyn RoomHooks>>,
) -> Result<TimelineChat>
pub async fn get_chat( &self, hooks: Option<Arc<dyn RoomHooks>>, ) -> Result<TimelineChat>
Lazily mint/open this agent’s Parrot ChatRoom.
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
Trait Implementations§
Auto Trait Implementations§
impl Forget for Agent
impl Freeze for Agent
impl Move for Agent
impl RefUnwindSafe for Agent
impl Send for Agent
impl Sync for Agent
impl Unpin for Agent
impl UnsafeUnpin for Agent
impl UnwindSafe for Agent
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