litellm-proxy-extras 0.4.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- litellm_proxy_extras/__init__.py +0 -0
- litellm_proxy_extras/_logging.py +12 -0
- litellm_proxy_extras/migrations/20250326162113_baseline/migration.sql +360 -0
- litellm_proxy_extras/migrations/20250326171002_add_daily_user_table/migration.sql +33 -0
- litellm_proxy_extras/migrations/20250327180120_add_api_requests_to_daily_user_table/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250329084805_new_cron_job_table/migration.sql +14 -0
- litellm_proxy_extras/migrations/20250331215456_track_success_and_failed_requests_daily_agg_table/migration.sql +4 -0
- litellm_proxy_extras/migrations/20250411215431_add_managed_file_table/migration.sql +18 -0
- litellm_proxy_extras/migrations/20250412081753_team_member_permissions/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250415151647_add_cache_read_write_tokens_daily_spend_transactions/migration.sql +4 -0
- litellm_proxy_extras/migrations/20250415191926_add_daily_team_table/migration.sql +36 -0
- litellm_proxy_extras/migrations/20250416115320_add_tag_table_to_db/migration.sql +45 -0
- litellm_proxy_extras/migrations/20250416151339_drop_tag_uniqueness_requirement/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250416185146_add_allowed_routes_litellm_verification_token/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250425182129_add_session_id/migration.sql +4 -0
- litellm_proxy_extras/migrations/20250430193429_add_managed_vector_stores/migration.sql +14 -0
- litellm_proxy_extras/migrations/20250507161526_add_mcp_table_to_db/migration.sql +17 -0
- litellm_proxy_extras/migrations/20250507161527_add_health_check_fields_to_mcp_servers/migration.sql +4 -0
- litellm_proxy_extras/migrations/20250507184818_add_mcp_key_team_permission_mgmt/migration.sql +32 -0
- litellm_proxy_extras/migrations/20250508072103_add_status_to_spendlogs/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250509141545_use_big_int_for_daily_spend_tables/migration.sql +27 -0
- litellm_proxy_extras/migrations/20250510142544_add_session_id_index_spend_logs/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250514142245_add_guardrails_table/migration.sql +15 -0
- litellm_proxy_extras/migrations/20250522223020_managed_object_table/migration.sql +32 -0
- litellm_proxy_extras/migrations/20250526154401_allow_null_entity_id/migration.sql +9 -0
- litellm_proxy_extras/migrations/20250528185438_add_vector_stores_to_object_permissions/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250603210143_cascade_budget_changes/migration.sql +6 -0
- litellm_proxy_extras/migrations/20250618225828_add_health_check_table/migration.sql +28 -0
- litellm_proxy_extras/migrations/20250625145206_cascade_budget_and_loosen_managed_file_json/migration.sql +9 -0
- litellm_proxy_extras/migrations/20250625213625_add_status_to_managed_object_table/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250707212517_add_mcp_info_column_mcp_servers/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250707230009_add_mcp_namespaced_tool_name/migration.sql +42 -0
- litellm_proxy_extras/migrations/20250711220620_add_stdio_mcp/migration.sql +10 -0
- litellm_proxy_extras/migrations/20250718125714_add_litellm_params_to_vector_stores/migration.sql +3 -0
- litellm_proxy_extras/migrations/20250802162330_prompt_table/migration.sql +15 -0
- litellm_proxy_extras/migrations/20250806095134_rename_alias_to_server_name_mcp_table/migration.sql +10 -0
- litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql +8 -0
- litellm_proxy_extras/migrations/20250926194702_unnamed_migration/migration.sql +7 -0
- litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql +3 -0
- litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql +3 -0
- litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql +3 -0
- litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql +18 -0
- litellm_proxy_extras/migrations/20251023141814_add_search_tool_table/migration.sql +15 -0
- litellm_proxy_extras/migrations/20251031181430_add_cache_config_table/migration.sql +20 -0
- litellm_proxy_extras/migrations/20251101131415_add_managed_vector_store_index_table/migration.sql +17 -0
- litellm_proxy_extras/migrations/20251103072422_add_static_headers/migration.sql +2 -0
- litellm_proxy_extras/migrations/20251104220043_add_credentials_to_mcp_servers/migration.sql +2 -0
- litellm_proxy_extras/migrations/migration_lock.toml +1 -0
- litellm_proxy_extras/schema.prisma +612 -0
- litellm_proxy_extras/utils.py +369 -0
- litellm_proxy_extras-0.4.3.dist-info/METADATA +44 -0
- litellm_proxy_extras-0.4.3.dist-info/RECORD +54 -0
- litellm_proxy_extras-0.4.3.dist-info/WHEEL +4 -0
- litellm_proxy_extras-0.4.3.dist-info/licenses/LICENSE +26 -0
|
@@ -0,0 +1,369 @@
|
|
|
1
|
+
import glob
|
|
2
|
+
import os
|
|
3
|
+
import random
|
|
4
|
+
import re
|
|
5
|
+
import shutil
|
|
6
|
+
import subprocess
|
|
7
|
+
import time
|
|
8
|
+
from datetime import datetime
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
from typing import Optional
|
|
11
|
+
|
|
12
|
+
from litellm_proxy_extras._logging import logger
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def str_to_bool(value: Optional[str]) -> bool:
|
|
16
|
+
if value is None:
|
|
17
|
+
return False
|
|
18
|
+
return value.lower() in ("true", "1", "t", "y", "yes")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ProxyExtrasDBManager:
|
|
22
|
+
@staticmethod
|
|
23
|
+
def _get_prisma_dir() -> str:
|
|
24
|
+
"""
|
|
25
|
+
Get the path to the migrations directory
|
|
26
|
+
|
|
27
|
+
Set os.environ["LITELLM_MIGRATION_DIR"] to a custom migrations directory, to support baselining db in read-only fs.
|
|
28
|
+
"""
|
|
29
|
+
custom_migrations_dir = os.getenv("LITELLM_MIGRATION_DIR")
|
|
30
|
+
pkg_migrations_dir = os.path.dirname(__file__)
|
|
31
|
+
if custom_migrations_dir:
|
|
32
|
+
# If migrations_dir exists, copy contents
|
|
33
|
+
if os.path.exists(custom_migrations_dir):
|
|
34
|
+
# Copy contents instead of directory itself
|
|
35
|
+
for item in os.listdir(pkg_migrations_dir):
|
|
36
|
+
src_path = os.path.join(pkg_migrations_dir, item)
|
|
37
|
+
dst_path = os.path.join(custom_migrations_dir, item)
|
|
38
|
+
if os.path.isdir(src_path):
|
|
39
|
+
shutil.copytree(src_path, dst_path, dirs_exist_ok=True)
|
|
40
|
+
else:
|
|
41
|
+
shutil.copy2(src_path, dst_path)
|
|
42
|
+
else:
|
|
43
|
+
# If directory doesn't exist, create it and copy everything
|
|
44
|
+
shutil.copytree(pkg_migrations_dir, custom_migrations_dir)
|
|
45
|
+
return custom_migrations_dir
|
|
46
|
+
|
|
47
|
+
return pkg_migrations_dir
|
|
48
|
+
|
|
49
|
+
@staticmethod
|
|
50
|
+
def _create_baseline_migration(schema_path: str) -> bool:
|
|
51
|
+
"""Create a baseline migration for an existing database"""
|
|
52
|
+
prisma_dir = ProxyExtrasDBManager._get_prisma_dir()
|
|
53
|
+
prisma_dir_path = Path(prisma_dir)
|
|
54
|
+
init_dir = prisma_dir_path / "migrations" / "0_init"
|
|
55
|
+
|
|
56
|
+
# Create migrations/0_init directory
|
|
57
|
+
init_dir.mkdir(parents=True, exist_ok=True)
|
|
58
|
+
|
|
59
|
+
database_url = os.getenv("DATABASE_URL")
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
# 1. Generate migration SQL file by comparing empty state to current db state
|
|
63
|
+
logger.info("Generating baseline migration...")
|
|
64
|
+
migration_file = init_dir / "migration.sql"
|
|
65
|
+
subprocess.run(
|
|
66
|
+
[
|
|
67
|
+
"prisma",
|
|
68
|
+
"migrate",
|
|
69
|
+
"diff",
|
|
70
|
+
"--from-empty",
|
|
71
|
+
"--to-url",
|
|
72
|
+
database_url,
|
|
73
|
+
"--script",
|
|
74
|
+
],
|
|
75
|
+
stdout=open(migration_file, "w"),
|
|
76
|
+
check=True,
|
|
77
|
+
timeout=30,
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
# 3. Mark the migration as applied since it represents current state
|
|
81
|
+
logger.info("Marking baseline migration as applied...")
|
|
82
|
+
subprocess.run(
|
|
83
|
+
[
|
|
84
|
+
"prisma",
|
|
85
|
+
"migrate",
|
|
86
|
+
"resolve",
|
|
87
|
+
"--applied",
|
|
88
|
+
"0_init",
|
|
89
|
+
],
|
|
90
|
+
check=True,
|
|
91
|
+
timeout=30,
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
return True
|
|
95
|
+
except subprocess.TimeoutExpired:
|
|
96
|
+
logger.warning(
|
|
97
|
+
"Migration timed out - the database might be under heavy load."
|
|
98
|
+
)
|
|
99
|
+
return False
|
|
100
|
+
except subprocess.CalledProcessError as e:
|
|
101
|
+
logger.warning(
|
|
102
|
+
f"Error creating baseline migration: {e}, {e.stderr}, {e.stdout}"
|
|
103
|
+
)
|
|
104
|
+
raise e
|
|
105
|
+
|
|
106
|
+
@staticmethod
|
|
107
|
+
def _get_migration_names(migrations_dir: str) -> list:
|
|
108
|
+
"""Get all migration directory names from the migrations folder"""
|
|
109
|
+
migration_paths = glob.glob(f"{migrations_dir}/migrations/*/migration.sql")
|
|
110
|
+
logger.info(f"Found {len(migration_paths)} migrations at {migrations_dir}")
|
|
111
|
+
return [Path(p).parent.name for p in migration_paths]
|
|
112
|
+
|
|
113
|
+
@staticmethod
|
|
114
|
+
def _roll_back_migration(migration_name: str):
|
|
115
|
+
"""Mark a specific migration as rolled back"""
|
|
116
|
+
subprocess.run(
|
|
117
|
+
["prisma", "migrate", "resolve", "--rolled-back", migration_name],
|
|
118
|
+
timeout=60,
|
|
119
|
+
check=True,
|
|
120
|
+
capture_output=True,
|
|
121
|
+
)
|
|
122
|
+
|
|
123
|
+
@staticmethod
|
|
124
|
+
def _resolve_specific_migration(migration_name: str):
|
|
125
|
+
"""Mark a specific migration as applied"""
|
|
126
|
+
subprocess.run(
|
|
127
|
+
["prisma", "migrate", "resolve", "--applied", migration_name],
|
|
128
|
+
timeout=60,
|
|
129
|
+
check=True,
|
|
130
|
+
capture_output=True,
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
@staticmethod
|
|
134
|
+
def _resolve_all_migrations(
|
|
135
|
+
migrations_dir: str, schema_path: str, mark_all_applied: bool = True
|
|
136
|
+
):
|
|
137
|
+
"""
|
|
138
|
+
1. Compare the current database state to schema.prisma and generate a migration for the diff.
|
|
139
|
+
2. Run prisma migrate deploy to apply any pending migrations.
|
|
140
|
+
3. Mark all existing migrations as applied.
|
|
141
|
+
"""
|
|
142
|
+
database_url = os.getenv("DATABASE_URL")
|
|
143
|
+
diff_dir = (
|
|
144
|
+
Path(migrations_dir)
|
|
145
|
+
/ "migrations"
|
|
146
|
+
/ f"{datetime.now().strftime('%Y%m%d%H%M%S')}_baseline_diff"
|
|
147
|
+
)
|
|
148
|
+
try:
|
|
149
|
+
diff_dir.mkdir(parents=True, exist_ok=True)
|
|
150
|
+
except Exception as e:
|
|
151
|
+
if "Permission denied" in str(e):
|
|
152
|
+
logger.warning(
|
|
153
|
+
f"Permission denied - {e}\nunable to baseline db. Set LITELLM_MIGRATION_DIR environment variable to a writable directory to enable migrations."
|
|
154
|
+
)
|
|
155
|
+
return
|
|
156
|
+
raise e
|
|
157
|
+
diff_sql_path = diff_dir / "migration.sql"
|
|
158
|
+
|
|
159
|
+
# 1. Generate migration SQL for the diff between DB and schema
|
|
160
|
+
try:
|
|
161
|
+
logger.info("Generating migration diff between DB and schema.prisma...")
|
|
162
|
+
with open(diff_sql_path, "w") as f:
|
|
163
|
+
subprocess.run(
|
|
164
|
+
[
|
|
165
|
+
"prisma",
|
|
166
|
+
"migrate",
|
|
167
|
+
"diff",
|
|
168
|
+
"--from-url",
|
|
169
|
+
database_url,
|
|
170
|
+
"--to-schema-datamodel",
|
|
171
|
+
schema_path,
|
|
172
|
+
"--script",
|
|
173
|
+
],
|
|
174
|
+
check=True,
|
|
175
|
+
timeout=60,
|
|
176
|
+
stdout=f,
|
|
177
|
+
)
|
|
178
|
+
except subprocess.CalledProcessError as e:
|
|
179
|
+
logger.warning(f"Failed to generate migration diff: {e.stderr}")
|
|
180
|
+
except subprocess.TimeoutExpired:
|
|
181
|
+
logger.warning("Migration diff generation timed out.")
|
|
182
|
+
|
|
183
|
+
# check if the migration was created
|
|
184
|
+
if not diff_sql_path.exists():
|
|
185
|
+
logger.warning("Migration diff was not created")
|
|
186
|
+
return
|
|
187
|
+
logger.info(f"Migration diff created at {diff_sql_path}")
|
|
188
|
+
|
|
189
|
+
# 2. Run prisma db execute to apply the migration
|
|
190
|
+
try:
|
|
191
|
+
logger.info("Running prisma db execute to apply the migration diff...")
|
|
192
|
+
result = subprocess.run(
|
|
193
|
+
[
|
|
194
|
+
"prisma",
|
|
195
|
+
"db",
|
|
196
|
+
"execute",
|
|
197
|
+
"--file",
|
|
198
|
+
str(diff_sql_path),
|
|
199
|
+
"--schema",
|
|
200
|
+
schema_path,
|
|
201
|
+
],
|
|
202
|
+
timeout=60,
|
|
203
|
+
check=True,
|
|
204
|
+
capture_output=True,
|
|
205
|
+
text=True,
|
|
206
|
+
)
|
|
207
|
+
logger.info(f"prisma db execute stdout: {result.stdout}")
|
|
208
|
+
logger.info("✅ Migration diff applied successfully")
|
|
209
|
+
except subprocess.CalledProcessError as e:
|
|
210
|
+
logger.warning(f"Failed to apply migration diff: {e.stderr}")
|
|
211
|
+
except subprocess.TimeoutExpired:
|
|
212
|
+
logger.warning("Migration diff application timed out.")
|
|
213
|
+
|
|
214
|
+
# 3. Mark all migrations as applied
|
|
215
|
+
if not mark_all_applied:
|
|
216
|
+
return
|
|
217
|
+
migration_names = ProxyExtrasDBManager._get_migration_names(migrations_dir)
|
|
218
|
+
logger.info(f"Resolving {len(migration_names)} migrations")
|
|
219
|
+
for migration_name in migration_names:
|
|
220
|
+
try:
|
|
221
|
+
logger.info(f"Resolving migration: {migration_name}")
|
|
222
|
+
subprocess.run(
|
|
223
|
+
["prisma", "migrate", "resolve", "--applied", migration_name],
|
|
224
|
+
timeout=60,
|
|
225
|
+
check=True,
|
|
226
|
+
capture_output=True,
|
|
227
|
+
text=True,
|
|
228
|
+
)
|
|
229
|
+
logger.debug(f"Resolved migration: {migration_name}")
|
|
230
|
+
except subprocess.CalledProcessError as e:
|
|
231
|
+
if "is already recorded as applied in the database." not in e.stderr:
|
|
232
|
+
logger.warning(
|
|
233
|
+
f"Failed to resolve migration {migration_name}: {e.stderr}"
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
@staticmethod
|
|
237
|
+
def setup_database(use_migrate: bool = False) -> bool:
|
|
238
|
+
"""
|
|
239
|
+
Set up the database using either prisma migrate or prisma db push
|
|
240
|
+
Uses migrations from litellm-proxy-extras package
|
|
241
|
+
|
|
242
|
+
Args:
|
|
243
|
+
schema_path (str): Path to the Prisma schema file
|
|
244
|
+
use_migrate (bool): Whether to use prisma migrate instead of db push
|
|
245
|
+
|
|
246
|
+
Returns:
|
|
247
|
+
bool: True if setup was successful, False otherwise
|
|
248
|
+
"""
|
|
249
|
+
schema_path = ProxyExtrasDBManager._get_prisma_dir() + "/schema.prisma"
|
|
250
|
+
for attempt in range(4):
|
|
251
|
+
original_dir = os.getcwd()
|
|
252
|
+
migrations_dir = ProxyExtrasDBManager._get_prisma_dir()
|
|
253
|
+
os.chdir(migrations_dir)
|
|
254
|
+
|
|
255
|
+
try:
|
|
256
|
+
if use_migrate:
|
|
257
|
+
logger.info("Running prisma migrate deploy")
|
|
258
|
+
try:
|
|
259
|
+
# Set migrations directory for Prisma
|
|
260
|
+
result = subprocess.run(
|
|
261
|
+
["prisma", "migrate", "deploy"],
|
|
262
|
+
timeout=60,
|
|
263
|
+
check=True,
|
|
264
|
+
capture_output=True,
|
|
265
|
+
text=True,
|
|
266
|
+
)
|
|
267
|
+
logger.info(f"prisma migrate deploy stdout: {result.stdout}")
|
|
268
|
+
|
|
269
|
+
logger.info("prisma migrate deploy completed")
|
|
270
|
+
|
|
271
|
+
# Run sanity check to ensure DB matches schema
|
|
272
|
+
logger.info("Running post-migration sanity check...")
|
|
273
|
+
ProxyExtrasDBManager._resolve_all_migrations(
|
|
274
|
+
migrations_dir, schema_path, mark_all_applied=False
|
|
275
|
+
)
|
|
276
|
+
logger.info("✅ Post-migration sanity check completed")
|
|
277
|
+
return True
|
|
278
|
+
except subprocess.CalledProcessError as e:
|
|
279
|
+
logger.info(f"prisma db error: {e.stderr}, e: {e.stdout}")
|
|
280
|
+
if "P3009" in e.stderr:
|
|
281
|
+
# Extract the failed migration name from the error message
|
|
282
|
+
migration_match = re.search(
|
|
283
|
+
r"`(\d+_.*)` migration", e.stderr
|
|
284
|
+
)
|
|
285
|
+
if migration_match:
|
|
286
|
+
failed_migration = migration_match.group(1)
|
|
287
|
+
logger.info(
|
|
288
|
+
f"Found failed migration: {failed_migration}, marking as rolled back"
|
|
289
|
+
)
|
|
290
|
+
# Mark the failed migration as rolled back
|
|
291
|
+
subprocess.run(
|
|
292
|
+
[
|
|
293
|
+
"prisma",
|
|
294
|
+
"migrate",
|
|
295
|
+
"resolve",
|
|
296
|
+
"--rolled-back",
|
|
297
|
+
failed_migration,
|
|
298
|
+
],
|
|
299
|
+
timeout=60,
|
|
300
|
+
check=True,
|
|
301
|
+
capture_output=True,
|
|
302
|
+
text=True,
|
|
303
|
+
)
|
|
304
|
+
logger.info(
|
|
305
|
+
f"✅ Migration {failed_migration} marked as rolled back... retrying"
|
|
306
|
+
)
|
|
307
|
+
elif (
|
|
308
|
+
"P3005" in e.stderr
|
|
309
|
+
and "database schema is not empty" in e.stderr
|
|
310
|
+
):
|
|
311
|
+
logger.info(
|
|
312
|
+
"Database schema is not empty, creating baseline migration. In read-only file system, please set an environment variable `LITELLM_MIGRATION_DIR` to a writable directory to enable migrations. Learn more - https://docs.litellm.ai/docs/proxy/prod#read-only-file-system"
|
|
313
|
+
)
|
|
314
|
+
ProxyExtrasDBManager._create_baseline_migration(schema_path)
|
|
315
|
+
logger.info(
|
|
316
|
+
"Baseline migration created, resolving all migrations"
|
|
317
|
+
)
|
|
318
|
+
ProxyExtrasDBManager._resolve_all_migrations(
|
|
319
|
+
migrations_dir, schema_path
|
|
320
|
+
)
|
|
321
|
+
logger.info("✅ All migrations resolved.")
|
|
322
|
+
return True
|
|
323
|
+
elif (
|
|
324
|
+
"P3018" in e.stderr
|
|
325
|
+
): # PostgreSQL error code for duplicate column
|
|
326
|
+
logger.info(
|
|
327
|
+
"Migration already exists, resolving specific migration"
|
|
328
|
+
)
|
|
329
|
+
# Extract the migration name from the error message
|
|
330
|
+
migration_match = re.search(
|
|
331
|
+
r"Migration name: (\d+_.*)", e.stderr
|
|
332
|
+
)
|
|
333
|
+
if migration_match:
|
|
334
|
+
migration_name = migration_match.group(1)
|
|
335
|
+
logger.info(f"Rolling back migration {migration_name}")
|
|
336
|
+
ProxyExtrasDBManager._roll_back_migration(
|
|
337
|
+
migration_name
|
|
338
|
+
)
|
|
339
|
+
logger.info(
|
|
340
|
+
f"Resolving migration {migration_name} that failed due to existing columns"
|
|
341
|
+
)
|
|
342
|
+
ProxyExtrasDBManager._resolve_specific_migration(
|
|
343
|
+
migration_name
|
|
344
|
+
)
|
|
345
|
+
logger.info("✅ Migration resolved.")
|
|
346
|
+
else:
|
|
347
|
+
# Use prisma db push with increased timeout
|
|
348
|
+
subprocess.run(
|
|
349
|
+
["prisma", "db", "push", "--accept-data-loss"],
|
|
350
|
+
timeout=60,
|
|
351
|
+
check=True,
|
|
352
|
+
)
|
|
353
|
+
return True
|
|
354
|
+
except subprocess.TimeoutExpired:
|
|
355
|
+
logger.info(f"Attempt {attempt + 1} timed out")
|
|
356
|
+
time.sleep(random.randrange(5, 15))
|
|
357
|
+
except subprocess.CalledProcessError as e:
|
|
358
|
+
attempts_left = 3 - attempt
|
|
359
|
+
retry_msg = (
|
|
360
|
+
f" Retrying... ({attempts_left} attempts left)"
|
|
361
|
+
if attempts_left > 0
|
|
362
|
+
else ""
|
|
363
|
+
)
|
|
364
|
+
logger.info(f"The process failed to execute. Details: {e}.{retry_msg}")
|
|
365
|
+
time.sleep(random.randrange(5, 15))
|
|
366
|
+
finally:
|
|
367
|
+
os.chdir(original_dir)
|
|
368
|
+
pass
|
|
369
|
+
return False
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: litellm-proxy-extras
|
|
3
|
+
Version: 0.4.3
|
|
4
|
+
Summary: Additional files for the LiteLLM Proxy. Reduces the size of the main litellm package.
|
|
5
|
+
License-File: LICENSE
|
|
6
|
+
Author: BerriAI
|
|
7
|
+
Requires-Python: >=3.8, !=2.7.*, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, !=3.5.*, !=3.6.*, !=3.7.*
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Project-URL: Documentation, https://docs.litellm.ai
|
|
16
|
+
Project-URL: Homepage, https://litellm.ai
|
|
17
|
+
Project-URL: Repository, https://github.com/BerriAI/litellm
|
|
18
|
+
Project-URL: documentation, https://docs.litellm.ai
|
|
19
|
+
Project-URL: homepage, https://litellm.ai
|
|
20
|
+
Project-URL: repository, https://github.com/BerriAI/litellm
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
Additional files for the proxy. Reduces the size of the main litellm package.
|
|
24
|
+
|
|
25
|
+
Currently, only stores the migration.sql files for litellm-proxy.
|
|
26
|
+
|
|
27
|
+
To install, run:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install litellm-proxy-extras
|
|
31
|
+
```
|
|
32
|
+
OR
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
pip install litellm[proxy] # installs litellm-proxy-extras and other proxy dependencies
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
To use the migrations, run:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
litellm --use_prisma_migrate
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
litellm_proxy_extras/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
litellm_proxy_extras/_logging.py,sha256=7KoWerTOol5IPNyNdbZvLuSlpQbEGE235VgzwpgafKQ,393
|
|
3
|
+
litellm_proxy_extras/migrations/20250326162113_baseline/migration.sql,sha256=9aRWmBbLf7EWbCMXifDl5zL9bAw0uPXJut1AXNKrSTE,13383
|
|
4
|
+
litellm_proxy_extras/migrations/20250326171002_add_daily_user_table/migration.sql,sha256=dY-dNCLosWmXNli2B9wqX4hZpp3s0DL3IwEPtTTC134,1179
|
|
5
|
+
litellm_proxy_extras/migrations/20250327180120_add_api_requests_to_daily_user_table/migration.sql,sha256=or5TaEgH4cHwR5kDvVjZvcAj1OwzTxjqwO-lxXe3FXk,110
|
|
6
|
+
litellm_proxy_extras/migrations/20250329084805_new_cron_job_table/migration.sql,sha256=eZNDwrzKtWFXkTqOKb9JS4hzum1dI-VTXvMqzhryfxc,404
|
|
7
|
+
litellm_proxy_extras/migrations/20250331215456_track_success_and_failed_requests_daily_agg_table/migration.sql,sha256=tyeLY6u8KFyw71osCBM-sdjhIgvHoFCK88cIx8dExNY,178
|
|
8
|
+
litellm_proxy_extras/migrations/20250411215431_add_managed_file_table/migration.sql,sha256=Yu2K37Q90LDhxsFo_64sH0PXdSQ3sHs45Lqzxv2t_20,625
|
|
9
|
+
litellm_proxy_extras/migrations/20250412081753_team_member_permissions/migration.sql,sha256=v3vDx5lb6SLCzXCe_A2NZj7zzmucRXM08aQun_G_MkE,120
|
|
10
|
+
litellm_proxy_extras/migrations/20250415151647_add_cache_read_write_tokens_daily_spend_transactions/migration.sql,sha256=pXUhTLpyXLhGaDnT-epbyW-YSdmO1z5_dxOsETD53Os,194
|
|
11
|
+
litellm_proxy_extras/migrations/20250415191926_add_daily_team_table/migration.sql,sha256=M8DFQOxIPjGcJXIswfHQs2LBTFdJyQBpRbpOT5RIHmw,1330
|
|
12
|
+
litellm_proxy_extras/migrations/20250416115320_add_tag_table_to_db/migration.sql,sha256=meXcoLzZI8-huUGfeJxB9bcOFLTC83mlnpN5LvYbd7I,1720
|
|
13
|
+
litellm_proxy_extras/migrations/20250416151339_drop_tag_uniqueness_requirement/migration.sql,sha256=ezPzK5yd-RDziBLt6X-BEoWYmNYHUublg19OobGuuEs,58
|
|
14
|
+
litellm_proxy_extras/migrations/20250416185146_add_allowed_routes_litellm_verification_token/migration.sql,sha256=XGyDLGakqBt30xuGS-RT5tWhk_Ki7teenxpvKDkIo2E,119
|
|
15
|
+
litellm_proxy_extras/migrations/20250425182129_add_session_id/migration.sql,sha256=dSjU5QavHMM60siy6f_69DZpFCA4lUfWDL0AUEPEt2g,139
|
|
16
|
+
litellm_proxy_extras/migrations/20250430193429_add_managed_vector_stores/migration.sql,sha256=SmXedKWYWwYAZjg-usw-905nXxyU9SOws9teFATezUA,479
|
|
17
|
+
litellm_proxy_extras/migrations/20250507161526_add_mcp_table_to_db/migration.sql,sha256=C_0iU6F-XUST0BekRSrFGMW69_pwBLSS7Pu5HvGNJ7c,511
|
|
18
|
+
litellm_proxy_extras/migrations/20250507161527_add_health_check_fields_to_mcp_servers/migration.sql,sha256=IzXvP90W4R1vkrsP3WbARJdGLEFauW1e2czTmZaDYOM,285
|
|
19
|
+
litellm_proxy_extras/migrations/20250507184818_add_mcp_key_team_permission_mgmt/migration.sql,sha256=G2NONS9XAMDdkH-0tpaPimK4ezs94hkwteRK1m7oA1Y,1672
|
|
20
|
+
litellm_proxy_extras/migrations/20250508072103_add_status_to_spendlogs/migration.sql,sha256=V4mIhoi3n8sUzV8_YY9AA_wkgvk65m5ZOAU3_DtoUo8,77
|
|
21
|
+
litellm_proxy_extras/migrations/20250509141545_use_big_int_for_daily_spend_tables/migration.sql,sha256=UPaAXsryGvVZT_SnOf-1yHu5bKPTVr2gP3zY64FKR7o,1331
|
|
22
|
+
litellm_proxy_extras/migrations/20250510142544_add_session_id_index_spend_logs/migration.sql,sha256=M_y4xLnlGApiUIovLv0xA7lL5gJBZWrcFe7b5MSUOik,102
|
|
23
|
+
litellm_proxy_extras/migrations/20250514142245_add_guardrails_table/migration.sql,sha256=mxBhXoedxkabrkn7YPiKn-OVmoXh6RsSEXY9a0-FkQk,506
|
|
24
|
+
litellm_proxy_extras/migrations/20250522223020_managed_object_table/migration.sql,sha256=SbchBsESJa8M5O4R1iqvfgssX5StSrL85Umd2Drns_Y,1185
|
|
25
|
+
litellm_proxy_extras/migrations/20250526154401_allow_null_entity_id/migration.sql,sha256=O9C3_XMaHS5Dqu_DRtym89bhspAieSQiQpxK1MTQZgQ,265
|
|
26
|
+
litellm_proxy_extras/migrations/20250528185438_add_vector_stores_to_object_permissions/migration.sql,sha256=CMoueiGIy2-_7Ik7ktzGCRPfhBH43Y7nJkAvfxcYnI0,122
|
|
27
|
+
litellm_proxy_extras/migrations/20250603210143_cascade_budget_changes/migration.sql,sha256=LMUCGnK6z6Bh_mKikp5_0Xs_EnsoPMb-dTY-sJBnXVg,332
|
|
28
|
+
litellm_proxy_extras/migrations/20250618225828_add_health_check_table/migration.sql,sha256=FpLvgnxHKp3Jb-USx-EWOGeVCXDpSznGBloqlWAm9bg,980
|
|
29
|
+
litellm_proxy_extras/migrations/20250625145206_cascade_budget_and_loosen_managed_file_json/migration.sql,sha256=AjRZvl6dlMp9YRosTy0Iaa6ZqMXAydFY7FlzOp-T09I,429
|
|
30
|
+
litellm_proxy_extras/migrations/20250625213625_add_status_to_managed_object_table/migration.sql,sha256=XcFDSGnTIOue1laLzJL062Mv6mI2bu05KCOgrzvWQK8,86
|
|
31
|
+
litellm_proxy_extras/migrations/20250707212517_add_mcp_info_column_mcp_servers/migration.sql,sha256=2r7drloJuEDy-x9_fsQXB613YJ7gg6yIsL5MhFEv-Nk,98
|
|
32
|
+
litellm_proxy_extras/migrations/20250707230009_add_mcp_namespaced_tool_name/migration.sql,sha256=L973Q5PV5pFcpuZzyOzo6aFNK02EZK-KAHfcyjtPAIU,1854
|
|
33
|
+
litellm_proxy_extras/migrations/20250711220620_add_stdio_mcp/migration.sql,sha256=t3telBGnxzo8kXQYnyR69vgxcPYf9ysoWt1ySRHnJgE,381
|
|
34
|
+
litellm_proxy_extras/migrations/20250718125714_add_litellm_params_to_vector_stores/migration.sql,sha256=yZfez4-HKbZeRQs4E6QhrMA7wuyrBQrYzTrW9S1HwcY,101
|
|
35
|
+
litellm_proxy_extras/migrations/20250802162330_prompt_table/migration.sql,sha256=rssp_rCzwY5veFUJeGSOoGOvck3IZ9sL86RuHzQJ-s0,452
|
|
36
|
+
litellm_proxy_extras/migrations/20250806095134_rename_alias_to_server_name_mcp_table/migration.sql,sha256=Bge3bWO96jFhVzdjHX5sD7SzCLnrrYMq_6ilzJFAQ6w,465
|
|
37
|
+
litellm_proxy_extras/migrations/20250918083359_drop_spec_version_column_from_mcp_table/migration.sql,sha256=hmAt0uvPXq9Nvtf92HqRhrGTcBxEFWwxOjsG2zTCtg4,231
|
|
38
|
+
litellm_proxy_extras/migrations/20250926194702_unnamed_migration/migration.sql,sha256=YCdSPn3yPse6HoZGW9lFEqy49xOf4yuJH_qrf8lrJIE,294
|
|
39
|
+
litellm_proxy_extras/migrations/20251003165142_add_allowed_tools_to_mcp/migration.sql,sha256=D8olxfIAbERAzYLI6ldT40KUB_3t9CeRgl4n2DT45lU,115
|
|
40
|
+
litellm_proxy_extras/migrations/20251003190954_extra_headers_to_mcp_table/migration.sql,sha256=TEi08V1ZQAondOxdSIP6MAU2P5nueSpVvhtmdoSGp-c,115
|
|
41
|
+
litellm_proxy_extras/migrations/20251006143948_add_mcp_tool_permissions/migration.sql,sha256=RFISpCSAb9YawwQHBdkap9RBn-NrBcmhflOTyUJuljk,104
|
|
42
|
+
litellm_proxy_extras/migrations/20251011084309_add_tag_table/migration.sql,sha256=z1fiUODOMNByeSMzIBgs3Ee0DuDBVwJBJEZQV8eNXVk,653
|
|
43
|
+
litellm_proxy_extras/migrations/20251023141814_add_search_tool_table/migration.sql,sha256=QxY8HNjo14DQWFRtlpBtgxaUnI4BeRD6PNiAWbT6Mf8,522
|
|
44
|
+
litellm_proxy_extras/migrations/20251031181430_add_cache_config_table/migration.sql,sha256=Aby9tvl07fvWgqwGpkBh_m0HbAwrCAPWOPIEjND6iGg,608
|
|
45
|
+
litellm_proxy_extras/migrations/20251101131415_add_managed_vector_store_index_table/migration.sql,sha256=Eo99s-lpTp4UnoCl2NeGRmstxEgwj_u-s2JVwGYSMEc,568
|
|
46
|
+
litellm_proxy_extras/migrations/20251103072422_add_static_headers/migration.sql,sha256=3phneHvQ4anZV_w3rpF_hF0AW3XJ5-iRHrANvjagD6Y,103
|
|
47
|
+
litellm_proxy_extras/migrations/20251104220043_add_credentials_to_mcp_servers/migration.sql,sha256=YSO0G5D8Rn6Cpzm2qwLEAXCkeoDGNgJfgKHJpSRcuyE,100
|
|
48
|
+
litellm_proxy_extras/migrations/migration_lock.toml,sha256=HbF6jQUaoTYRBzZ1LF4fi37ZK26o6AMRL7viSXBHwhA,24
|
|
49
|
+
litellm_proxy_extras/schema.prisma,sha256=TomFZMY80_qEI2U21gGzH5OPwA3DA1cp1rGSz2goAGk,23252
|
|
50
|
+
litellm_proxy_extras/utils.py,sha256=2g3sHuOMy_9sjze2Kw42lBXcS6ustYBygd4vaiJ6Kkk,15679
|
|
51
|
+
litellm_proxy_extras-0.4.3.dist-info/METADATA,sha256=9U33uO2wUmRuaFRtQFDgTOc38sKy49AcXd70xMaRyFI,1390
|
|
52
|
+
litellm_proxy_extras-0.4.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
53
|
+
litellm_proxy_extras-0.4.3.dist-info/licenses/LICENSE,sha256=sXDWv46INd01fgEWgdsCj01R4vsOqJIFj1bgH7ObgnM,1419
|
|
54
|
+
litellm_proxy_extras-0.4.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
Portions of this software are licensed as follows:
|
|
2
|
+
|
|
3
|
+
* All content that resides under the "enterprise/" directory of this repository, if that directory exists, is licensed under the license defined in "enterprise/LICENSE".
|
|
4
|
+
* Content outside of the above mentioned directories or restrictions above is available under the MIT license as defined below.
|
|
5
|
+
---
|
|
6
|
+
MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2023 Berri AI
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|