24 lines
1.1 KiB
Python
24 lines
1.1 KiB
Python
from typing import Self, Any, Optional
|
|
from AetherCommon.Utils.Common import Common
|
|
from AetherModelsServer.Models.CapabilitiesModel import CapabilitiesModel
|
|
|
|
class AIModel(CapabilitiesModel):
|
|
|
|
id:int|str
|
|
name:str
|
|
server_id:int|str
|
|
maximum_threads:int
|
|
|
|
def __init__(self:Self, id:int|str, inputs:Optional[Any] = None) -> None:
|
|
object.__setattr__(self, "id", id)
|
|
# Nombre del modelo en el backend (ej: "llama3:8b", "qwen2.5-coder:7b")
|
|
object.__setattr__(self, "name", str(Common.get_value(["name", "model_name", "model"], inputs, id)))
|
|
# Identificador del servidor que lo aloja
|
|
object.__setattr__(self, "server_id", Common.get_value(["server_id", "server"], inputs, ""))
|
|
# Hilos máximos permitidos específicamente para este modelo
|
|
object.__setattr__(self, "maximum_threads", int(Common.get_value(["maximum_threads", "max_threads"], inputs, 1)))
|
|
|
|
super().__init__(inputs)
|
|
|
|
def __setattr__(self, name:str, value:Any) -> None:
|
|
raise AttributeError(f"{self.__class__.__name__} es inmutable.") |