Skip to main content

HanzoConfig

Struct HanzoConfig 

Source
pub struct HanzoConfig {
Show 35 fields pub hanzo_home: PathBuf, pub models_dir: PathBuf, pub embeddings_dir: PathBuf, pub rerankers_dir: PathBuf, pub llms_dir: PathBuf, pub cache_dir: PathBuf, pub data_dir: PathBuf, pub logs_dir: PathBuf, pub config_dir: PathBuf, pub max_cache_size_gb: f64, pub max_models_size_gb: f64, pub auto_cleanup: bool, pub lancedb_path: PathBuf, pub lancedb_max_size_gb: f64, pub enable_vector_search: bool, pub enable_full_text_search: bool, pub web_enabled: bool, pub web_host: String, pub web_port: u16, pub api_host: String, pub api_port: u16, pub ws_enabled: bool, pub ws_port: Option<u16>, pub p2p_port: u16, pub public_url: Option<String>, pub enable_cors: bool, pub allowed_origins: Vec<String>, pub engine_binary: PathBuf, pub engine_threads: usize, pub engine_gpu_layers: Option<u32>, pub engine_batch_size: usize, pub default_embedding_model: String, pub default_reranker_model: String, pub default_llm_model: String, pub api_keys_file: PathBuf,
}
Expand description

Unified configuration for all Hanzo components This ensures consistency across:

  • hanzoai (engine CLI)
  • hanzod (network node with web exposure)
  • app (~/work/hanzo/app)
  • All other Hanzo tools

Fields§

§hanzo_home: PathBuf§models_dir: PathBuf§embeddings_dir: PathBuf§rerankers_dir: PathBuf§llms_dir: PathBuf§cache_dir: PathBuf§data_dir: PathBuf§logs_dir: PathBuf§config_dir: PathBuf§max_cache_size_gb: f64§max_models_size_gb: f64§auto_cleanup: bool§lancedb_path: PathBuf§lancedb_max_size_gb: f64§enable_vector_search: bool§enable_full_text_search: bool§web_enabled: bool§web_host: String§web_port: u16§api_host: String§api_port: u16§ws_enabled: bool§ws_port: Option<u16>§p2p_port: u16§public_url: Option<String>§enable_cors: bool§allowed_origins: Vec<String>§engine_binary: PathBuf§engine_threads: usize§engine_gpu_layers: Option<u32>§engine_batch_size: usize§default_embedding_model: String§default_reranker_model: String§default_llm_model: String§api_keys_file: PathBuf

Implementations§

Source§

impl HanzoConfig

Source

pub fn load() -> Result<Self, Box<dyn Error>>

Load config from ~/.hanzo/config/hanzo.toml or create default

Source

pub fn save(&self) -> Result<(), Box<dyn Error>>

Save config to ~/.hanzo/config/hanzo.toml

Source

pub fn ensure_directories(&self) -> Result<(), Box<dyn Error>>

Ensure all directories exist

Source

pub fn get_storage_stats(&self) -> StorageStats

Get storage usage statistics

Source

pub fn cleanup_cache(&self) -> Result<usize, Box<dyn Error>>

Clean up old cache files if over limit

Source

pub fn get_model_path(&self, model_name: &str) -> PathBuf

Get path for a specific model

Source

pub fn is_model_downloaded(&self, model_name: &str) -> bool

Check if model is downloaded

Source

pub fn get_public_url(&self) -> String

Get public URL for web exposure

Source

pub fn get_api_url(&self) -> String

Get API URL

Source

pub fn get_ws_url(&self) -> String

Get WebSocket URL

Source

pub fn get_public_ws_url(&self) -> String

Get public WebSocket URL

Trait Implementations§

Source§

impl Clone for HanzoConfig

Source§

fn clone(&self) -> HanzoConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HanzoConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for HanzoConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for HanzoConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HanzoConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.