#[non_exhaustive]pub struct AiConfig {
pub base_url: String,
pub api_key: String,
pub model: String,
pub image_scope: ImageScope,
pub timeout: Duration,
pub max_retries: u32,
}Expand description
Configuration for super::understand_image and super::refine_markdown.
Constructed with AiConfig::new, then adjusted by setting the remaining public
fields directly (the struct is #[non_exhaustive] only to keep adding a field
non-breaking — it does not restrict field access on an existing value).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.base_url: StringThe OpenAI-compatible endpoint’s base URL (no trailing /chat/completions).
api_key: StringBearer token sent as Authorization: Bearer {api_key}.
model: StringThe model name to request.
image_scope: ImageScopeWhich images a caller sends through super::understand_image.
Read by the caller deciding what to send (e.g. unpdf’s wiring) —
unparser_shared::ai itself never inspects this field. It exists on this
struct so a single AiConfig can carry the setting end-to-end from a CLI flag
or binding option down to the call site that needs it.
timeout: DurationPer-attempt timeout. Deliberately generous by default — a page or image dense with tables/formulas has been observed taking tens of seconds to a few minutes.
max_retries: u32Maximum number of attempts (the first try plus retries) before giving up.
Applies to both transport failures and a truncated (finish_reason == "length")
response.