Skip to content

AIImageAnnotatorConfig

Base classes

Name Children Inherits
BaseAnnotatorConfig
docler_config.annotator_configs
Base configuration for annotators.

⋔ Inheritance diagram

graph TD
  2851095284["annotator_configs.AIImageAnnotatorConfig"]
  3648172174["annotator_configs.BaseAnnotatorConfig"]
  1396724084["provider.ProviderConfig"]
  1261767679["main.BaseSettings"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  3648172174 --> 2851095284
  1396724084 --> 3648172174
  1261767679 --> 1396724084
  3879467795 --> 1261767679
  2751680898 --> 3879467795

🛈 DocStrings

Bases: BaseAnnotatorConfig

Configuration for AI-based image annotator.

Source code in src/docler_config/annotator_configs.py
class AIImageAnnotatorConfig(BaseAnnotatorConfig):
    """Configuration for AI-based image annotator."""

    type: Literal["ai_image"] = Field(default="ai_image", init=False)
    """Type discriminator for AI image annotator."""

    model: ModelIdentifier = DEFAULT_IMAGE_ANNOTATOR_MODEL
    """Vision model to use for image annotation."""

    system_prompt: str = DEFAULT_IMAGE_SYSTEM_PROMPT
    """System prompt for the image analysis task."""

    user_prompt: str = DEFAULT_IMAGE_PROMPT_TEMPLATE
    """User prompt template for image analysis."""

    batch_size: int = Field(default=3, ge=1)
    """Number of images to process concurrently."""

    def get_provider(self) -> AIImageAnnotator:
        """Get the annotator instance."""
        from docler.annotators.ai_image_annotator import AIImageAnnotator

        return AIImageAnnotator(**self.get_config_fields())

batch_size class-attribute instance-attribute

batch_size: int = Field(default=3, ge=1)

Number of images to process concurrently.

model class-attribute instance-attribute

model: ModelIdentifier = DEFAULT_IMAGE_ANNOTATOR_MODEL

Vision model to use for image annotation.

system_prompt class-attribute instance-attribute

system_prompt: str = DEFAULT_IMAGE_SYSTEM_PROMPT

System prompt for the image analysis task.

type class-attribute instance-attribute

type: Literal['ai_image'] = Field(default='ai_image', init=False)

Type discriminator for AI image annotator.

user_prompt class-attribute instance-attribute

user_prompt: str = DEFAULT_IMAGE_PROMPT_TEMPLATE

User prompt template for image analysis.

get_provider

get_provider() -> AIImageAnnotator

Get the annotator instance.

Source code in src/docler_config/annotator_configs.py
def get_provider(self) -> AIImageAnnotator:
    """Get the annotator instance."""
    from docler.annotators.ai_image_annotator import AIImageAnnotator

    return AIImageAnnotator(**self.get_config_fields())

:fa-brands-github: Show source on GitHub