forked from phoenix/litellm-mirror
Litellm Minor Fixes & Improvements (10/03/2024) (#6049)
* fix(proxy_server.py): remove spendlog fixes from proxy startup logic Moves https://github.com/BerriAI/litellm/pull/4794 to `/db_scripts` and cleans up some caching-related debug info (easier to trace debug logs) * fix(langfuse_endpoints.py): Fixes https://github.com/BerriAI/litellm/issues/6041 * fix(azure.py): fix health checks for azure audio transcription models Fixes https://github.com/BerriAI/litellm/issues/5999 * Feat: Add Literal AI Integration (#5653) * feat: add Literal AI integration * update readme * Update README.md * fix: address comments * fix: remove literalai sdk * fix: use HTTPHandler * chore: add test * fix: add asyncio lock * fix(literal_ai.py): fix linting errors * fix(literal_ai.py): fix linting errors * refactor: cleanup --------- Co-authored-by: Willy Douhard <willy.douhard@gmail.com>
This commit is contained in:
parent
f9d0bcc5a1
commit
5c33d1c9af
14 changed files with 557 additions and 44 deletions
|
@ -4,6 +4,7 @@ python script to pre-create all views required by LiteLLM Proxy Server
|
|||
|
||||
import asyncio
|
||||
import os
|
||||
from update_unassigned_teams import apply_db_fixes
|
||||
|
||||
# Enter your DATABASE_URL here
|
||||
|
||||
|
@ -204,6 +205,7 @@ async def check_view_exists():
|
|||
|
||||
print("Last30dTopEndUsersSpend Created!") # noqa
|
||||
|
||||
await apply_db_fixes(db=db)
|
||||
return
|
||||
|
||||
|
||||
|
|
27
db_scripts/update_unassigned_teams.py
Normal file
27
db_scripts/update_unassigned_teams.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
from prisma import Prisma
|
||||
|
||||
|
||||
async def apply_db_fixes(db: Prisma):
|
||||
try:
|
||||
sql_query = """
|
||||
UPDATE "LiteLLM_SpendLogs"
|
||||
SET team_id = (
|
||||
SELECT vt.team_id
|
||||
FROM "LiteLLM_VerificationToken" vt
|
||||
WHERE vt.token = "LiteLLM_SpendLogs".api_key
|
||||
)
|
||||
WHERE team_id IS NULL
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM "LiteLLM_VerificationToken" vt
|
||||
WHERE vt.token = "LiteLLM_SpendLogs".api_key
|
||||
);
|
||||
"""
|
||||
response = await db.query_raw(sql_query)
|
||||
print(
|
||||
"Updated unassigned teams, Response=%s",
|
||||
response,
|
||||
)
|
||||
except Exception as e:
|
||||
raise Exception(f"Error apply_db_fixes: {str(e)}")
|
||||
return
|
Loading…
Add table
Add a link
Reference in a new issue