litellm-proxy-extras 0.4.3__py3-none-any.whl → 0.4.12__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/migrations/20251114173537_add_request_id_to_daily_tag_spend/migration.sql +3 -0
- litellm_proxy_extras/migrations/20251114180624_Add_org_usage_table/migration.sql +42 -0
- litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql +17 -0
- litellm_proxy_extras/migrations/20251115120021_baseline_diff/migration.sql +2 -0
- litellm_proxy_extras/migrations/20251115120539_baseline_diff/migration.sql +2 -0
- litellm_proxy_extras/migrations/20251119131227_add_prompt_versioning/migration.sql +12 -0
- litellm_proxy_extras/migrations/20251122125322_Add organization_id to spend logs/migration.sql +3 -0
- litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql +42 -0
- litellm_proxy_extras/migrations/20251204142718_add_agent_permissions/migration.sql +7 -0
- litellm_proxy_extras/migrations/20251209112246_add_ui_settings_table/migration.sql +10 -0
- litellm_proxy_extras/schema.prisma +88 -1
- litellm_proxy_extras/utils.py +123 -19
- {litellm_proxy_extras-0.4.3.dist-info → litellm_proxy_extras-0.4.12.dist-info}/METADATA +1 -1
- {litellm_proxy_extras-0.4.3.dist-info → litellm_proxy_extras-0.4.12.dist-info}/RECORD +16 -6
- {litellm_proxy_extras-0.4.3.dist-info → litellm_proxy_extras-0.4.12.dist-info}/WHEEL +0 -0
- {litellm_proxy_extras-0.4.3.dist-info → litellm_proxy_extras-0.4.12.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "LiteLLM_DailyOrganizationSpend" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"organization_id" TEXT,
|
|
5
|
+
"date" TEXT NOT NULL,
|
|
6
|
+
"api_key" TEXT NOT NULL,
|
|
7
|
+
"model" TEXT,
|
|
8
|
+
"model_group" TEXT,
|
|
9
|
+
"custom_llm_provider" TEXT,
|
|
10
|
+
"mcp_namespaced_tool_name" TEXT,
|
|
11
|
+
"prompt_tokens" BIGINT NOT NULL DEFAULT 0,
|
|
12
|
+
"completion_tokens" BIGINT NOT NULL DEFAULT 0,
|
|
13
|
+
"cache_read_input_tokens" BIGINT NOT NULL DEFAULT 0,
|
|
14
|
+
"cache_creation_input_tokens" BIGINT NOT NULL DEFAULT 0,
|
|
15
|
+
"spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0,
|
|
16
|
+
"api_requests" BIGINT NOT NULL DEFAULT 0,
|
|
17
|
+
"successful_requests" BIGINT NOT NULL DEFAULT 0,
|
|
18
|
+
"failed_requests" BIGINT NOT NULL DEFAULT 0,
|
|
19
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
20
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
21
|
+
|
|
22
|
+
CONSTRAINT "LiteLLM_DailyOrganizationSpend_pkey" PRIMARY KEY ("id")
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
-- CreateIndex
|
|
26
|
+
CREATE INDEX "LiteLLM_DailyOrganizationSpend_date_idx" ON "LiteLLM_DailyOrganizationSpend"("date");
|
|
27
|
+
|
|
28
|
+
-- CreateIndex
|
|
29
|
+
CREATE INDEX "LiteLLM_DailyOrganizationSpend_organization_id_idx" ON "LiteLLM_DailyOrganizationSpend"("organization_id");
|
|
30
|
+
|
|
31
|
+
-- CreateIndex
|
|
32
|
+
CREATE INDEX "LiteLLM_DailyOrganizationSpend_api_key_idx" ON "LiteLLM_DailyOrganizationSpend"("api_key");
|
|
33
|
+
|
|
34
|
+
-- CreateIndex
|
|
35
|
+
CREATE INDEX "LiteLLM_DailyOrganizationSpend_model_idx" ON "LiteLLM_DailyOrganizationSpend"("model");
|
|
36
|
+
|
|
37
|
+
-- CreateIndex
|
|
38
|
+
CREATE INDEX "LiteLLM_DailyOrganizationSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyOrganizationSpend"("mcp_namespaced_tool_name");
|
|
39
|
+
|
|
40
|
+
-- CreateIndex
|
|
41
|
+
CREATE UNIQUE INDEX "LiteLLM_DailyOrganizationSpend_organization_id_date_api_key_key" ON "LiteLLM_DailyOrganizationSpend"("organization_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name");
|
|
42
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "LiteLLM_AgentsTable" (
|
|
3
|
+
"agent_id" TEXT NOT NULL,
|
|
4
|
+
"agent_name" TEXT NOT NULL,
|
|
5
|
+
"litellm_params" JSONB,
|
|
6
|
+
"agent_card_params" JSONB NOT NULL,
|
|
7
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
8
|
+
"created_by" TEXT NOT NULL,
|
|
9
|
+
"updated_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
10
|
+
"updated_by" TEXT NOT NULL,
|
|
11
|
+
|
|
12
|
+
CONSTRAINT "LiteLLM_AgentsTable_pkey" PRIMARY KEY ("agent_id")
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
-- CreateIndex
|
|
16
|
+
CREATE UNIQUE INDEX "LiteLLM_AgentsTable_agent_name_key" ON "LiteLLM_AgentsTable"("agent_name");
|
|
17
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- DropIndex
|
|
2
|
+
DROP INDEX "LiteLLM_PromptTable_prompt_id_key";
|
|
3
|
+
|
|
4
|
+
-- AlterTable
|
|
5
|
+
ALTER TABLE "LiteLLM_PromptTable" ADD COLUMN "version" INTEGER NOT NULL DEFAULT 1;
|
|
6
|
+
|
|
7
|
+
-- CreateIndex
|
|
8
|
+
CREATE INDEX "LiteLLM_PromptTable_prompt_id_idx" ON "LiteLLM_PromptTable"("prompt_id");
|
|
9
|
+
|
|
10
|
+
-- CreateIndex
|
|
11
|
+
CREATE UNIQUE INDEX "LiteLLM_PromptTable_prompt_id_version_key" ON "LiteLLM_PromptTable"("prompt_id", "version");
|
|
12
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "LiteLLM_DailyEndUserSpend" (
|
|
3
|
+
"id" TEXT NOT NULL,
|
|
4
|
+
"end_user_id" TEXT,
|
|
5
|
+
"date" TEXT NOT NULL,
|
|
6
|
+
"api_key" TEXT NOT NULL,
|
|
7
|
+
"model" TEXT,
|
|
8
|
+
"model_group" TEXT,
|
|
9
|
+
"custom_llm_provider" TEXT,
|
|
10
|
+
"mcp_namespaced_tool_name" TEXT,
|
|
11
|
+
"prompt_tokens" BIGINT NOT NULL DEFAULT 0,
|
|
12
|
+
"completion_tokens" BIGINT NOT NULL DEFAULT 0,
|
|
13
|
+
"cache_read_input_tokens" BIGINT NOT NULL DEFAULT 0,
|
|
14
|
+
"cache_creation_input_tokens" BIGINT NOT NULL DEFAULT 0,
|
|
15
|
+
"spend" DOUBLE PRECISION NOT NULL DEFAULT 0.0,
|
|
16
|
+
"api_requests" BIGINT NOT NULL DEFAULT 0,
|
|
17
|
+
"successful_requests" BIGINT NOT NULL DEFAULT 0,
|
|
18
|
+
"failed_requests" BIGINT NOT NULL DEFAULT 0,
|
|
19
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
20
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
21
|
+
|
|
22
|
+
CONSTRAINT "LiteLLM_DailyEndUserSpend_pkey" PRIMARY KEY ("id")
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
-- CreateIndex
|
|
26
|
+
CREATE INDEX "LiteLLM_DailyEndUserSpend_date_idx" ON "LiteLLM_DailyEndUserSpend"("date");
|
|
27
|
+
|
|
28
|
+
-- CreateIndex
|
|
29
|
+
CREATE INDEX "LiteLLM_DailyEndUserSpend_end_user_id_idx" ON "LiteLLM_DailyEndUserSpend"("end_user_id");
|
|
30
|
+
|
|
31
|
+
-- CreateIndex
|
|
32
|
+
CREATE INDEX "LiteLLM_DailyEndUserSpend_api_key_idx" ON "LiteLLM_DailyEndUserSpend"("api_key");
|
|
33
|
+
|
|
34
|
+
-- CreateIndex
|
|
35
|
+
CREATE INDEX "LiteLLM_DailyEndUserSpend_model_idx" ON "LiteLLM_DailyEndUserSpend"("model");
|
|
36
|
+
|
|
37
|
+
-- CreateIndex
|
|
38
|
+
CREATE INDEX "LiteLLM_DailyEndUserSpend_mcp_namespaced_tool_name_idx" ON "LiteLLM_DailyEndUserSpend"("mcp_namespaced_tool_name");
|
|
39
|
+
|
|
40
|
+
-- CreateIndex
|
|
41
|
+
CREATE UNIQUE INDEX "LiteLLM_DailyEndUserSpend_end_user_id_date_api_key_model_cu_key" ON "LiteLLM_DailyEndUserSpend"("end_user_id", "date", "api_key", "model", "custom_llm_provider", "mcp_namespaced_tool_name");
|
|
42
|
+
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Add agent permission fields to LiteLLM_ObjectPermissionTable
|
|
2
|
+
ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN IF NOT EXISTS "agents" TEXT[] DEFAULT ARRAY[]::TEXT[];
|
|
3
|
+
ALTER TABLE "LiteLLM_ObjectPermissionTable" ADD COLUMN IF NOT EXISTS "agent_access_groups" TEXT[] DEFAULT ARRAY[]::TEXT[];
|
|
4
|
+
|
|
5
|
+
-- Add agent_access_groups field to LiteLLM_AgentsTable
|
|
6
|
+
ALTER TABLE "LiteLLM_AgentsTable" ADD COLUMN IF NOT EXISTS "agent_access_groups" TEXT[] DEFAULT ARRAY[]::TEXT[];
|
|
7
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- CreateTable
|
|
2
|
+
CREATE TABLE "LiteLLM_UISettings" (
|
|
3
|
+
"id" TEXT NOT NULL DEFAULT 'ui_settings',
|
|
4
|
+
"ui_settings" JSONB NOT NULL,
|
|
5
|
+
"created_at" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
6
|
+
"updated_at" TIMESTAMP(3) NOT NULL,
|
|
7
|
+
|
|
8
|
+
CONSTRAINT "LiteLLM_UISettings_pkey" PRIMARY KEY ("id")
|
|
9
|
+
);
|
|
10
|
+
|
|
@@ -54,6 +54,20 @@ model LiteLLM_ProxyModelTable {
|
|
|
54
54
|
updated_by String
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
|
|
58
|
+
// Agents on proxy
|
|
59
|
+
model LiteLLM_AgentsTable {
|
|
60
|
+
agent_id String @id @default(uuid())
|
|
61
|
+
agent_name String @unique
|
|
62
|
+
litellm_params Json?
|
|
63
|
+
agent_card_params Json
|
|
64
|
+
agent_access_groups String[] @default([])
|
|
65
|
+
created_at DateTime @default(now()) @map("created_at")
|
|
66
|
+
created_by String
|
|
67
|
+
updated_at DateTime @default(now()) @updatedAt @map("updated_at")
|
|
68
|
+
updated_by String
|
|
69
|
+
}
|
|
70
|
+
|
|
57
71
|
model LiteLLM_OrganizationTable {
|
|
58
72
|
organization_id String @id @default(uuid())
|
|
59
73
|
organization_alias String
|
|
@@ -159,6 +173,8 @@ model LiteLLM_ObjectPermissionTable {
|
|
|
159
173
|
mcp_access_groups String[] @default([])
|
|
160
174
|
mcp_tool_permissions Json? // Tool-level permissions for MCP servers. Format: {"server_id": ["tool_name_1", "tool_name_2"]}
|
|
161
175
|
vector_stores String[] @default([])
|
|
176
|
+
agents String[] @default([])
|
|
177
|
+
agent_access_groups String[] @default([])
|
|
162
178
|
teams LiteLLM_TeamTable[]
|
|
163
179
|
verification_tokens LiteLLM_VerificationToken[]
|
|
164
180
|
organizations LiteLLM_OrganizationTable[]
|
|
@@ -291,6 +307,7 @@ model LiteLLM_SpendLogs {
|
|
|
291
307
|
cache_key String? @default("")
|
|
292
308
|
request_tags Json? @default("[]")
|
|
293
309
|
team_id String?
|
|
310
|
+
organization_id String?
|
|
294
311
|
end_user String?
|
|
295
312
|
requester_ip_address String?
|
|
296
313
|
messages Json? @default("{}")
|
|
@@ -419,6 +436,63 @@ model LiteLLM_DailyUserSpend {
|
|
|
419
436
|
@@index([mcp_namespaced_tool_name])
|
|
420
437
|
}
|
|
421
438
|
|
|
439
|
+
// Track daily organization spend metrics per model and key
|
|
440
|
+
model LiteLLM_DailyOrganizationSpend {
|
|
441
|
+
id String @id @default(uuid())
|
|
442
|
+
organization_id String?
|
|
443
|
+
date String
|
|
444
|
+
api_key String
|
|
445
|
+
model String?
|
|
446
|
+
model_group String?
|
|
447
|
+
custom_llm_provider String?
|
|
448
|
+
mcp_namespaced_tool_name String?
|
|
449
|
+
prompt_tokens BigInt @default(0)
|
|
450
|
+
completion_tokens BigInt @default(0)
|
|
451
|
+
cache_read_input_tokens BigInt @default(0)
|
|
452
|
+
cache_creation_input_tokens BigInt @default(0)
|
|
453
|
+
spend Float @default(0.0)
|
|
454
|
+
api_requests BigInt @default(0)
|
|
455
|
+
successful_requests BigInt @default(0)
|
|
456
|
+
failed_requests BigInt @default(0)
|
|
457
|
+
created_at DateTime @default(now())
|
|
458
|
+
updated_at DateTime @updatedAt
|
|
459
|
+
|
|
460
|
+
@@unique([organization_id, date, api_key, model, custom_llm_provider, mcp_namespaced_tool_name])
|
|
461
|
+
@@index([date])
|
|
462
|
+
@@index([organization_id])
|
|
463
|
+
@@index([api_key])
|
|
464
|
+
@@index([model])
|
|
465
|
+
@@index([mcp_namespaced_tool_name])
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// Track daily end user (customer) spend metrics per model and key
|
|
469
|
+
model LiteLLM_DailyEndUserSpend {
|
|
470
|
+
id String @id @default(uuid())
|
|
471
|
+
end_user_id String?
|
|
472
|
+
date String
|
|
473
|
+
api_key String
|
|
474
|
+
model String?
|
|
475
|
+
model_group String?
|
|
476
|
+
custom_llm_provider String?
|
|
477
|
+
mcp_namespaced_tool_name String?
|
|
478
|
+
prompt_tokens BigInt @default(0)
|
|
479
|
+
completion_tokens BigInt @default(0)
|
|
480
|
+
cache_read_input_tokens BigInt @default(0)
|
|
481
|
+
cache_creation_input_tokens BigInt @default(0)
|
|
482
|
+
spend Float @default(0.0)
|
|
483
|
+
api_requests BigInt @default(0)
|
|
484
|
+
successful_requests BigInt @default(0)
|
|
485
|
+
failed_requests BigInt @default(0)
|
|
486
|
+
created_at DateTime @default(now())
|
|
487
|
+
updated_at DateTime @updatedAt
|
|
488
|
+
@@unique([end_user_id, date, api_key, model, custom_llm_provider, mcp_namespaced_tool_name])
|
|
489
|
+
@@index([date])
|
|
490
|
+
@@index([end_user_id])
|
|
491
|
+
@@index([api_key])
|
|
492
|
+
@@index([model])
|
|
493
|
+
@@index([mcp_namespaced_tool_name])
|
|
494
|
+
}
|
|
495
|
+
|
|
422
496
|
// Track daily team spend metrics per model and key
|
|
423
497
|
model LiteLLM_DailyTeamSpend {
|
|
424
498
|
id String @id @default(uuid())
|
|
@@ -451,6 +525,7 @@ model LiteLLM_DailyTeamSpend {
|
|
|
451
525
|
// Track daily team spend metrics per model and key
|
|
452
526
|
model LiteLLM_DailyTagSpend {
|
|
453
527
|
id String @id @default(uuid())
|
|
528
|
+
request_id String?
|
|
454
529
|
tag String?
|
|
455
530
|
date String
|
|
456
531
|
api_key String
|
|
@@ -547,11 +622,15 @@ model LiteLLM_GuardrailsTable {
|
|
|
547
622
|
// Prompt table for storing prompt configurations
|
|
548
623
|
model LiteLLM_PromptTable {
|
|
549
624
|
id String @id @default(uuid())
|
|
550
|
-
prompt_id String
|
|
625
|
+
prompt_id String
|
|
626
|
+
version Int @default(1)
|
|
551
627
|
litellm_params Json
|
|
552
628
|
prompt_info Json?
|
|
553
629
|
created_at DateTime @default(now())
|
|
554
630
|
updated_at DateTime @updatedAt
|
|
631
|
+
|
|
632
|
+
@@unique([prompt_id, version])
|
|
633
|
+
@@index([prompt_id])
|
|
555
634
|
}
|
|
556
635
|
|
|
557
636
|
model LiteLLM_HealthCheckTable {
|
|
@@ -610,3 +689,11 @@ model LiteLLM_CacheConfig {
|
|
|
610
689
|
created_at DateTime @default(now())
|
|
611
690
|
updated_at DateTime @updatedAt
|
|
612
691
|
}
|
|
692
|
+
|
|
693
|
+
// UI Settings configuration table
|
|
694
|
+
model LiteLLM_UISettings {
|
|
695
|
+
id String @id @default("ui_settings")
|
|
696
|
+
ui_settings Json
|
|
697
|
+
created_at DateTime @default(now())
|
|
698
|
+
updated_at DateTime @updatedAt
|
|
699
|
+
}
|
litellm_proxy_extras/utils.py
CHANGED
|
@@ -130,6 +130,60 @@ class ProxyExtrasDBManager:
|
|
|
130
130
|
capture_output=True,
|
|
131
131
|
)
|
|
132
132
|
|
|
133
|
+
@staticmethod
|
|
134
|
+
def _is_permission_error(error_message: str) -> bool:
|
|
135
|
+
"""
|
|
136
|
+
Check if the error message indicates a database permission error.
|
|
137
|
+
|
|
138
|
+
Permission errors should NOT be marked as applied, as the migration
|
|
139
|
+
did not actually execute successfully.
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
error_message: The error message from Prisma migrate
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
bool: True if this is a permission error, False otherwise
|
|
146
|
+
"""
|
|
147
|
+
permission_patterns = [
|
|
148
|
+
r"Database error code: 42501", # PostgreSQL insufficient privilege
|
|
149
|
+
r"must be owner of table",
|
|
150
|
+
r"permission denied for schema",
|
|
151
|
+
r"permission denied for table",
|
|
152
|
+
r"must be owner of schema",
|
|
153
|
+
]
|
|
154
|
+
|
|
155
|
+
for pattern in permission_patterns:
|
|
156
|
+
if re.search(pattern, error_message, re.IGNORECASE):
|
|
157
|
+
return True
|
|
158
|
+
return False
|
|
159
|
+
|
|
160
|
+
@staticmethod
|
|
161
|
+
def _is_idempotent_error(error_message: str) -> bool:
|
|
162
|
+
"""
|
|
163
|
+
Check if the error message indicates an idempotent operation error.
|
|
164
|
+
|
|
165
|
+
Idempotent errors (like "column already exists") mean the migration
|
|
166
|
+
has effectively already been applied, so it's safe to mark as applied.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
error_message: The error message from Prisma migrate
|
|
170
|
+
|
|
171
|
+
Returns:
|
|
172
|
+
bool: True if this is an idempotent error, False otherwise
|
|
173
|
+
"""
|
|
174
|
+
idempotent_patterns = [
|
|
175
|
+
r"already exists",
|
|
176
|
+
r"column .* already exists",
|
|
177
|
+
r"duplicate key value violates",
|
|
178
|
+
r"relation .* already exists",
|
|
179
|
+
r"constraint .* already exists",
|
|
180
|
+
]
|
|
181
|
+
|
|
182
|
+
for pattern in idempotent_patterns:
|
|
183
|
+
if re.search(pattern, error_message, re.IGNORECASE):
|
|
184
|
+
return True
|
|
185
|
+
return False
|
|
186
|
+
|
|
133
187
|
@staticmethod
|
|
134
188
|
def _resolve_all_migrations(
|
|
135
189
|
migrations_dir: str, schema_path: str, mark_all_applied: bool = True
|
|
@@ -320,29 +374,79 @@ class ProxyExtrasDBManager:
|
|
|
320
374
|
)
|
|
321
375
|
logger.info("✅ All migrations resolved.")
|
|
322
376
|
return True
|
|
323
|
-
elif
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
377
|
+
elif "P3018" in e.stderr:
|
|
378
|
+
# Check if this is a permission error or idempotent error
|
|
379
|
+
if ProxyExtrasDBManager._is_permission_error(e.stderr):
|
|
380
|
+
# Permission errors should NOT be marked as applied
|
|
381
|
+
# Extract migration name for logging
|
|
382
|
+
migration_match = re.search(
|
|
383
|
+
r"Migration name: (\d+_.*)", e.stderr
|
|
384
|
+
)
|
|
385
|
+
migration_name = (
|
|
386
|
+
migration_match.group(1)
|
|
387
|
+
if migration_match
|
|
388
|
+
else "unknown"
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
logger.error(
|
|
392
|
+
f"❌ Migration {migration_name} failed due to insufficient permissions. "
|
|
393
|
+
f"Please check database user privileges. Error: {e.stderr}"
|
|
338
394
|
)
|
|
395
|
+
|
|
396
|
+
# Mark as rolled back and exit with error
|
|
397
|
+
if migration_match:
|
|
398
|
+
try:
|
|
399
|
+
ProxyExtrasDBManager._roll_back_migration(
|
|
400
|
+
migration_name
|
|
401
|
+
)
|
|
402
|
+
logger.info(
|
|
403
|
+
f"Migration {migration_name} marked as rolled back"
|
|
404
|
+
)
|
|
405
|
+
except Exception as rollback_error:
|
|
406
|
+
logger.warning(
|
|
407
|
+
f"Failed to mark migration as rolled back: {rollback_error}"
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
# Re-raise the error to prevent silent failures
|
|
411
|
+
raise RuntimeError(
|
|
412
|
+
f"Migration failed due to permission error. Migration {migration_name} "
|
|
413
|
+
f"was NOT applied. Please grant necessary database permissions and retry."
|
|
414
|
+
) from e
|
|
415
|
+
|
|
416
|
+
elif ProxyExtrasDBManager._is_idempotent_error(e.stderr):
|
|
417
|
+
# Idempotent errors mean the migration has effectively been applied
|
|
339
418
|
logger.info(
|
|
340
|
-
|
|
419
|
+
"Migration failed due to idempotent error (e.g., column already exists), "
|
|
420
|
+
"resolving as applied"
|
|
421
|
+
)
|
|
422
|
+
# Extract the migration name from the error message
|
|
423
|
+
migration_match = re.search(
|
|
424
|
+
r"Migration name: (\d+_.*)", e.stderr
|
|
341
425
|
)
|
|
342
|
-
|
|
343
|
-
migration_name
|
|
426
|
+
if migration_match:
|
|
427
|
+
migration_name = migration_match.group(1)
|
|
428
|
+
logger.info(
|
|
429
|
+
f"Rolling back migration {migration_name}"
|
|
430
|
+
)
|
|
431
|
+
ProxyExtrasDBManager._roll_back_migration(
|
|
432
|
+
migration_name
|
|
433
|
+
)
|
|
434
|
+
logger.info(
|
|
435
|
+
f"Resolving migration {migration_name} that failed "
|
|
436
|
+
f"due to existing schema objects"
|
|
437
|
+
)
|
|
438
|
+
ProxyExtrasDBManager._resolve_specific_migration(
|
|
439
|
+
migration_name
|
|
440
|
+
)
|
|
441
|
+
logger.info("✅ Migration resolved.")
|
|
442
|
+
else:
|
|
443
|
+
# Unknown P3018 error - log and re-raise for safety
|
|
444
|
+
logger.warning(
|
|
445
|
+
f"P3018 error encountered but could not classify "
|
|
446
|
+
f"as permission or idempotent error. "
|
|
447
|
+
f"Error: {e.stderr}"
|
|
344
448
|
)
|
|
345
|
-
|
|
449
|
+
raise
|
|
346
450
|
else:
|
|
347
451
|
# Use prisma db push with increased timeout
|
|
348
452
|
subprocess.run(
|
|
@@ -45,10 +45,20 @@ litellm_proxy_extras/migrations/20251031181430_add_cache_config_table/migration.
|
|
|
45
45
|
litellm_proxy_extras/migrations/20251101131415_add_managed_vector_store_index_table/migration.sql,sha256=Eo99s-lpTp4UnoCl2NeGRmstxEgwj_u-s2JVwGYSMEc,568
|
|
46
46
|
litellm_proxy_extras/migrations/20251103072422_add_static_headers/migration.sql,sha256=3phneHvQ4anZV_w3rpF_hF0AW3XJ5-iRHrANvjagD6Y,103
|
|
47
47
|
litellm_proxy_extras/migrations/20251104220043_add_credentials_to_mcp_servers/migration.sql,sha256=YSO0G5D8Rn6Cpzm2qwLEAXCkeoDGNgJfgKHJpSRcuyE,100
|
|
48
|
+
litellm_proxy_extras/migrations/20251114173537_add_request_id_to_daily_tag_spend/migration.sql,sha256=q6Zp_CGufHtyOAOSUJWW31oodp-SGe36-kvRcTrP02E,85
|
|
49
|
+
litellm_proxy_extras/migrations/20251114180624_Add_org_usage_table/migration.sql,sha256=X4WVI9Qylj2lMcnbBwRdX0_6NZ3PoS8p0NeQwswBAQQ,1766
|
|
50
|
+
litellm_proxy_extras/migrations/20251114182247_agents_table/migration.sql,sha256=h6QGcRFQtaKypSk-Oam9jCH9LGPIQV8E7qEgM99XncM,563
|
|
51
|
+
litellm_proxy_extras/migrations/20251115120021_baseline_diff/migration.sql,sha256=5pyfIb4rU3cLE-pSv2xPMEqfyGtB8ekycp7C3kVXQ0E,32
|
|
52
|
+
litellm_proxy_extras/migrations/20251115120539_baseline_diff/migration.sql,sha256=5pyfIb4rU3cLE-pSv2xPMEqfyGtB8ekycp7C3kVXQ0E,32
|
|
53
|
+
litellm_proxy_extras/migrations/20251119131227_add_prompt_versioning/migration.sql,sha256=b3fhyeEdCwLyqJyJR3C2kTFAhSOZA_LNy_AkdsNycKw,398
|
|
54
|
+
litellm_proxy_extras/migrations/20251122125322_Add organization_id to spend logs/migration.sql,sha256=Oq3VvAe4YNWi9oDYTr3lHvn0sfsZS9OgQEURes6qB8s,86
|
|
55
|
+
litellm_proxy_extras/migrations/20251204124859_add_end_user_spend_table/migration.sql,sha256=p4NvUw9ayPIMPD1xS5ecS34Hg2L6tGQJwFIYUuA1NDc,1685
|
|
56
|
+
litellm_proxy_extras/migrations/20251204142718_add_agent_permissions/migration.sql,sha256=hgODk8jrr3u2DfBd-nAkoX_owDqn-shYvqr48H7HU7w,470
|
|
57
|
+
litellm_proxy_extras/migrations/20251209112246_add_ui_settings_table/migration.sql,sha256=tH1MsUdt3xO0TNQU9iUfqT4TnanDqmiik-2IP8o4ID4,302
|
|
48
58
|
litellm_proxy_extras/migrations/migration_lock.toml,sha256=HbF6jQUaoTYRBzZ1LF4fi37ZK26o6AMRL7viSXBHwhA,24
|
|
49
|
-
litellm_proxy_extras/schema.prisma,sha256=
|
|
50
|
-
litellm_proxy_extras/utils.py,sha256=
|
|
51
|
-
litellm_proxy_extras-0.4.
|
|
52
|
-
litellm_proxy_extras-0.4.
|
|
53
|
-
litellm_proxy_extras-0.4.
|
|
54
|
-
litellm_proxy_extras-0.4.
|
|
59
|
+
litellm_proxy_extras/schema.prisma,sha256=kQt-1aWEXn-dQaRmsvFMNX3I0Ho1Bci1qQTnqcOblY8,26231
|
|
60
|
+
litellm_proxy_extras/utils.py,sha256=4SDTfQA1EqIHHxxTQVUbWNocT-v6YY6Gz11hVy6IV4Q,20575
|
|
61
|
+
litellm_proxy_extras-0.4.12.dist-info/METADATA,sha256=S5M8soJOAmFfto2P7W_dA3Zu6CfHIZzGYzyd4Ra81lM,1391
|
|
62
|
+
litellm_proxy_extras-0.4.12.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
63
|
+
litellm_proxy_extras-0.4.12.dist-info/licenses/LICENSE,sha256=sXDWv46INd01fgEWgdsCj01R4vsOqJIFj1bgH7ObgnM,1419
|
|
64
|
+
litellm_proxy_extras-0.4.12.dist-info/RECORD,,
|
|
File without changes
|
{litellm_proxy_extras-0.4.3.dist-info → litellm_proxy_extras-0.4.12.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|