pub struct InferenceEngine { /* private fields */ }Expand description
Main inference engine
Implementations§
Source§impl InferenceEngine
impl InferenceEngine
Sourcepub fn new(model: DeepSeekR1Model) -> Result<Self>
pub fn new(model: DeepSeekR1Model) -> Result<Self>
Create a new inference engine
Sourcepub fn with_configs(
model: DeepSeekR1Model,
tokenizer_config: TokenizerConfig,
sampling_config: SamplingConfig,
generation_config: GenerationConfig,
) -> Result<Self>
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
Sourcepub fn generate_text(&mut self, prompt: &str) -> Result<String>
pub fn generate_text(&mut self, prompt: &str) -> Result<String>
Generate text from a prompt using default configuration
Sourcepub fn generate_text_with_config(
&mut self,
prompt: &str,
config: &GenerationConfig,
) -> Result<GenerationOutput>
pub fn generate_text_with_config( &mut self, prompt: &str, config: &GenerationConfig, ) -> Result<GenerationOutput>
Generate text from a prompt with custom configuration
Sourcepub fn generate_text_streaming<F>(
&mut self,
prompt: &str,
config: &GenerationConfig,
callback: F,
) -> Result<GenerationOutput>
pub fn generate_text_streaming<F>( &mut self, prompt: &str, config: &GenerationConfig, callback: F, ) -> Result<GenerationOutput>
Generate text with streaming (returns tokens as they are generated)
Sourcepub fn set_generation_config(&mut self, config: GenerationConfig)
pub fn set_generation_config(&mut self, config: GenerationConfig)
Set generation configuration
Sourcepub fn generation_config(&self) -> &GenerationConfig
pub fn generation_config(&self) -> &GenerationConfig
Get current generation configuration
Sourcepub fn clear_cache(&mut self)
pub fn clear_cache(&mut self)
Clear generation cache
Sourcepub fn generate_with_reasoning(
&mut self,
prompt: &str,
) -> Result<ReasoningOutput>
pub fn generate_with_reasoning( &mut self, prompt: &str, ) -> Result<ReasoningOutput>
Generate text with reasoning awareness
Sourcepub fn generate_with_reasoning_config(
&mut self,
prompt: &str,
config: &GenerationConfig,
) -> Result<ReasoningOutput>
pub fn generate_with_reasoning_config( &mut self, prompt: &str, config: &GenerationConfig, ) -> Result<ReasoningOutput>
Generate text with reasoning awareness and custom config
Sourcepub fn generate_with_reasoning_detection(
&mut self,
prompt: &str,
) -> Result<(GenerationOutput, Option<ReasoningOutput>)>
pub fn generate_with_reasoning_detection( &mut self, prompt: &str, ) -> Result<(GenerationOutput, Option<ReasoningOutput>)>
Generate text with automatic reasoning detection
Sourcepub fn generate_structured_reasoning(
&mut self,
prompt: &str,
) -> Result<ReasoningOutput>
pub fn generate_structured_reasoning( &mut self, prompt: &str, ) -> Result<ReasoningOutput>
Generate structured reasoning for a given prompt
Sourcepub fn solve_math_problem(&mut self, problem: &str) -> Result<ReasoningOutput>
pub fn solve_math_problem(&mut self, problem: &str) -> Result<ReasoningOutput>
Solve a mathematical problem with reasoning
Sourcepub fn solve_math_problem_detailed(
&mut self,
problem: &str,
) -> Result<MathSolutionOutput>
pub fn solve_math_problem_detailed( &mut self, problem: &str, ) -> Result<MathSolutionOutput>
Solve a mathematical problem with detailed step-by-step reasoning
Sourcepub fn explain_code(&mut self, code: &str) -> Result<ReasoningOutput>
pub fn explain_code(&mut self, code: &str) -> Result<ReasoningOutput>
Explain code with reasoning
Sourcepub fn explain_code_detailed(
&mut self,
code: &str,
language: Option<&str>,
) -> Result<CodeExplanationOutput>
pub fn explain_code_detailed( &mut self, code: &str, language: Option<&str>, ) -> Result<CodeExplanationOutput>
Explain code with detailed analysis
Sourcepub fn solve_logical_problem(
&mut self,
problem: &str,
) -> Result<ReasoningOutput>
pub fn solve_logical_problem( &mut self, problem: &str, ) -> Result<ReasoningOutput>
Solve logical reasoning problems
Sourcepub fn solve_logical_problem_detailed(
&mut self,
problem: &str,
) -> Result<LogicalSolutionOutput>
pub fn solve_logical_problem_detailed( &mut self, problem: &str, ) -> Result<LogicalSolutionOutput>
Solve logical reasoning problems with detailed analysis
Sourcepub fn solve_problem(
&mut self,
problem: &str,
problem_type: ProblemType,
) -> Result<ReasoningOutput>
pub fn solve_problem( &mut self, problem: &str, problem_type: ProblemType, ) -> Result<ReasoningOutput>
General problem solving with adaptive prompting