rusty_genius_cortex/
lib.rs1use anyhow::Result;
2use async_trait::async_trait;
3use futures::channel::mpsc;
4use rusty_genius_core::protocol::InferenceEvent;
5
6pub mod backend;
7
8#[async_trait]
9pub trait Engine: Send + Sync {
10 async fn load_model(&mut self, model_path: &str) -> Result<()>;
12
13 async fn unload_model(&mut self) -> Result<()>;
15
16 async fn infer(
19 &mut self,
20 prompt: &str,
21 ) -> Result<mpsc::Receiver<Result<InferenceEvent>>>;
23}
24
25pub async fn create_engine() -> Box<dyn Engine> {
26 #[cfg(feature = "real-engine")]
27 {
28 Box::new(backend::Brain::new())
29 }
30
31 #[cfg(not(feature = "real-engine"))]
32 {
33 Box::new(backend::Pinky::new())
34 }
35}