Skip to main content

maybe_preprocess

Function maybe_preprocess 

Source
pub async fn maybe_preprocess(
    config: &Config,
    active_provider: &dyn LlmProvider,
    caption: &str,
    images: &[ImagePart],
) -> PreprocessOutcome
Expand description

Decide whether and how to preprocess images before a main-provider turn.

Short-circuit order (each → Skipped, except the last):

  1. images is empty.
  2. The active provider’s model name passes the model_name_suggests_vision heuristic (it can handle the image natively).
  3. config.vision_preprocessor_provider is None or Some("").
  4. The configured key is missing from config.providersFailed (this is a configuration mistake worth surfacing, not a silent skip).