Skip to main content

Primitives Overview

Primitives are the low-level building blocks that modules inherit from, compose with, or resolve through registries. They are not the main CLI-facing surface, but they define most of the reusable behavior inside AutoPipeline.

Overview

Registry-backed primitive surfaces​

The primitive layer exposes three registries:

  • CLIENT_REGISTRY
  • PROMPT_ADAPTER_REGISTRY
  • EXPERT_REGISTRY

These registries are the official primitive-level extension points. They are initialized through import side effects in:

  • src/autopipeline/components/primitives/clients/__init__.py
  • src/autopipeline/components/primitives/__init__.py

Other helpers such as CLIPMixin, MaskProcessor, or the low-level SSIM utilities are reused through direct inheritance or direct import rather than registry lookup.

Source-aligned primitive catalog​

The primitive docs are now organized closer to the source tree:

Source fileMain classes or functionsRole
clients/base_client.pyBaseClientabstract client contract and JSON recovery
clients/openai_client.pyOpenAIAPIClientOpenAI-compatible HTTP backend
clients/google_client.pyGoogleAPIClientGoogle GenAI backend
clients/vllm_client.pyvLLMOnlineClientvLLM OpenAI-compatible backend
prompt_adapters.pyBasePromptAdapter, OpenAIStylePromptAdapter, GoogleGenAIStylePromptAdapterprompt payload formatting
face_analyzer.pyFaceDetectionMixin, FaceMeshMixin, FaceIDMixinface detection, landmarks, identity
grounding_dino.pyGroundingDINOMixinzero-shot detection helper
human_segmenter.pyHumanSegmentationMixin, HairSegmentationMixinbody and hair masks
human_skeleton.pyHumanSkeletonMixinpose landmarks
mask_processor.pyMaskProcessorbbox-to-mask conversion and patch masking
semantic_consistency.pyCLIPMixin, DINOv3Mixinembedding extraction for similarity modules
visual_consistency.pySSIMMixin, LPIPSMixin, SAMSegmentationMixin, DepthAnythingv2Mixinvisual metric backends
ssim.pyssim, ms_ssim, SSIM, MS_SSIMlow-level SSIM infrastructure

When you need this section​

Read the primitives docs if:

  • you want to add a new backend client
  • you want to support a new prompt payload format
  • you need to understand where human-centric face, body, or hair artifacts come from
  • you want to build a new module on top of an existing model backend

Practical boundary between modules and primitives​

As a rule:

  • if the component appears in a pipeline config as pipe_name, it is a module
  • if the component is reused by several modules or pipelines, it is usually a primitive

That distinction keeps the public runtime surface relatively compact while preserving reuse internally.

Documentation granularity​

Primitive pages are split by source file unless several classes form one tightly coupled unit. That is why:

  • each backend client now has its own page
  • face_analyzer.py stays together because detection, mesh, and identity logic are part of one face-analysis surface
  • visual_consistency.py stays together because its mixins are the shared metric backends for several modules