pixano_inference.schemas.interface
How a deployed model is called: one descriptor per capability.
A capability's Input is the union of what every model of that capability might accept: a SAM2
video model reads keyframes while a ByteTrack model reads classes; Grounding DINO requires
classes while a YOLO detector has its own class set. The capability alone does not tell a client
how to call a given model, what to show in a model picker, or which class names a closed-vocabulary
model knows. A model MAY describe itself with the descriptor of its capability
(:attr:pixano_inference.models.InferenceModel.interface); the server publishes it as
ModelStatusInfo.interface on GET /v1/models, None when the model declares none.
The descriptors are told apart on the wire by their capability field (:data:ModelInterface).
ModelInterface = Annotated[Union[TrackingInterface, DetectionInterface, SegmentationInterface, VLMInterface, EmbeddingInterface, NERInterface], Field(discriminator='capability')]
module-attribute
The descriptor of a model, whichever its capability: a union told apart by capability.
Prompt = Literal['points', 'box', 'mask', 'text']
module-attribute
What a request may carry to name an object.
Threshold = Literal['box', 'text']
module-attribute
A confidence threshold a request may set.
DetectionInterface(**data)
Bases: _BaseModel
How a detection model is called.
Attributes:
| Name | Type | Description |
|---|---|---|
capability |
Literal['detection']
|
Always |
classes |
Literal['open', 'closed']
|
|
class_names |
list[str] | None
|
The class set of a closed-vocabulary model, |
thresholds |
list[Threshold]
|
The confidence thresholds the model reads from the request. |
outputs |
list[Literal['box', 'score', 'class', 'mask']]
|
What each detection carries. |
Source code in pydantic/main.py
EmbeddingInterface(**data)
Bases: _BaseModel
How an embedding model is called.
Attributes:
| Name | Type | Description |
|---|---|---|
capability |
Literal['embedding']
|
Always |
modalities |
list[Literal['image', 'text']]
|
What the model embeds. A model listing both maps them into one shared space. |
dim |
int | None
|
Dimensionality of the vectors, |
Source code in pydantic/main.py
ImageRange(**data)
Bases: _BaseModel
How many images a request may carry.
Attributes:
| Name | Type | Description |
|---|---|---|
min |
int
|
The fewest images a request must carry. |
max |
int | None
|
The most images a request may carry; |
Source code in pydantic/main.py
NERInterface(**data)
Bases: _BaseModel
How a named entity recognition model is called.
Attributes:
| Name | Type | Description |
|---|---|---|
capability |
Literal['ner']
|
Always |
entity_types |
list[str] | None
|
The labels the model can return, |
Source code in pydantic/main.py
SegmentationInterface(**data)
Bases: _BaseModel
How an image segmentation model is called.
Attributes:
| Name | Type | Description |
|---|---|---|
capability |
Literal['segmentation']
|
Always |
prompts |
list[Prompt]
|
What a request may carry to name what to segment. Empty for a model that segments without a prompt. |
multimask |
bool
|
Whether the model can return several candidate masks per prompt. |
embeddings |
bool
|
Whether the model returns the image embedding on request and accepts it back, so a client can re-prompt the same image without re-encoding it. |
outputs |
list[Literal['mask', 'score', 'logits']]
|
What a prediction carries. |
Source code in pydantic/main.py
TrackingInterface(**data)
Bases: _BaseModel
How a tracking model is called.
Attributes:
| Name | Type | Description |
|---|---|---|
capability |
Literal['tracking']
|
Always |
prompts |
list[Prompt]
|
What a keyframe may carry to name an object. Empty for a model that takes no prompt. |
prompt_free |
bool
|
Whether the model accepts a request that names no object (tracking by detection: the model detects the objects and creates the tracks itself). |
classes |
Literal['none', 'open', 'closed']
|
|
class_names |
list[str] | None
|
The class set of a closed-vocabulary model, |
thresholds |
list[Threshold]
|
The confidence thresholds the model reads from the request. |
interval |
bool
|
Whether the model honours the propagation |
outputs |
list[Literal['mask', 'box', 'score', 'class']]
|
What each tracked object carries. |
Source code in pydantic/main.py
VLMInterface(**data)
Bases: _BaseModel
How a vision-language model is called.
Attributes:
| Name | Type | Description |
|---|---|---|
capability |
Literal['vlm']
|
Always |
prompt |
list[Literal['text', 'messages']]
|
The prompt forms the model accepts: a |
images |
ImageRange
|
How many images a request may carry, in |