DocumentClassificationSettings
Settings for DocumentClassification. Values fall back through three levels: document → SDK → built-in default. Writes target the document only when set on a document’s settings, otherwise the SDK globally when set on SdkSettings.
Tags: Vision
from nutrient_sdk import DocumentClassificationSettingsConstruction
DocumentClassificationSettings is accessed through a Document instance for per-document overrides, or via SdkSettings for SDK-wide defaults.
# Per-document overridewith Document.open("input.pdf") as doc: settings = doc.settings.document_classification_settings settings.some_field = new_value # mutate fields directly
# SDK-wide default (applies to all documents)SdkSettings.document_classification_settings.some_field = new_valueSettings are configured by writing to fields on the returned object. The settings property itself cannot be reassigned — doc.settings.document_classification_settings = other_settings is rejected.
Properties
auto_weight
@propertydef auto_weight(self) -> bool
@auto_weight.setterdef auto_weight(self, value: bool) -> NoneAuto (reliability) weighting. When true (default), the text/image split is derived PER DOCUMENT from each branch’s decisiveness (the top1−top2 margin of its per-label scores) — the more confident branch on that document is trusted more — and text_weight/ image_weight are ignored. When false, the fixed text_weight/ image_weight ratio is used. In BOTH modes a weight of 0 still fully disables that branch (skipping its extraction/rendering). The effective per-document image weight is reported on the result for transparency.
Type: bool
Default: true
enable_document_decision_classifier
@propertydef enable_document_decision_classifier(self) -> bool
@enable_document_decision_classifier.setterdef enable_document_decision_classifier(self, value: bool) -> NoneWhen true, classify via the nutrient-document-decision GGUF model instead of the SigLIP2/bge-m3/learned-fusion specialist — a full substitute backend, not a third branch fused with the other two (text_weight/image_weight/ auto_weight are ignored; multi_label still selects the question shape). Resolved from the CDN. Slower than the specialist — opt-in, not a default. Default false.
Type: bool
Default: false
image_weight
@propertydef image_weight(self) -> float
@image_weight.setterdef image_weight(self, value: float) -> NoneRelative weight of the image branch in the fused prediction. Set to 0 to use the text branch alone. Default 0.5. Only consulted when auto_weight is false.
Type: float
Default: 0.5f
include_per_page_scores
@propertydef include_per_page_scores(self) -> bool
@include_per_page_scores.setterdef include_per_page_scores(self, value: bool) -> NoneDiagnostic opt-in. When true, the classification artifact additionally carries, per ranked prediction, the raw per-page image-branch confidences before multi-page pooling (imageProbabilityPerPage) — letting a caller reconstruct any pooling strategy or pooling_temperature offline without re-running the model. Default false so production artifacts stay lean; the field is omitted entirely when off.
Type: bool
Default: false
multi_label
@propertydef multi_label(self) -> bool
@multi_label.setterdef multi_label(self, value: bool) -> NoneConfidence mode (reporting only — does not change the predicted label or ranking). True (default): INDEPENDENT per-label confidence, each in [0,1] (like HuggingFace multi_label=True) — supports multi-label (threshold each label) and out-of-category abstention. False (single-label): the reported per-label confidences are normalized to sum to 1 (share-of-1). The predicted label, ranking, and returned label set are identical either way; only the confidence scale changes. Abstention (the fusion action’s confidenceThreshold input, not a setting) always uses the raw independent confidence.
Type: bool
Default: true
pooling_temperature
@propertydef pooling_temperature(self) -> float
@pooling_temperature.setterdef pooling_temperature(self, value: float) -> NoneMargin-weighted pooling temperature used by both branches to combine the per-chunk (text) and per-page (image) distributions into one. Higher values let the most distinctive chunk/page dominate more aggressively; values approaching 0 approach a plain average. Default 8.
Type: float
Default: 8f
text
@propertydef text(self) -> str
@text.setterdef text(self, value: str) -> NoneDocument text for the text branch. When non-empty, this text is scored directly. When empty (default), the text is derived from the document with AdaptiveOcr (fast OCR), or with engine when it is set (e.g. Icr for local layout models, VlmEnhancedIcr for VLM-enhanced) — multi-page documents are extracted in full. Set text_weight to 0 to skip the text branch (and its extraction) entirely.
Type: str
Default: string.Empty
text_weight
@propertydef text_weight(self) -> float
@text_weight.setterdef text_weight(self, value: float) -> NoneRelative weight of the text branch in the fused prediction. The fused probability for a label is (text_weight·Pt + image_weight·Pi) / (text_weight + image_weight). Set to 0 to use the image branch alone. Default 0.5.
Type: float
Default: 0.5f
top_k
@propertydef top_k(self) -> int
@top_k.setterdef top_k(self, value: int) -> NoneMaximum number of ranked predictions to return. 0 (default) returns all candidates, ranked by fused probability descending.
Type: int
Default: 0