pub struct Oracle { /* private fields */ }Expand description
ML-powered shell error classification oracle.
Implementations§
Source§impl Oracle
impl Oracle
Sourcepub fn default_model_path() -> PathBuf
pub fn default_model_path() -> PathBuf
Get the default model path.
Sourcepub fn load_or_train() -> Result<Self>
pub fn load_or_train() -> Result<Self>
Load model from default path, or train and save if not found.
§Errors
Returns error if training fails.
Sourcepub fn with_config(config: OracleConfig) -> Self
pub fn with_config(config: OracleConfig) -> Self
Create a new oracle with custom configuration.
Sourcepub fn train_from_corpus(corpus: &Corpus, config: OracleConfig) -> Result<Self>
pub fn train_from_corpus(corpus: &Corpus, config: OracleConfig) -> Result<Self>
Sourcepub fn classify(&self, features: &ErrorFeatures) -> Result<ClassificationResult>
pub fn classify(&self, features: &ErrorFeatures) -> Result<ClassificationResult>
Classify an error and return category with confidence.
Sourcepub fn classify_error(
&self,
exit_code: i32,
stderr: &str,
command: Option<&str>,
) -> Result<ClassificationResult>
pub fn classify_error( &self, exit_code: i32, stderr: &str, command: Option<&str>, ) -> Result<ClassificationResult>
Classify an error from raw inputs.
Sourcepub fn suggest_fix(
&self,
exit_code: i32,
stderr: &str,
command: Option<&str>,
) -> String
pub fn suggest_fix( &self, exit_code: i32, stderr: &str, command: Option<&str>, ) -> String
Get fix suggestion for an error.
Sourcepub fn check_drift(&mut self, recent_accuracy: f32) -> DriftStatus
pub fn check_drift(&mut self, recent_accuracy: f32) -> DriftStatus
Check if the model needs retraining based on performance drift.
Sourcepub fn is_trained(&self) -> bool
pub fn is_trained(&self) -> bool
Check if the oracle has been trained.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Oracle
impl RefUnwindSafe for Oracle
impl Send for Oracle
impl Sync for Oracle
impl Unpin for Oracle
impl UnwindSafe for Oracle
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> 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