Struct MultimodalConfig
pub struct MultimodalConfig {
pub max_images: usize,
pub max_image_size_mb: usize,
pub max_image_turns: usize,
pub allow_remote_fetch: bool,
pub vision_model_provider: Option<String>,
pub vision_model: Option<String>,
}Expand description
Multimodal (image) handling configuration ([multimodal] section).
§Privacy and cost note
Tool text is never scanned for image paths: a tool result that merely
prints a local path (e.g. shell tools doing ls /pictures or
find . -name '*.png') stays text. Image bytes are uploaded only when a
tool explicitly declares an attachment, and a declared attachment is
base64-inlined into the next provider request, so operators running
tools that declare image attachments over personal or sensitive files
should be aware of the upload semantics.
max_images (and the trim_old_images LRU policy) bounds the per-request
image budget. See docs/book/src/contributing/privacy.md for the
project’s privacy stance.
Fields§
§max_images: usizeMaximum number of image attachments accepted per request.
Caps the total number of [IMAGE:...] markers that survive into the
provider request after multimodal preprocessing. Older images are
dropped first. When a new image takes the count past the limit, the
oldest images are removed in one batch, down to half the limit
rounded up (4 -> 2, 8 -> 4, 16 -> 8); the count then grows back to the
limit before the next batch. Removing an image changes the message
that held it, which can invalidate a provider’s cached prefix from
that message onward; batching means a session past the limit pays
that once every max_images / 2 + 1 new images rather than on every
one. Right after a batch the model sees fewer older images than the
limit allows. A larger limit delays the first batch and makes each
one less frequent. Acts as the upper bound on per-turn upload cost
when tool outputs surface local image paths.
max_image_size_mb: usizeMaximum image payload size in MiB before base64 encoding.
Measured on decoded bytes, so the encoded request payload is about a
third larger. Applies to every image entering the pipeline: channel
attachments, tool outputs that surface local image paths, and the web
dashboard upload. Defaults to the 20 MiB ceiling that
MultimodalConfig::effective_limits clamps to, so an ordinary photo
is accepted without configuration; lower it to bound per-turn upload
cost or gateway buffering.
Providers apply their own limits on top of this one. Anthropic refuses a single image over 10 MB base64-encoded (about 7.5 MiB decoded), enforced by its provider client independently of this setting.
max_image_turns: usizeMaximum age of images in conversation turns.
When non-zero, images in user messages that are more than this many turns back from the end of history are stripped before the request is sent to the provider. This prevents a single screenshot from being re-encoded and re-uploaded on every subsequent turn indefinitely. Tool-result images are already managed by the stale-tool-result mechanism and are not affected by this setting.
0 (the default) disables age-based trimming entirely — images are
only evicted by the max_images count cap.
allow_remote_fetch: boolAllow fetching remote image URLs (http/https). Disabled by default.
vision_model_provider: Option<String>ModelProvider name to use for vision/image messages (e.g. "ollama").
When set, messages containing [IMAGE:] markers are routed to this
model_provider instead of the default text model_provider.
vision_model: Option<String>Model to use when routing to the vision model_provider (e.g. "llava:7b").
Only used when vision_model_provider is set.
Implementations§
Source§impl MultimodalConfig
impl MultimodalConfig
Sourcepub fn configurable_prefix() -> &'static str
pub fn configurable_prefix() -> &'static str
Returns the #[prefix] value for this Configurable struct.
Sourcepub fn init_requires_explicit_config() -> bool
pub fn init_requires_explicit_config() -> bool
True when this struct has a required leaf field that a
bare/ancestor-prefix init_defaults scaffold must not
materialize (it would fill the field with its Rust
Default, which prune_empty_leaves then strips on save,
leaving a partial sub-table that fails strict reload).
Explicitly targeting this section (or a descendant of it)
still scaffolds regardless of this flag, so the section can
be materialized for the operator to fill in.
Sourcepub fn secret_fields(&self) -> Vec<SecretFieldInfo>
pub fn secret_fields(&self) -> Vec<SecretFieldInfo>
Returns metadata about all #[secret] fields on this struct and nested children.
pub fn secret_field_terminals() -> Vec<&'static str>
Sourcepub fn encrypt_secrets(&mut self, store: &SecretStore) -> Result<()>
pub fn encrypt_secrets(&mut self, store: &SecretStore) -> Result<()>
Encrypt all secret fields in place using the provided store.
Sourcepub fn decrypt_secrets(&mut self, store: &SecretStore) -> Result<()>
pub fn decrypt_secrets(&mut self, store: &SecretStore) -> Result<()>
Decrypt all secret fields in place using the provided store.
Sourcepub fn set_secret(&mut self, name: &str, value: String) -> Result<()>
pub fn set_secret(&mut self, name: &str, value: String) -> Result<()>
Set a secret field by its full dotted name, dispatching to nested children.
Sourcepub fn prop_fields(&self) -> Vec<PropFieldInfo>
pub fn prop_fields(&self) -> Vec<PropFieldInfo>
Returns metadata about all property fields on this struct and nested children.
Sourcepub fn get_prop(&self, name: &str) -> Result<String>
pub fn get_prop(&self, name: &str) -> Result<String>
Get a property value by its full dotted name, returning it as a display string.
Sourcepub fn set_prop(&mut self, name: &str, value_str: &str) -> Result<()>
pub fn set_prop(&mut self, name: &str, value_str: &str) -> Result<()>
Set a property value by its full dotted name, parsing from string.
Sourcepub fn prop_is_secret(name: &str) -> bool
pub fn prop_is_secret(name: &str) -> bool
Check if a property name refers to a secret field (static, no instance needed).
Sourcepub fn init_defaults(&mut self, prefix: Option<&str>) -> Vec<&'static str>
pub fn init_defaults(&mut self, prefix: Option<&str>) -> Vec<&'static str>
Instantiate None nested sections whose prefix matches.
Returns the prefixes that were initialized.
Sourcepub fn map_key_sections() -> Vec<MapKeySection>
pub fn map_key_sections() -> Vec<MapKeySection>
Enumerate every map-keyed (HashMap<String, T>) and list-shaped
(Vec<T>) section discoverable from this Configurable’s tree.
The dashboard / CLI consume this to surface “+ Add” affordances
without hardcoding the section list.
Sourcepub fn nested_section_help(name: &str) -> Option<&'static str>
pub fn nested_section_help(name: &str) -> Option<&'static str>
Help blurb for a #[nested] field on this struct, sourced from
the field-level /// docstring. Returns None for unknown
names so callers can fall through to a different lookup.
pub fn nested_section_group(name: &str) -> Option<&'static str>
Sourcepub fn get_map_keys(&self, section_path: &str) -> Option<Vec<String>>
pub fn get_map_keys(&self, section_path: &str) -> Option<Vec<String>>
Return the current alias keys at section_path, or None if
the path doesn’t resolve to a map-keyed section in this tree.
pub fn nested_option_entries(&self) -> Vec<NestedOptionEntry>
pub fn create_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>
pub fn delete_map_key( &mut self, section_path: &str, map_key: &str, ) -> Result<bool, String>
pub fn rename_map_key( &mut self, section_path: &str, map_key: &str, new_key: &str, ) -> Result<bool, String>
Source§impl MultimodalConfig
impl MultimodalConfig
Sourcepub fn effective_limits(&self) -> (usize, usize)
pub fn effective_limits(&self) -> (usize, usize)
Clamp configured values to safe runtime bounds.
The 20 MiB image ceiling is the lowest common per-image or per-request bound across the supported vision APIs (OpenAI accepts about 20 MB per image, Gemini 20 MB for an inline request, Anthropic 32 MB per request with a tighter per-image limit its own client enforces). Images are buffered whole and grow by about a third under base64, so the ceiling also bounds gateway memory per upload.
Trait Implementations§
Source§impl Clone for MultimodalConfig
impl Clone for MultimodalConfig
Source§fn clone(&self) -> MultimodalConfig
fn clone(&self) -> MultimodalConfig
1.0.0 (const: unstable) · §fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for MultimodalConfig
impl Debug for MultimodalConfig
Source§impl Default for MultimodalConfig
impl Default for MultimodalConfig
Source§impl<'de> Deserialize<'de> for MultimodalConfig
impl<'de> Deserialize<'de> for MultimodalConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for MultimodalConfig
impl JsonSchema for MultimodalConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl MaskSecrets for MultimodalConfig
impl MaskSecrets for MultimodalConfig
fn mask_secrets(&mut self)
fn restore_secrets_from(&mut self, current: &Self)
Auto Trait Implementations§
impl Freeze for MultimodalConfig
impl RefUnwindSafe for MultimodalConfig
impl Send for MultimodalConfig
impl Sync for MultimodalConfig
impl Unpin for MultimodalConfig
impl UnsafeUnpin for MultimodalConfig
impl UnwindSafe for MultimodalConfig
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more