@@ -241,3 +241,44 @@ class HostGovernancePolicyRow(Base):
|
||||
max_active_tasks: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
daily_token_budget: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
updated_at: Mapped[str] = mapped_column(String, nullable=False)
|
||||
|
||||
|
||||
class TokenReservationRow(Base):
|
||||
__tablename__ = "cloud_token_reservations"
|
||||
__table_args__ = (
|
||||
Index("ix_cloud_token_reservations_host_day", "host_id", "usage_day"),
|
||||
Index("ix_cloud_token_reservations_expires_at", "expires_at"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True)
|
||||
host_id: Mapped[str] = mapped_column(
|
||||
ForeignKey("host_registrations.host_id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
usage_day: Mapped[str] = mapped_column(String, nullable=False)
|
||||
reserved_tokens: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
task_id: Mapped[str | None] = mapped_column(String, nullable=True)
|
||||
attempt: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
created_at: Mapped[str] = mapped_column(String, nullable=False)
|
||||
expires_at: Mapped[str] = mapped_column(String, nullable=False)
|
||||
|
||||
|
||||
class TokenUsageEventRow(Base):
|
||||
__tablename__ = "cloud_token_usage_events"
|
||||
__table_args__ = (
|
||||
Index("ix_cloud_token_usage_events_host_day", "host_id", "usage_day"),
|
||||
Index("ix_cloud_token_usage_events_occurred_at", "occurred_at"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String, primary_key=True)
|
||||
host_id: Mapped[str] = mapped_column(
|
||||
ForeignKey("host_registrations.host_id", ondelete="CASCADE"), nullable=False
|
||||
)
|
||||
usage_day: Mapped[str] = mapped_column(String, nullable=False)
|
||||
task_id: Mapped[str | None] = mapped_column(String, nullable=True)
|
||||
attempt: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
provider: Mapped[str] = mapped_column(String, nullable=False)
|
||||
model: Mapped[str] = mapped_column(String, nullable=False)
|
||||
input_tokens: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
output_tokens: Mapped[int | None] = mapped_column(Integer, nullable=True)
|
||||
total_tokens: Mapped[int] = mapped_column(Integer, nullable=False)
|
||||
occurred_at: Mapped[str] = mapped_column(String, nullable=False)
|
||||
|
||||
Reference in New Issue
Block a user