pub struct PersonaLoader { /* private fields */ }Expand description
Finds personas by name across sources in lookup order, for example the
goal’s scoped folder, then the user’s library, then builtin().
The first source holding <name>.toml wins.
Implementations§
Source§impl PersonaLoader
impl PersonaLoader
Sourcepub fn new(sources: Vec<Arc<dyn PersonaSource>>) -> Self
pub fn new(sources: Vec<Arc<dyn PersonaSource>>) -> Self
Builds a loader that tries sources first to last.
Put the most specific source first.
Returns the loader.
Sourcepub async fn load(&self, name: &str) -> Result<Persona, AgentError>
pub async fn load(&self, name: &str) -> Result<Persona, AgentError>
Loads and validates persona name from the first source that has it,
reading its instructions_file from the same source. Returns
NotFound when no source has it, or the validation error.
Sourcepub async fn trace_spec(
&self,
name: &str,
) -> Result<Option<TraceSpec>, AgentError>
pub async fn trace_spec( &self, name: &str, ) -> Result<Option<TraceSpec>, AgentError>
Returns the trace settings of persona name from the first source
that has it, None when the file sets no tracing. Returns
NotFound when no source has it, or the trace key error.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PersonaLoader
impl !UnwindSafe for PersonaLoader
impl Forget for PersonaLoader
impl Freeze for PersonaLoader
impl Move for PersonaLoader
impl Send for PersonaLoader
impl Sync for PersonaLoader
impl Unpin for PersonaLoader
impl UnsafeUnpin for PersonaLoader
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