Files
gpt-pilot/core/llm/request_log.py
Senko Rasic 5b474ccc1f merge gpt-pilot 0.2 codebase
This is a complete rewrite of the GPT Pilot core, from the ground
up, making the agentic architecture front and center, and also
fixing some long-standing problems with the database architecture
that weren't feasible to solve without breaking compatibility.

As the database structure and config file syntax have changed,
we have automatic imports for projects and current configs,
see the README.md file for details.

This also relicenses the project to FSL-1.1-MIT license.
2024-05-22 21:42:25 +02:00

29 lines
668 B
Python

from datetime import datetime
from enum import Enum
from pydantic import BaseModel, Field
from core.config import LLMProvider
class LLMRequestStatus(str, Enum):
SUCCESS = "success"
ERROR = "error"
class LLMRequestLog(BaseModel):
provider: LLMProvider
model: str
temperature: float
messages: list[dict[str, str]] = Field(default_factory=list)
response: str = ""
prompt_tokens: int = 0
completion_tokens: int = 0
started_at: datetime = Field(default_factory=datetime.now)
duration: float = 0.0
status: LLMRequestStatus = LLMRequestStatus.SUCCESS
error: str = ""
__all__ = ["LLMRequestLog", "LLMRequestStatus"]