pub struct ModelContext {
pub provider: String,
pub model: String,
pub base_url: String,
pub api_key: Option<String>,
}Expand description
Pre-resolved model configuration created at gateway startup.
The gateway reads the configured provider + model from Config, fetches
the API key from the secrets vault, and holds everything in this struct
so per-connection handlers can call the provider without the client
needing to send credentials.
Fields§
§provider: String§model: String§base_url: String§api_key: Option<String>Implementations§
Source§impl ModelContext
impl ModelContext
Sourcepub fn resolve(config: &Config, secrets: &mut SecretsManager) -> Result<Self>
pub fn resolve(config: &Config, secrets: &mut SecretsManager) -> Result<Self>
Resolve the model context from the app configuration and secrets vault.
Returns an error if no [model] section is present in the config.
A missing API key is treated as a warning (the provider may not need
one — e.g. Ollama), not a hard error.
Sourcepub fn from_config(config: &Config, api_key: Option<String>) -> Result<Self>
pub fn from_config(config: &Config, api_key: Option<String>) -> Result<Self>
Build a model context from configuration and a pre-resolved API key.
Use this when the caller has already extracted the key (e.g. the CLI passes just the provider key to the daemon via an environment variable, so the gateway never needs vault access).
Trait Implementations§
Source§impl Clone for ModelContext
impl Clone for ModelContext
Source§fn clone(&self) -> ModelContext
fn clone(&self) -> ModelContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more