Spaces:
Sleeping
Sleeping
File size: 980 Bytes
57cf043 4550b93 57cf043 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
from sqlalchemy import (
Boolean,
String,
Integer,
Float
)
from sqlalchemy.orm import Mapped, mapped_column
from components.dbo.models.base import Base
class LLMConfig(Base):
"""
Сущность, которая хранит параметры вызова ЛЛМ.
"""
__tablename__ = "llm_config"
is_default: Mapped[bool] = mapped_column(Boolean, default=False)
model: Mapped[String] = mapped_column(String)
temperature: Mapped[float] = mapped_column(Float)
top_p: Mapped[float] = mapped_column(Float)
min_p: Mapped[float] = mapped_column(Float)
frequency_penalty: Mapped[float] = mapped_column(Float)
presence_penalty: Mapped[float] = mapped_column(Float)
n_predict: Mapped[int] = mapped_column(Integer)
seed: Mapped[int] = mapped_column(Integer)
#TODO: вынести в базовый класс
def to_dict(self):
return {c.name: getattr(self, c.name) for c in self.__table__.columns} |