pub struct RagController { /* private fields */ }Expand description
Sends commands to the Ragrig worker and mirrors its state for widgets.
Implementations§
Source§impl RagController
impl RagController
Sourcepub fn new(setup: RagSetup, cx: &mut Context<'_, Self>) -> Result<Self, String>
pub fn new(setup: RagSetup, cx: &mut Context<'_, Self>) -> Result<Self, String>
Spawn the worker and start mirroring its events.
Returns an error when the worker thread cannot be created; an agent
that fails to build is reported later through
RagEvent::AgentFailed.
Sourcepub fn ask(
&mut self,
prompt: impl Into<String>,
attachments: Vec<PendingAttachment>,
cx: &mut Context<'_, Self>,
) -> Result<RequestId, String>
pub fn ask( &mut self, prompt: impl Into<String>, attachments: Vec<PendingAttachment>, cx: &mut Context<'_, Self>, ) -> Result<RequestId, String>
Ask one question and return the request identity.
Sourcepub fn new_session(&mut self, cx: &mut Context<'_, Self>)
pub fn new_session(&mut self, cx: &mut Context<'_, Self>)
Start an empty conversation.
Sourcepub fn load_session(
&mut self,
id: impl Into<String>,
cx: &mut Context<'_, Self>,
)
pub fn load_session( &mut self, id: impl Into<String>, cx: &mut Context<'_, Self>, )
Continue a saved conversation.
Sourcepub fn refresh_sessions(&mut self, cx: &mut Context<'_, Self>)
pub fn refresh_sessions(&mut self, cx: &mut Context<'_, Self>)
Re-read the session store.
Sourcepub fn refresh_library(&mut self, cx: &mut Context<'_, Self>)
pub fn refresh_library(&mut self, cx: &mut Context<'_, Self>)
Re-read the vector store.
Sourcepub fn sync_corpus(
&mut self,
name: impl Into<String>,
folder: impl Into<PathBuf>,
cx: &mut Context<'_, Self>,
) -> Result<RequestId, String>
pub fn sync_corpus( &mut self, name: impl Into<String>, folder: impl Into<PathBuf>, cx: &mut Context<'_, Self>, ) -> Result<RequestId, String>
Index a folder as a named corpus.
Sourcepub fn apply(&mut self, setup: RagSetup, cx: &mut Context<'_, Self>)
pub fn apply(&mut self, setup: RagSetup, cx: &mut Context<'_, Self>)
Rebuild the agent with new configuration.
Sourcepub fn sessions(&self) -> &[SessionEntry]
pub fn sessions(&self) -> &[SessionEntry]
Saved conversations, newest first.
Sourcepub fn current_session(&self) -> Option<&str>
pub fn current_session(&self) -> Option<&str>
The active conversation id, when known.
Sourcepub fn library(&self) -> &LibrarySnapshot
pub fn library(&self) -> &LibrarySnapshot
The last library snapshot.
Sourcepub fn ingest_progress(&self) -> Option<&IngestProgress>
pub fn ingest_progress(&self) -> Option<&IngestProgress>
The running ingestion, if any.
Sourcepub fn is_ingesting(&self) -> bool
pub fn is_ingesting(&self) -> bool
Whether a corpus is being indexed.
Sourcepub fn status_line(&self) -> String
pub fn status_line(&self) -> String
One line for a status bar.
Sourcepub fn agent_components(&self) -> Vec<AgentComponent>
pub fn agent_components(&self) -> Vec<AgentComponent>
Pipeline components for AgentBar.
Trait Implementations§
Source§impl Drop for RagController
impl Drop for RagController
impl EventEmitter<RagEvent> for RagController
Auto Trait Implementations§
impl !RefUnwindSafe for RagController
impl !UnwindSafe for RagController
impl Freeze for RagController
impl Send for RagController
impl Sync for RagController
impl Unpin for RagController
impl UnsafeUnpin for RagController
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more