mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 03:34:10 +00:00
fix(dynamo_db.py): add cost tracking support for key + user
This commit is contained in:
parent
9b3d78c4f3
commit
f94a37a836
4 changed files with 163 additions and 107 deletions
|
@ -1,5 +1,7 @@
|
|||
from typing import Any, Literal, List
|
||||
class CustomDB:
|
||||
|
||||
|
||||
class CustomDB:
|
||||
"""
|
||||
Implements a base class that we expect any custom db implementation (e.g. DynamoDB) to follow
|
||||
"""
|
||||
|
@ -7,37 +9,45 @@ class CustomDB:
|
|||
def __init__(self) -> None:
|
||||
pass
|
||||
|
||||
def get_data(self, key: str, value: str, table_name: Literal["user", "key", "config"]):
|
||||
def get_data(self, key: str, table_name: Literal["user", "key", "config"]):
|
||||
"""
|
||||
Check if key valid
|
||||
"""
|
||||
pass
|
||||
|
||||
def insert_data(self, value: Any, table_name: Literal["user", "key", "config"]):
|
||||
|
||||
def insert_data(self, value: Any, table_name: Literal["user", "key", "config"]):
|
||||
"""
|
||||
For new key / user logic
|
||||
"""
|
||||
pass
|
||||
|
||||
def update_data(self, key: str, value: Any, table_name: Literal["user", "key", "config"]):
|
||||
def update_data(
|
||||
self, key: str, value: Any, table_name: Literal["user", "key", "config"]
|
||||
):
|
||||
"""
|
||||
For cost tracking logic
|
||||
"""
|
||||
pass
|
||||
|
||||
def delete_data(self, keys: List[str], table_name: Literal["user", "key", "config"]):
|
||||
def delete_data(
|
||||
self, keys: List[str], table_name: Literal["user", "key", "config"]
|
||||
):
|
||||
"""
|
||||
For /key/delete endpoint s
|
||||
"""
|
||||
|
||||
def connect(self, ):
|
||||
|
||||
def connect(
|
||||
self,
|
||||
):
|
||||
"""
|
||||
For connecting to db and creating / updating any tables
|
||||
"""
|
||||
For connecting to db and creating / updating any tables
|
||||
"""
|
||||
pass
|
||||
|
||||
def disconnect(self, ):
|
||||
def disconnect(
|
||||
self,
|
||||
):
|
||||
"""
|
||||
For closing connection on server shutdown
|
||||
"""
|
||||
pass
|
||||
pass
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue