InferenceEngine

Struct InferenceEngine 

Source
pub struct InferenceEngine { /* private fields */ }
Expand description

Main inference engine

Implementations§

Source§

impl InferenceEngine

Source

pub fn new(model: DeepSeekR1Model) -> Result<Self>

Create a new inference engine

Source

pub fn with_configs( model: DeepSeekR1Model, tokenizer_config: TokenizerConfig, sampling_config: SamplingConfig, generation_config: GenerationConfig, ) -> Result<Self>

Create a new inference engine with custom configurations

Source

pub fn generate_text(&mut self, prompt: &str) -> Result<String>

Generate text from a prompt using default configuration

Source

pub fn generate_text_with_config( &mut self, prompt: &str, config: &GenerationConfig, ) -> Result<GenerationOutput>

Generate text from a prompt with custom configuration

Source

pub fn generate_text_streaming<F>( &mut self, prompt: &str, config: &GenerationConfig, callback: F, ) -> Result<GenerationOutput>
where F: FnMut(&str) -> Result<bool>,

Generate text with streaming (returns tokens as they are generated)

Source

pub fn set_generation_config(&mut self, config: GenerationConfig)

Set generation configuration

Source

pub fn generation_config(&self) -> &GenerationConfig

Get current generation configuration

Source

pub fn clear_cache(&mut self)

Clear generation cache

Source

pub fn tokenizer(&self) -> &Tokenizer

Get tokenizer reference

Source

pub fn generate_with_reasoning( &mut self, prompt: &str, ) -> Result<ReasoningOutput>

Generate text with reasoning awareness

Source

pub fn generate_with_reasoning_config( &mut self, prompt: &str, config: &GenerationConfig, ) -> Result<ReasoningOutput>

Generate text with reasoning awareness and custom config

Source

pub fn generate_with_reasoning_detection( &mut self, prompt: &str, ) -> Result<(GenerationOutput, Option<ReasoningOutput>)>

Generate text with automatic reasoning detection

Source

pub fn generate_structured_reasoning( &mut self, prompt: &str, ) -> Result<ReasoningOutput>

Generate structured reasoning for a given prompt

Source

pub fn solve_math_problem(&mut self, problem: &str) -> Result<ReasoningOutput>

Solve a mathematical problem with reasoning

Source

pub fn solve_math_problem_detailed( &mut self, problem: &str, ) -> Result<MathSolutionOutput>

Solve a mathematical problem with detailed step-by-step reasoning

Source

pub fn explain_code(&mut self, code: &str) -> Result<ReasoningOutput>

Explain code with reasoning

Source

pub fn explain_code_detailed( &mut self, code: &str, language: Option<&str>, ) -> Result<CodeExplanationOutput>

Explain code with detailed analysis

Source

pub fn solve_logical_problem( &mut self, problem: &str, ) -> Result<ReasoningOutput>

Solve logical reasoning problems

Source

pub fn solve_logical_problem_detailed( &mut self, problem: &str, ) -> Result<LogicalSolutionOutput>

Solve logical reasoning problems with detailed analysis

Source

pub fn solve_problem( &mut self, problem: &str, problem_type: ProblemType, ) -> Result<ReasoningOutput>

General problem solving with adaptive prompting

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V