Caption result reference
argus-lens 0.11.1.dev4+g4804154 @ 4804154PyPI (opens in new tab)Source (opens in new tab)Changelog (opens in new tab)
Imported from docs/caption-result.md on argus-lens's dev branch at that commit. Fixes go upstream, not here.
Every captioning call returns a CaptionResult (argus_lens.types.CaptionResult, a plain dataclass). The HTTP endpoints send it as JSON via dataclasses.asdict(), so the field names and the caption_variants keys below are the wire format that argus-studio, argus-lightbox and other clients read. Renaming any of them is a breaking change.
{
"final_caption": "sks_person, woman, long hair, smile",
"caption_variants": {
"identity": "...", "wardrobe": "...", "pose_composition": "...",
"setting": "...", "lighting": "...", "action": "...",
"training": "...", "training_prose": "...", "zeroshot": "..."
},
"selected_category": "identity",
"removed_phrases": ["masterpiece", "the image shows"],
"compaction_notes": ["Stripped rating/meta tags that have no training value."],
"raw_tags": "1girl, long_hair, smile, masterpiece",
"raw_prose": "The image shows a woman with long hair smiling.",
"backend_name": "hybrid",
"metadata": {"empty_categories": [], "buckets": {}, "subjects": {}, "monochrome": false,
"reconciled_tags": "...", "tag_reconcile": {}, "refine": {}}
}
Fields
raw_wd14 and raw_florence are read-only Python aliases for raw_tags and raw_prose. They are properties, so they don't appear in the JSON.
Variants
caption_variants has one key per category, then three specialised variants. With the default categories (DEFAULT_CATEGORY_CONFIGS, also listed by GET /profiles as target_categories) the keys are:
Each category variant starts with the trigger word (when one is given), then all of its own category's fragments, then a few fragments from each other category, within a per-variant length cap. So the setting caption opens with the setting, not with hair colour. A category with nothing of its own is made only of other categories' fragments; metadata.empty_categories lists those.
Custom CategoryConfigs replace the six category keys with their own names. training, training_prose and zeroshot are always present.
removed_phrases covers every variant
removed_phrases is one list for the whole result. It collects what was dropped anywhere in assembly: rating/meta tags, filler ("the image shows"), prose clauses that duplicated a tag, tags settled by reconciliation, and fragments trimmed to fit each variant's token budget. So it over-reports for any single variant: a phrase trimmed from zeroshot may still be in identity. To explain why a phrase is missing from one variant, compare that variant with raw_tags/raw_prose (or metadata.buckets) instead. Lightbox traces per variant for this reason.
Metadata
Assembly always writes the first six keys. refine appears when refinement ran, and replay appears only on replayed results.
metadata is open-ended: new keys may be added in minor releases, so clients should ignore keys they don't know.