From 62bb7d6605a4e5a26734f203505c0bb06e0ea430 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 07:48:33 -0700 Subject: [PATCH 01/14] add vertex gemini-2.0-flash-lite --- ...odel_prices_and_context_window_backup.json | 22 +++++++++++++++++++ model_prices_and_context_window.json | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 3124ae26975..82691f3c995 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -4595,6 +4595,28 @@ "source": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models#gemini-2.0-flash", "supports_tool_choice": true }, + "gemini-2.0-flash-lite": { + "max_input_tokens": 1048576, + "max_output_tokens": 8192, + "max_images_per_prompt": 3000, + "max_videos_per_prompt": 10, + "max_video_length": 1, + "max_audio_length_hours": 8.4, + "max_audio_per_prompt": 1, + "max_pdf_size_mb": 50, + "input_cost_per_audio_token": 0.000000075, + "input_cost_per_token": 0.000000075, + "output_cost_per_token": 0.0000003, + "litellm_provider": "vertex_ai-language-models", + "mode": "chat", + "supports_system_messages": true, + "supports_function_calling": true, + "supports_vision": true, + "supports_response_schema": true, + "supports_audio_output": true, + "source": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models#gemini-2.0-flash", + "supports_tool_choice": true + }, "gemini/gemini-2.0-pro-exp-02-05": { "max_tokens": 8192, "max_input_tokens": 2097152, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 3124ae26975..82691f3c995 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -4595,6 +4595,28 @@ "source": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models#gemini-2.0-flash", "supports_tool_choice": true }, + "gemini-2.0-flash-lite": { + "max_input_tokens": 1048576, + "max_output_tokens": 8192, + "max_images_per_prompt": 3000, + "max_videos_per_prompt": 10, + "max_video_length": 1, + "max_audio_length_hours": 8.4, + "max_audio_per_prompt": 1, + "max_pdf_size_mb": 50, + "input_cost_per_audio_token": 0.000000075, + "input_cost_per_token": 0.000000075, + "output_cost_per_token": 0.0000003, + "litellm_provider": "vertex_ai-language-models", + "mode": "chat", + "supports_system_messages": true, + "supports_function_calling": true, + "supports_vision": true, + "supports_response_schema": true, + "supports_audio_output": true, + "source": "https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models#gemini-2.0-flash", + "supports_tool_choice": true + }, "gemini/gemini-2.0-pro-exp-02-05": { "max_tokens": 8192, "max_input_tokens": 2097152, From 0af9a5e8d007563d6db79171f802ae10876515a4 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 07:51:42 -0700 Subject: [PATCH 02/14] add gemini/gemini-2.0-flash-lite --- ...odel_prices_and_context_window_backup.json | 22 +++++++++++++++++++ model_prices_and_context_window.json | 22 +++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index 82691f3c995..a098e8bd7d3 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -4680,6 +4680,28 @@ "supports_tool_choice": true, "source": "https://ai.google.dev/pricing#2_0flash" }, + "gemini/gemini-2.0-flash-lite": { + "max_input_tokens": 1048576, + "max_output_tokens": 8192, + "max_images_per_prompt": 3000, + "max_videos_per_prompt": 10, + "max_video_length": 1, + "max_audio_length_hours": 8.4, + "max_audio_per_prompt": 1, + "max_pdf_size_mb": 50, + "input_cost_per_audio_token": 0.000000075, + "input_cost_per_token": 0.000000075, + "output_cost_per_token": 0.0000003, + "litellm_provider": "gemini", + "mode": "chat", + "supports_system_messages": true, + "supports_function_calling": true, + "supports_vision": true, + "supports_response_schema": true, + "supports_audio_output": true, + "supports_tool_choice": true, + "source": "https://ai.google.dev/gemini-api/docs/pricing#gemini-2.0-flash-lite", + }, "gemini/gemini-2.0-flash-001": { "max_tokens": 8192, "max_input_tokens": 1048576, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index 82691f3c995..a098e8bd7d3 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -4680,6 +4680,28 @@ "supports_tool_choice": true, "source": "https://ai.google.dev/pricing#2_0flash" }, + "gemini/gemini-2.0-flash-lite": { + "max_input_tokens": 1048576, + "max_output_tokens": 8192, + "max_images_per_prompt": 3000, + "max_videos_per_prompt": 10, + "max_video_length": 1, + "max_audio_length_hours": 8.4, + "max_audio_per_prompt": 1, + "max_pdf_size_mb": 50, + "input_cost_per_audio_token": 0.000000075, + "input_cost_per_token": 0.000000075, + "output_cost_per_token": 0.0000003, + "litellm_provider": "gemini", + "mode": "chat", + "supports_system_messages": true, + "supports_function_calling": true, + "supports_vision": true, + "supports_response_schema": true, + "supports_audio_output": true, + "supports_tool_choice": true, + "source": "https://ai.google.dev/gemini-api/docs/pricing#gemini-2.0-flash-lite", + }, "gemini/gemini-2.0-flash-001": { "max_tokens": 8192, "max_input_tokens": 1048576, From 1a58e8bfe5bfbc306d48a8a6928723f7fb4d7938 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 25 Mar 2025 12:25:16 -0700 Subject: [PATCH 03/14] docs(admin_ui_sso.md): add logout url --- docs/my-website/docs/proxy/admin_ui_sso.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/my-website/docs/proxy/admin_ui_sso.md b/docs/my-website/docs/proxy/admin_ui_sso.md index b7f8ddd585e..36a97add4b5 100644 --- a/docs/my-website/docs/proxy/admin_ui_sso.md +++ b/docs/my-website/docs/proxy/admin_ui_sso.md @@ -147,6 +147,10 @@ Some SSO providers require a specific redirect url for login and logout. You can - Login: `/sso/key/generate` - Logout: `` +```bash +PROXY_LOGOUT_URL="https://www.google.com" +``` + #### Step 3. Set `PROXY_BASE_URL` in your .env Set this in your .env (so the proxy can set the correct redirect url) From e8c4cd8c1af9532ea259951b3b15d1d111be733c Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 25 Mar 2025 12:25:42 -0700 Subject: [PATCH 04/14] docs: cleanup docs --- docs/my-website/docs/proxy/admin_ui_sso.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/my-website/docs/proxy/admin_ui_sso.md b/docs/my-website/docs/proxy/admin_ui_sso.md index 36a97add4b5..882e3df0b22 100644 --- a/docs/my-website/docs/proxy/admin_ui_sso.md +++ b/docs/my-website/docs/proxy/admin_ui_sso.md @@ -147,6 +147,7 @@ Some SSO providers require a specific redirect url for login and logout. You can - Login: `/sso/key/generate` - Logout: `` +Here's the env var to set the logout url on the proxy ```bash PROXY_LOGOUT_URL="https://www.google.com" ``` From 6cd6ff801fb1e25bbef6f7d574871668761b9ab7 Mon Sep 17 00:00:00 2001 From: Krish Dholakia Date: Tue, 25 Mar 2025 17:55:59 -0700 Subject: [PATCH 05/14] ci(publish-migrations.yml): add action for publishing prisma db migrations (#9537) --- .github/workflows/publish-migrations.yml | 103 +++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 .github/workflows/publish-migrations.yml diff --git a/.github/workflows/publish-migrations.yml b/.github/workflows/publish-migrations.yml new file mode 100644 index 00000000000..098bb592876 --- /dev/null +++ b/.github/workflows/publish-migrations.yml @@ -0,0 +1,103 @@ +name: Publish Prisma Migrations + +on: + push: + paths: + - 'schema.prisma' # Check root schema.prisma + branches: + - main + +jobs: + publish-migrations: + runs-on: ubuntu-latest + services: + postgres: + image: postgres:14 + env: + POSTGRES_DB: temp_db + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + + - name: Install Dependencies + run: | + pip install prisma + pip install python-dotenv + + - name: Compare and Generate Migration + env: + DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" + DIRECT_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" + run: | + # Create temporary migration workspace + mkdir -p temp_migrations + + # Copy existing migrations to temp workspace + cp -r deploy/migrations/* temp_migrations/ + + # Generate new migration by comparing against existing state + VERSION=$(date +%Y%m%d%H%M%S) + + # Use prisma migrate diff to generate the migration + prisma migrate diff \ + --from-migrations temp_migrations \ + --to-schema-datamodel schema.prisma \ + --script > temp_migrations/migration_${VERSION}.sql + + # Check if there are actual changes + if [ -s temp_migrations/migration_${VERSION}.sql ]; then + echo "Changes detected, creating new migration" + + # Create new migration directory + mkdir -p deploy/migrations/${VERSION}_schema_update + + # Move the migration file + mv temp_migrations/migration_${VERSION}.sql deploy/migrations/${VERSION}_schema_update/migration.sql + + # Create README with timestamp + echo "Migration generated at $(date -u)" > deploy/migrations/${VERSION}_schema_update/README.md + else + echo "No schema changes detected" + exit 0 + fi + + - name: Verify Migration + if: success() + env: + DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" + DIRECT_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" + run: | + # Apply all migrations in order to verify + for migration in deploy/migrations/*/migration.sql; do + echo "Applying migration: $migration" + psql $DATABASE_URL -f $migration + done + + - name: Create Pull Request + if: success() + uses: peter-evans/create-pull-request@v5 + with: + commit-message: "chore: update prisma migrations" + title: "Update Prisma Migrations" + body: | + Auto-generated migration based on schema.prisma changes. + + Generated files: + - deploy/migrations/${VERSION}_schema_update/migration.sql + - deploy/migrations/${VERSION}_schema_update/README.md + branch: feat/prisma-migration-${{ env.VERSION }} + base: main \ No newline at end of file From 79ef184345a62945f991f8f0fb4e9b090446ccb7 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 21:57:45 -0700 Subject: [PATCH 06/14] run ci/cd again --- litellm/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/__init__.py b/litellm/__init__.py index d2b51696640..a59484b0351 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -2,7 +2,7 @@ import warnings warnings.filterwarnings("ignore", message=".*conflict with protected namespace.*") -### INIT VARIABLES ########## +### INIT VARIABLES ########### import threading import os from typing import Callable, List, Optional, Dict, Union, Any, Literal, get_args From 9aec7c387816aec1de8e7b56c953a07c57afc5a9 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 22:08:06 -0700 Subject: [PATCH 07/14] test_create_delete_assistants --- tests/local_testing/test_assistants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/local_testing/test_assistants.py b/tests/local_testing/test_assistants.py index 273972e9dd0..544523e4a02 100644 --- a/tests/local_testing/test_assistants.py +++ b/tests/local_testing/test_assistants.py @@ -67,6 +67,7 @@ async def test_get_assistants(provider, sync_mode): @pytest.mark.asyncio() @pytest.mark.flaky(retries=3, delay=1) async def test_create_delete_assistants(provider, sync_mode): + litellm.ssl_verify = False model = "gpt-4-turbo" if provider == "azure": os.environ["AZURE_API_VERSION"] = "2024-05-01-preview" From 24a329ea5b1dd4f20a56061a6e0c9450198f9ba3 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 22:29:40 -0700 Subject: [PATCH 08/14] Set DNS --- .circleci/config.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index b93a9d81e8e..f8951ef7e44 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -577,6 +577,10 @@ jobs: steps: - checkout + - run: + name: Set DNS + command: | + ssh remote-docker echo "nameserver x.x.x.x" | ssh remote-docker sudo tee - run: name: Install Dependencies command: | From 61816dfd04feed1846369ea6b228ee985123a9ce Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 22:31:16 -0700 Subject: [PATCH 09/14] litellm_assistants_api_testing bump python --- .circleci/config.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index f8951ef7e44..1b94afa102f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -569,7 +569,7 @@ jobs: - litellm_proxy_unit_tests_coverage litellm_assistants_api_testing: # Runs all tests with the "assistants" keyword docker: - - image: cimg/python:3.11 + - image: cimg/python:3.13.1 auth: username: ${DOCKERHUB_USERNAME} password: ${DOCKERHUB_PASSWORD} @@ -577,10 +577,6 @@ jobs: steps: - checkout - - run: - name: Set DNS - command: | - ssh remote-docker echo "nameserver x.x.x.x" | ssh remote-docker sudo tee - run: name: Install Dependencies command: | From 3725ba4f63c0e962796a45cfcbcc664324624ea4 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 22:52:31 -0700 Subject: [PATCH 10/14] setup_google_dns --- .circleci/config.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1b94afa102f..0013a09b3fb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,6 +3,14 @@ orbs: codecov: codecov/codecov@4.0.1 node: circleci/node@5.1.0 # Add this line to declare the node orb +commands: + setup_google_dns: + steps: + - run: + name: "Configure Google DNS" + command: | + echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf + echo "nameserver 8.8.4.4" | sudo tee -a /etc/resolv.conf jobs: local_testing: @@ -577,6 +585,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | From c473e2b1c2f7bf04bde0f83cad733098381297f7 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 23:02:02 -0700 Subject: [PATCH 11/14] setup_google_dns --- .circleci/config.yml | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0013a09b3fb..304f96bdbb3 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,7 +23,7 @@ jobs: steps: - checkout - + - setup_google_dns - run: name: Show git commit hash command: | @@ -142,7 +142,7 @@ jobs: steps: - checkout - + - setup_google_dns - run: name: Show git commit hash command: | @@ -242,7 +242,7 @@ jobs: steps: - checkout - + - setup_google_dns - run: name: Show git commit hash command: | @@ -342,6 +342,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -396,6 +397,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -437,6 +439,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Show git commit hash command: | @@ -487,7 +490,7 @@ jobs: working_directory: ~/project steps: - checkout - + - setup_google_dns - run: name: Show git commit hash command: | @@ -627,6 +630,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -663,6 +667,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -705,6 +710,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -749,6 +755,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -791,6 +798,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -837,6 +845,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -881,6 +890,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -927,6 +937,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -969,6 +980,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -1011,6 +1023,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -1057,6 +1070,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -1089,6 +1103,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -1113,6 +1128,7 @@ jobs: steps: - checkout + - setup_google_dns # Install Helm - run: name: Install Helm @@ -1182,6 +1198,7 @@ jobs: steps: - checkout + - setup_google_dns - run: name: Install Dependencies command: | @@ -1218,6 +1235,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Install Python 3.9 command: | @@ -1292,6 +1310,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Install Docker CLI (In case it's not already installed) command: | @@ -1427,6 +1446,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Install Docker CLI (In case it's not already installed) command: | @@ -1551,6 +1571,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Install Docker CLI (In case it's not already installed) command: | @@ -1713,6 +1734,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Install Docker CLI (In case it's not already installed) command: | @@ -1824,6 +1846,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Install Docker CLI (In case it's not already installed) command: | @@ -1906,6 +1929,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns # Remove Docker CLI installation since it's already available in machine executor - run: name: Install Python 3.13 @@ -2003,6 +2027,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Install Docker CLI (In case it's not already installed) command: | @@ -2262,6 +2287,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Build UI command: | @@ -2376,6 +2402,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Build Docker image command: | @@ -2398,6 +2425,7 @@ jobs: working_directory: ~/project steps: - checkout + - setup_google_dns - run: name: Build Docker image command: | From 24b3e80eba18168d5b5134c969f5eb802ad63b48 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 25 Mar 2025 19:30:18 -0700 Subject: [PATCH 12/14] ci: update github action --- .github/workflows/publish-migrations.yml | 129 ++++++++++++++++++++--- 1 file changed, 116 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish-migrations.yml b/.github/workflows/publish-migrations.yml index 098bb592876..8e5a67bcf85 100644 --- a/.github/workflows/publish-migrations.yml +++ b/.github/workflows/publish-migrations.yml @@ -1,5 +1,9 @@ name: Publish Prisma Migrations +permissions: + contents: write + pull-requests: write + on: push: paths: @@ -24,6 +28,21 @@ jobs: --health-interval 10s --health-timeout 5s --health-retries 5 + + # Add shadow database service + postgres_shadow: + image: postgres:14 + env: + POSTGRES_DB: shadow_db + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - 5433:5432 + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - uses: actions/checkout@v3 @@ -38,37 +57,86 @@ jobs: pip install prisma pip install python-dotenv - - name: Compare and Generate Migration + - name: Generate Initial Migration if None Exists env: DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" DIRECT_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" + SHADOW_DATABASE_URL: "postgresql://postgres:postgres@localhost:5433/shadow_db" + run: | + mkdir -p deploy/migrations + echo 'provider = "postgresql"' > deploy/migrations/migration_lock.toml + + if [ -z "$(ls -A deploy/migrations/2* 2>/dev/null)" ]; then + echo "No existing migrations found, creating baseline..." + VERSION=$(date +%Y%m%d%H%M%S) + mkdir -p deploy/migrations/${VERSION}_initial + + echo "Generating initial migration..." + # Save raw output for debugging + prisma migrate diff \ + --from-empty \ + --to-schema-datamodel schema.prisma \ + --shadow-database-url "${SHADOW_DATABASE_URL}" \ + --script > deploy/migrations/${VERSION}_initial/raw_migration.sql + + echo "Raw migration file content:" + cat deploy/migrations/${VERSION}_initial/raw_migration.sql + + echo "Cleaning migration file..." + # Clean the file + sed '/^Installing/d' deploy/migrations/${VERSION}_initial/raw_migration.sql > deploy/migrations/${VERSION}_initial/migration.sql + + # Verify the migration file + if [ ! -s deploy/migrations/${VERSION}_initial/migration.sql ]; then + echo "ERROR: Migration file is empty after cleaning" + echo "Original content was:" + cat deploy/migrations/${VERSION}_initial/raw_migration.sql + exit 1 + fi + + echo "Final migration file content:" + cat deploy/migrations/${VERSION}_initial/migration.sql + + # Verify it starts with SQL + if ! head -n 1 deploy/migrations/${VERSION}_initial/migration.sql | grep -q "^--\|^CREATE\|^ALTER"; then + echo "ERROR: Migration file does not start with SQL command or comment" + echo "First line is:" + head -n 1 deploy/migrations/${VERSION}_initial/migration.sql + echo "Full content is:" + cat deploy/migrations/${VERSION}_initial/migration.sql + exit 1 + fi + + echo "Initial migration generated at $(date -u)" > deploy/migrations/${VERSION}_initial/README.md + fi + + - name: Compare and Generate Migration + if: success() + env: + DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" + DIRECT_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" + SHADOW_DATABASE_URL: "postgresql://postgres:postgres@localhost:5433/shadow_db" run: | # Create temporary migration workspace mkdir -p temp_migrations - # Copy existing migrations to temp workspace - cp -r deploy/migrations/* temp_migrations/ + # Copy existing migrations (will not fail if directory is empty) + cp -r deploy/migrations/* temp_migrations/ 2>/dev/null || true - # Generate new migration by comparing against existing state VERSION=$(date +%Y%m%d%H%M%S) - # Use prisma migrate diff to generate the migration + # Generate diff against existing migrations or empty state prisma migrate diff \ --from-migrations temp_migrations \ --to-schema-datamodel schema.prisma \ + --shadow-database-url "${SHADOW_DATABASE_URL}" \ --script > temp_migrations/migration_${VERSION}.sql # Check if there are actual changes if [ -s temp_migrations/migration_${VERSION}.sql ]; then echo "Changes detected, creating new migration" - - # Create new migration directory mkdir -p deploy/migrations/${VERSION}_schema_update - - # Move the migration file mv temp_migrations/migration_${VERSION}.sql deploy/migrations/${VERSION}_schema_update/migration.sql - - # Create README with timestamp echo "Migration generated at $(date -u)" > deploy/migrations/${VERSION}_schema_update/README.md else echo "No schema changes detected" @@ -80,17 +148,44 @@ jobs: env: DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" DIRECT_URL: "postgresql://postgres:postgres@localhost:5432/temp_db" + SHADOW_DATABASE_URL: "postgresql://postgres:postgres@localhost:5433/shadow_db" run: | + # Create test database + psql "${SHADOW_DATABASE_URL}" -c 'CREATE DATABASE migration_test;' + # Apply all migrations in order to verify for migration in deploy/migrations/*/migration.sql; do echo "Applying migration: $migration" - psql $DATABASE_URL -f $migration + psql "${SHADOW_DATABASE_URL}" -f $migration done + # Add this step before create-pull-request to debug permissions + - name: Check Token Permissions + run: | + echo "Checking token permissions..." + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/BerriAI/litellm/collaborators + + echo "\nChecking if token can create PRs..." + curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/BerriAI/litellm + + # Add this debug step before git push + - name: Debug Changed Files + run: | + echo "Files staged for commit:" + git diff --name-status --staged + + echo "\nAll changed files:" + git status + - name: Create Pull Request if: success() uses: peter-evans/create-pull-request@v5 with: + token: ${{ secrets.GITHUB_TOKEN }} commit-message: "chore: update prisma migrations" title: "Update Prisma Migrations" body: | @@ -100,4 +195,12 @@ jobs: - deploy/migrations/${VERSION}_schema_update/migration.sql - deploy/migrations/${VERSION}_schema_update/README.md branch: feat/prisma-migration-${{ env.VERSION }} - base: main \ No newline at end of file + base: main + delete-branch: true + + - name: Generate and Save Migrations + run: | + # Only add migration files + git add deploy/migrations/ + git status # Debug what's being committed + git commit -m "chore: update prisma migrations" From e0880734d98be93a54f630007afc8e7fef35efe2 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Tue, 25 Mar 2025 23:10:55 -0700 Subject: [PATCH 13/14] docs(config_settings.md): cleanup docs --- docs/my-website/docs/proxy/config_settings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/my-website/docs/proxy/config_settings.md b/docs/my-website/docs/proxy/config_settings.md index 0e85223d455..0093464d93f 100644 --- a/docs/my-website/docs/proxy/config_settings.md +++ b/docs/my-website/docs/proxy/config_settings.md @@ -479,7 +479,7 @@ router_settings: | PROXY_ADMIN_ID | Admin identifier for proxy server | PROXY_BASE_URL | Base URL for proxy service | PROXY_LOGOUT_URL | URL for logging out of the proxy service -| PROXY_MASTER_KEY | Master key for proxy authentication +| LITELLM_MASTER_KEY | Master key for proxy authentication | QDRANT_API_BASE | Base URL for Qdrant API | QDRANT_API_KEY | API key for Qdrant service | QDRANT_URL | Connection URL for Qdrant database From 8657816477ebc53e644af0dbe18d7b9e1fb3b777 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 25 Mar 2025 23:20:43 -0700 Subject: [PATCH 14/14] fix gemini/gemini-2.0-flash-lite on model cost map --- litellm/model_prices_and_context_window_backup.json | 2 +- model_prices_and_context_window.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.json index a098e8bd7d3..f9eb63ccca5 100644 --- a/litellm/model_prices_and_context_window_backup.json +++ b/litellm/model_prices_and_context_window_backup.json @@ -4700,7 +4700,7 @@ "supports_response_schema": true, "supports_audio_output": true, "supports_tool_choice": true, - "source": "https://ai.google.dev/gemini-api/docs/pricing#gemini-2.0-flash-lite", + "source": "https://ai.google.dev/gemini-api/docs/pricing#gemini-2.0-flash-lite" }, "gemini/gemini-2.0-flash-001": { "max_tokens": 8192, diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index a098e8bd7d3..f9eb63ccca5 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -4700,7 +4700,7 @@ "supports_response_schema": true, "supports_audio_output": true, "supports_tool_choice": true, - "source": "https://ai.google.dev/gemini-api/docs/pricing#gemini-2.0-flash-lite", + "source": "https://ai.google.dev/gemini-api/docs/pricing#gemini-2.0-flash-lite" }, "gemini/gemini-2.0-flash-001": { "max_tokens": 8192,