pub struct MistralRsBuilder { /* private fields */ }
Expand description
The MistralRsBuilder takes the pipeline and a scheduler method and constructs an Engine and a MistralRs instance. The Engine runs on a separate thread, and the MistralRs instance stays on the calling thread.
Implementations§
Source§impl MistralRsBuilder
impl MistralRsBuilder
Sourcepub fn new(
pipeline: Arc<Mutex<dyn Pipeline>>,
method: SchedulerConfig,
throughput_logging: bool,
search_embedding_model: Option<BertEmbeddingModel>,
) -> Self
pub fn new( pipeline: Arc<Mutex<dyn Pipeline>>, method: SchedulerConfig, throughput_logging: bool, search_embedding_model: Option<BertEmbeddingModel>, ) -> Self
Creates a new builder with the given pipeline, scheduler method, logging flag,
and optional embedding model for web search. To override the search callback,
use .with_search_callback(...)
on the builder.
pub fn with_log(self, log: String) -> Self
pub fn with_opt_log(self, log: Option<String>) -> Self
pub fn with_truncate_sequence(self, truncate_sequence: bool) -> Self
pub fn with_no_kv_cache(self, no_kv_cache: bool) -> Self
pub fn with_no_prefix_cache(self, no_prefix_cache: bool) -> Self
pub fn with_prefix_cache_n(self, prefix_cache_n: usize) -> Self
pub fn with_disable_eos_stop(self, disable_eos_stop: bool) -> Self
Sourcepub fn with_search_callback(self, search_callback: Arc<SearchCallback>) -> Self
pub fn with_search_callback(self, search_callback: Arc<SearchCallback>) -> Self
Use a custom callback to gather search results.
Sourcepub fn with_tool_callback(
self,
name: impl Into<String>,
tool_callback: Arc<ToolCallback>,
) -> Self
pub fn with_tool_callback( self, name: impl Into<String>, tool_callback: Arc<ToolCallback>, ) -> Self
Register a custom callback for the specified tool name.
pub fn build(self) -> Arc<MistralRs>
Auto Trait Implementations§
impl Freeze for MistralRsBuilder
impl !RefUnwindSafe for MistralRsBuilder
impl Send for MistralRsBuilder
impl Sync for MistralRsBuilder
impl Unpin for MistralRsBuilder
impl !UnwindSafe for MistralRsBuilder
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
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any
.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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