pub struct Config {
pub bind: SocketAddr,
pub host: HostKind,
pub host_url: String,
pub host_api_key: Option<String>,
pub default_model: String,
pub models: BTreeMap<String, ModelEntry>,
pub strict_models: bool,
pub max_concurrent_questions: usize,
pub keep_alive: Option<String>,
pub host_timeout: Duration,
pub request_timeout: Duration,
}Fields§
§bind: SocketAddr§host: HostKindWhich runtime answers. One per process; a second runtime is a second instance.
host_url: StringDefaults to where host listens out of the box.
host_api_key: Option<String>Sent as a bearer token to the OpenAI-compatible hosts. Never logged.
default_model: StringThe alias or model name used when a request names none.
models: BTreeMap<String, ModelEntry>Alias to model, with the calibration that alias implies.
strict_models: boolWhen set, a request may only name a configured alias or one of their target models. Off by default, so a fresh install can point at any model Ollama has pulled.
max_concurrent_questions: usize§keep_alive: Option<String>§host_timeout: Duration§request_timeout: DurationHow long one request may take in total, waiting for a free slot included. Without it, 32 questions at a concurrency of 4 could take eight host timeouts back to back.
Implementations§
Source§impl Config
impl Config
Sourcepub fn from_env() -> Result<Self, ConfigError>
pub fn from_env() -> Result<Self, ConfigError>
Read configuration from the environment and, if CERNO_CONFIG names one, a TOML file.
Sourcepub fn resolve(&self, name: &str) -> Option<(String, Calibration)>
pub fn resolve(&self, name: &str) -> Option<(String, Calibration)>
Resolve a caller-supplied name to a host model and the calibration it implies.
An alias resolves to its entry. A raw model name that some alias points at resolves to
that alias’s calibration, so naming the model directly behaves the same as naming the
alias. Anything else passes through untouched unless strict_models forbids it.
Sourcepub fn conflicting_aliases(&self) -> Vec<(String, Vec<String>)>
pub fn conflicting_aliases(&self) -> Vec<(String, Vec<String>)>
Models that several aliases point at with different temperatures, with those aliases.
Config::resolve gives a request naming such a model the calibration of the first
alias in order, which is a guess the operator should know about.