feat: Add tags field for models with dynamic and user-defined population

- Implemented a Python function to extract tags from the model identifier field for dynamic population.
- Enabled users to specify tags manually when registering a model.
- Tags are now included when retrieving model data.

Signed-off-by: Habeb Nawatha <habeb.naw@outlook.com>
This commit is contained in:
Habeb Nawatha 2024-12-14 21:40:18 +02:00
parent 815f4af6cf
commit 3faa79d76c
2 changed files with 32 additions and 1 deletions

View file

@ -20,6 +20,11 @@ class CommonModelFields(BaseModel):
description="Any additional metadata for this model",
)
tags: Dict[str, str] = Field(
default_factory=dict,
description="Tags associated with this model as a dictionary",
)
@json_schema_type
class ModelType(str, Enum):
@ -69,6 +74,7 @@ class Models(Protocol):
provider_id: Optional[str] = None,
metadata: Optional[Dict[str, Any]] = None,
model_type: Optional[ModelType] = None,
tags: Optional[Dict[str, str]] = None,
) -> Model: ...
@webmethod(route="/models/unregister", method="POST")