Spaces:
Sleeping
Sleeping
Download app/models/llm_log.py from thabsheeeeeer/DocBrain-API: direct link, hf CLI and curl.
- Browser
- Download file 673 Bytes
-
https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/models/llm_log.py
- Command line
-
hf download hf://spaces/thabsheeeeeer/DocBrain-API/app/models/llm_log.py
-
curl -L -o llm_log.py https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/models/llm_log.py
673 Bytes
| from datetime import datetime | |
| from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Float | |
| from app.db.database import Base | |
| class LLMLog(Base): | |
| __tablename__ = "llm_logs" | |
| id = Column(Integer, primary_key=True, index=True) | |
| user_id = Column(Integer, ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True) | |
| model = Column(String, nullable=False) | |
| prompt_tokens = Column(Integer, default=0) | |
| completion_tokens = Column(Integer, default=0) | |
| total_tokens = Column(Integer, default=0) | |
| response_time = Column(Float, nullable=True) # In seconds | |
| created_at = Column(DateTime, default=datetime.utcnow, nullable=False) | |