feat: add focus schema
This commit is contained in:
parent
565a622cf9
commit
3af9bab6a5
33
litellm/integrations/focus/schema.py
Normal file
33
litellm/integrations/focus/schema.py
Normal file
@ -0,0 +1,33 @@
|
||||
"""Schema definitions for Focus export data."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import polars as pl
|
||||
|
||||
|
||||
FOCUS_NORMALIZED_SCHEMA = pl.Schema(
|
||||
{
|
||||
"usage_date": pl.Datetime(time_unit="us"),
|
||||
"team_id": pl.String,
|
||||
"team_alias": pl.String,
|
||||
"user_id": pl.String,
|
||||
"user_email": pl.String,
|
||||
"api_key_alias": pl.String,
|
||||
"model": pl.String,
|
||||
"model_group": pl.String,
|
||||
"custom_llm_provider": pl.String,
|
||||
"prompt_tokens": pl.Int64,
|
||||
"completion_tokens": pl.Int64,
|
||||
"total_tokens": pl.Int64,
|
||||
"spend": pl.Float64,
|
||||
"cache_creation_input_tokens": pl.Int64,
|
||||
"cache_read_input_tokens": pl.Int64,
|
||||
"api_requests": pl.Int64,
|
||||
"successful_requests": pl.Int64,
|
||||
"failed_requests": pl.Int64,
|
||||
"created_at": pl.Datetime(time_unit="us"),
|
||||
"updated_at": pl.Datetime(time_unit="us"),
|
||||
}
|
||||
)
|
||||
|
||||
__all__ = ["FOCUS_NORMALIZED_SCHEMA"]
|
||||
@ -4,10 +4,14 @@ from __future__ import annotations
|
||||
|
||||
import polars as pl
|
||||
|
||||
from .schema import FOCUS_NORMALIZED_SCHEMA
|
||||
|
||||
|
||||
class FocusTransformer:
|
||||
"""Transforms LiteLLM DB rows into Focus-compatible schema."""
|
||||
|
||||
schema = FOCUS_NORMALIZED_SCHEMA
|
||||
|
||||
def transform(self, frame: pl.DataFrame) -> pl.DataFrame:
|
||||
"""Return a normalized frame expected by downstream serializers."""
|
||||
raise NotImplementedError
|
||||
|
||||
Loading…
Reference in New Issue
Block a user