pub struct Engine { /* private fields */ }Implementations§
Source§impl Engine
impl Engine
pub fn new(host: Arc<dyn ModelHost>, keep_alive: Option<String>) -> Self
Sourcepub fn max_options(&self) -> usize
pub fn max_options(&self) -> usize
The largest option count this engine can answer, given what its host reports.
pub fn host_name(&self) -> &str
Sourcepub fn validate(&self, request: &SystemOneRequest) -> Result<(), EngineError>
pub fn validate(&self, request: &SystemOneRequest) -> Result<(), EngineError>
Reject a request that cannot be answered, before any model is loaded.
Sourcepub async fn answer(
&self,
state: &str,
question: &Question,
model: &str,
calibration: Calibration,
) -> Result<(Answer, u32), EngineError>
pub async fn answer( &self, state: &str, question: &Question, model: &str, calibration: Calibration, ) -> Result<(Answer, u32), EngineError>
Ask one question and type its answer. The u32 is the prompt’s token count.
Sourcepub async fn answer_with_distribution(
&self,
state: &str,
question: &Question,
model: &str,
calibration: Calibration,
) -> Result<(Answer, FirstTokenDistribution), EngineError>
pub async fn answer_with_distribution( &self, state: &str, question: &Question, model: &str, calibration: Calibration, ) -> Result<(Answer, FirstTokenDistribution), EngineError>
Engine::answer, also handing back the distribution the answer was read from.
The answer renormalises over the offered labels, so it cannot say whether the model’s most likely token was a label at all. The distribution can, which is what the benchmark measures fidelity by.
Auto Trait Implementations§
impl !RefUnwindSafe for Engine
impl !UnwindSafe for Engine
impl Freeze for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
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