pub struct HanzoBuilder { /* private fields */ }Expand description
The HanzoBuilder takes the pipeline and a scheduler method and constructs an Engine and a Hanzo instance. The Engine runs on a separate thread, and the Hanzo instance stays on the calling thread.
Implementations§
Source§impl HanzoBuilder
impl HanzoBuilder
Sourcepub fn new(
pipeline: Arc<Mutex<dyn Pipeline>>,
method: SchedulerConfig,
throughput_logging: bool,
search_embedding_model: Option<SearchEmbeddingModel>,
) -> Self
pub fn new( pipeline: Arc<Mutex<dyn Pipeline>>, method: SchedulerConfig, throughput_logging: bool, search_embedding_model: Option<SearchEmbeddingModel>, ) -> 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.
Sourcepub fn with_model_id(self, model_id: impl Into<String>) -> Self
pub fn with_model_id(self, model_id: impl Into<String>) -> Self
Override the model ID used by Hanzo. Defaults to the pipeline name.
Sourcepub fn with_loader_config(self, loader_config: ModelLoaderConfig) -> Self
pub fn with_loader_config(self, loader_config: ModelLoaderConfig) -> Self
Set the loader config for enabling model unload/reload support. Without this, models cannot be unloaded and reloaded.
pub fn with_log(self, log: String) -> Self
pub fn with_opt_log(self, log: Option<String>) -> 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.
Sourcepub fn with_tool_callback_and_tool(
self,
name: impl Into<String>,
tool_callback: Arc<ToolCallback>,
tool: Tool,
) -> Self
pub fn with_tool_callback_and_tool( self, name: impl Into<String>, tool_callback: Arc<ToolCallback>, tool: Tool, ) -> Self
Register a custom callback with its associated Tool definition. The Tool will be automatically added to requests when tool callbacks are active.
Sourcepub fn with_tool_callback_with_tool(
self,
name: impl Into<String>,
callback_with_tool: ToolCallbackWithTool,
) -> Self
pub fn with_tool_callback_with_tool( self, name: impl Into<String>, callback_with_tool: ToolCallbackWithTool, ) -> Self
Register a pre-built tool callback with its Tool definition.
Sourcepub fn with_mcp_client(self, config: McpClientConfig) -> Self
pub fn with_mcp_client(self, config: McpClientConfig) -> Self
Configure MCP client to connect to external MCP servers.
Sourcepub fn with_code_execution(self, config: CodeExecutionConfig) -> Self
pub fn with_code_execution(self, config: CodeExecutionConfig) -> Self
Enable Python code execution. Security: lets the model run arbitrary code on the host with full network and filesystem access.
pub async fn build(self) -> Arc<Hanzo> ⓘ
Auto Trait Implementations§
impl Freeze for HanzoBuilder
impl !RefUnwindSafe for HanzoBuilder
impl Send for HanzoBuilder
impl Sync for HanzoBuilder
impl Unpin for HanzoBuilder
impl UnsafeUnpin for HanzoBuilder
impl !UnwindSafe for HanzoBuilder
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
Source§impl<T> Downcast for T
impl<T> Downcast for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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> ⓘ
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> ⓘ
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.