Skip to content

Commit 95e82f6

Browse files
authored
Merge branch 'main' into separate-key-expiration-from-budget-reset
2 parents e85c7b1 + df6e084 commit 95e82f6

File tree

1,646 files changed

+154252
-39736
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,646 files changed

+154252
-39736
lines changed

.circleci/config.yml

Lines changed: 212 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,24 @@ jobs:
616616
wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz
617617
sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz
618618
rm dockerize-linux-amd64-v0.6.1.tar.gz
619+
- run:
620+
name: Start PostgreSQL Database
621+
command: |
622+
docker run -d \
623+
--name postgres-db \
624+
-e POSTGRES_USER=postgres \
625+
-e POSTGRES_PASSWORD=postgres \
626+
-e POSTGRES_DB=circle_test \
627+
-p 5432:5432 \
628+
postgres:14
629+
- run:
630+
name: Wait for PostgreSQL to be ready
631+
command: dockerize -wait tcp://localhost:5432 -timeout 1m
632+
- run:
633+
name: Set DATABASE_URL environment variable
634+
command: |
635+
echo 'export DATABASE_URL="postgresql://postgres:postgres@localhost:5432/circle_test"' >> $BASH_ENV
636+
source $BASH_ENV
619637
- run:
620638
name: Run Security Scans
621639
command: |
@@ -658,18 +676,16 @@ jobs:
658676
working_directory: ~/project
659677
steps:
660678
- checkout
661-
- run:
662-
name: Install PostgreSQL
663-
command: |
664-
sudo apt-get update
665-
sudo apt-get install postgresql postgresql-contrib
666-
echo 'export PATH=/usr/lib/postgresql/*/bin:$PATH' >> $BASH_ENV
667679
- setup_google_dns
668680
- run:
669681
name: Show git commit hash
670682
command: |
671683
echo "Git commit hash: $CIRCLE_SHA1"
672-
684+
- run:
685+
name: Install PostgreSQL
686+
command: |
687+
sudo apt-get update
688+
sudo apt-get install -y postgresql-14 postgresql-contrib-14
673689
- restore_cache:
674690
keys:
675691
- v1-dependencies-{{ checksum ".circleci/requirements.txt" }}
@@ -1025,6 +1041,92 @@ jobs:
10251041
paths:
10261042
- llm_responses_api_coverage.xml
10271043
- llm_responses_api_coverage
1044+
ocr_testing:
1045+
docker:
1046+
- image: cimg/python:3.11
1047+
auth:
1048+
username: ${DOCKERHUB_USERNAME}
1049+
password: ${DOCKERHUB_PASSWORD}
1050+
working_directory: ~/project
1051+
1052+
steps:
1053+
- checkout
1054+
- setup_google_dns
1055+
- run:
1056+
name: Install Dependencies
1057+
command: |
1058+
python -m pip install --upgrade pip
1059+
python -m pip install -r requirements.txt
1060+
pip install "pytest==7.3.1"
1061+
pip install "pytest-retry==1.6.3"
1062+
pip install "pytest-cov==5.0.0"
1063+
pip install "pytest-asyncio==0.21.1"
1064+
pip install "respx==0.22.0"
1065+
# Run pytest and generate JUnit XML report
1066+
- run:
1067+
name: Run tests
1068+
command: |
1069+
pwd
1070+
ls
1071+
python -m pytest -vv tests/ocr_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5
1072+
no_output_timeout: 120m
1073+
- run:
1074+
name: Rename the coverage files
1075+
command: |
1076+
mv coverage.xml ocr_coverage.xml
1077+
mv .coverage ocr_coverage
1078+
1079+
# Store test results
1080+
- store_test_results:
1081+
path: test-results
1082+
- persist_to_workspace:
1083+
root: .
1084+
paths:
1085+
- ocr_coverage.xml
1086+
- ocr_coverage
1087+
search_testing:
1088+
docker:
1089+
- image: cimg/python:3.11
1090+
auth:
1091+
username: ${DOCKERHUB_USERNAME}
1092+
password: ${DOCKERHUB_PASSWORD}
1093+
working_directory: ~/project
1094+
1095+
steps:
1096+
- checkout
1097+
- setup_google_dns
1098+
- run:
1099+
name: Install Dependencies
1100+
command: |
1101+
python -m pip install --upgrade pip
1102+
python -m pip install -r requirements.txt
1103+
pip install "pytest==7.3.1"
1104+
pip install "pytest-retry==1.6.3"
1105+
pip install "pytest-cov==5.0.0"
1106+
pip install "pytest-asyncio==0.21.1"
1107+
pip install "respx==0.22.0"
1108+
# Run pytest and generate JUnit XML report
1109+
- run:
1110+
name: Run tests
1111+
command: |
1112+
pwd
1113+
ls
1114+
python -m pytest -vv tests/search_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5
1115+
no_output_timeout: 120m
1116+
- run:
1117+
name: Rename the coverage files
1118+
command: |
1119+
mv coverage.xml search_coverage.xml
1120+
mv .coverage search_coverage
1121+
1122+
# Store test results
1123+
- store_test_results:
1124+
path: test-results
1125+
- persist_to_workspace:
1126+
root: .
1127+
paths:
1128+
- search_coverage.xml
1129+
- search_coverage
10281130
litellm_mapped_tests:
10291131
docker:
10301132
- image: cimg/python:3.11
@@ -1360,6 +1462,49 @@ jobs:
13601462
paths:
13611463
- logging_coverage.xml
13621464
- logging_coverage
1465+
audio_testing:
1466+
docker:
1467+
- image: cimg/python:3.11
1468+
auth:
1469+
username: ${DOCKERHUB_USERNAME}
1470+
password: ${DOCKERHUB_PASSWORD}
1471+
working_directory: ~/project
1472+
1473+
steps:
1474+
- checkout
1475+
- setup_google_dns
1476+
- run:
1477+
name: Install Dependencies
1478+
command: |
1479+
python -m pip install --upgrade pip
1480+
python -m pip install -r requirements.txt
1481+
pip install "pytest==7.3.1"
1482+
pip install "pytest-retry==1.6.3"
1483+
pip install "pytest-cov==5.0.0"
1484+
pip install "pytest-asyncio==0.21.1"
1485+
pip install "respx==0.22.0"
1486+
# Run pytest and generate JUnit XML report
1487+
- run:
1488+
name: Run tests
1489+
command: |
1490+
pwd
1491+
ls
1492+
python -m pytest -vv tests/audio_tests --cov=litellm --cov-report=xml -x -s -v --junitxml=test-results/junit.xml --durations=5
1493+
no_output_timeout: 120m
1494+
- run:
1495+
name: Rename the coverage files
1496+
command: |
1497+
mv coverage.xml audio_coverage.xml
1498+
mv .coverage audio_coverage
1499+
1500+
# Store test results
1501+
- store_test_results:
1502+
path: test-results
1503+
- persist_to_workspace:
1504+
root: .
1505+
paths:
1506+
- audio_coverage.xml
1507+
- audio_coverage
13631508
installing_litellm_on_python:
13641509
docker:
13651510
- image: circleci/python:3.8
@@ -1564,6 +1709,7 @@ jobs:
15641709
pip install "pytest==7.3.1"
15651710
pip install "pytest-asyncio==0.21.1"
15661711
pip install aiohttp
1712+
pip install apscheduler
15671713
- run:
15681714
name: Build Docker image
15691715
command: |
@@ -2357,6 +2503,25 @@ jobs:
23572503
pip install "pytest-mock==3.12.0"
23582504
pip install "pytest-asyncio==0.21.1"
23592505
pip install "assemblyai==0.37.0"
2506+
- run:
2507+
name: Install dockerize
2508+
command: |
2509+
wget https://github.com/jwilder/dockerize/releases/download/v0.6.1/dockerize-linux-amd64-v0.6.1.tar.gz
2510+
sudo tar -C /usr/local/bin -xzvf dockerize-linux-amd64-v0.6.1.tar.gz
2511+
rm dockerize-linux-amd64-v0.6.1.tar.gz
2512+
- run:
2513+
name: Start PostgreSQL Database
2514+
command: |
2515+
docker run -d \
2516+
--name postgres-db \
2517+
-e POSTGRES_USER=postgres \
2518+
-e POSTGRES_PASSWORD=postgres \
2519+
-e POSTGRES_DB=circle_test \
2520+
-p 5432:5432 \
2521+
postgres:14
2522+
- run:
2523+
name: Wait for PostgreSQL to be ready
2524+
command: dockerize -wait tcp://localhost:5432 -timeout 1m
23602525
- run:
23612526
name: Build Docker image
23622527
command: docker build -t my-app:latest -f ./docker/Dockerfile.database .
@@ -2367,10 +2532,11 @@ jobs:
23672532
command: |
23682533
docker run -d \
23692534
-p 4000:4000 \
2370-
-e DATABASE_URL=$CLEAN_STORE_MODEL_IN_DB_DATABASE_URL \
2535+
-e DATABASE_URL=postgresql://postgres:[email protected]:5432/circle_test \
23712536
-e STORE_MODEL_IN_DB="True" \
23722537
-e LITELLM_MASTER_KEY="sk-1234" \
23732538
-e LITELLM_LICENSE=$LITELLM_LICENSE \
2539+
--add-host host.docker.internal:host-gateway \
23742540
--name my-app \
23752541
-v $(pwd)/litellm/proxy/example_config_yaml/store_model_db_config.yaml:/app/config.yaml \
23762542
my-app:latest \
@@ -2400,7 +2566,16 @@ jobs:
24002566
python -m pytest -vv tests/store_model_in_db_tests -x --junitxml=test-results/junit.xml --durations=5
24012567
no_output_timeout:
24022568
120m
2403-
# Clean up first container
2569+
- run:
2570+
name: Stop and remove containers
2571+
command: |
2572+
docker stop my-app || true
2573+
docker rm my-app || true
2574+
docker stop postgres-db || true
2575+
docker rm postgres-db || true
2576+
when: always
2577+
- store_test_results:
2578+
path: test-results
24042579

24052580
proxy_build_from_pip_tests:
24062581
# Change from docker to machine executor
@@ -2435,6 +2610,7 @@ jobs:
24352610
pip install "pytest-mock==3.12.0"
24362611
pip install "pytest-asyncio==0.21.1"
24372612
pip install "mypy==1.18.2"
2613+
pip install apscheduler
24382614
- run:
24392615
name: Build Docker image
24402616
command: |
@@ -2588,6 +2764,8 @@ jobs:
25882764
-e GEMINI_API_KEY=$GEMINI_API_KEY \
25892765
-e ANTHROPIC_API_KEY=$ANTHROPIC_API_KEY \
25902766
-e ASSEMBLYAI_API_KEY=$ASSEMBLYAI_API_KEY \
2767+
-e AZURE_API_KEY=$AZURE_API_KEY \
2768+
-e AZURE_API_BASE=$AZURE_API_BASE \
25912769
-e USE_DDTRACE=True \
25922770
-e DD_API_KEY=$DD_API_KEY \
25932771
-e DD_SITE=$DD_SITE \
@@ -2694,7 +2872,7 @@ jobs:
26942872
python -m venv venv
26952873
. venv/bin/activate
26962874
pip install coverage
2697-
coverage combine llm_translation_coverage llm_responses_api_coverage mcp_coverage logging_coverage litellm_router_coverage local_testing_coverage litellm_assistants_api_coverage auth_ui_unit_tests_coverage langfuse_coverage caching_coverage litellm_proxy_unit_tests_coverage image_gen_coverage pass_through_unit_tests_coverage batches_coverage litellm_security_tests_coverage guardrails_coverage
2875+
coverage combine llm_translation_coverage llm_responses_api_coverage ocr_coverage search_coverage mcp_coverage logging_coverage audio_coverage litellm_router_coverage local_testing_coverage litellm_assistants_api_coverage auth_ui_unit_tests_coverage langfuse_coverage caching_coverage litellm_proxy_unit_tests_coverage image_gen_coverage pass_through_unit_tests_coverage batches_coverage litellm_security_tests_coverage guardrails_coverage
26982876
coverage xml
26992877
- codecov/upload:
27002878
file: ./coverage.xml
@@ -3242,6 +3420,18 @@ workflows:
32423420
only:
32433421
- main
32443422
- /litellm_.*/
3423+
- ocr_testing:
3424+
filters:
3425+
branches:
3426+
only:
3427+
- main
3428+
- /litellm_.*/
3429+
- search_testing:
3430+
filters:
3431+
branches:
3432+
only:
3433+
- main
3434+
- /litellm_.*/
32453435
- litellm_mapped_enterprise_tests:
32463436
filters:
32473437
branches:
@@ -3284,20 +3474,29 @@ workflows:
32843474
only:
32853475
- main
32863476
- /litellm_.*/
3477+
- audio_testing:
3478+
filters:
3479+
branches:
3480+
only:
3481+
- main
3482+
- /litellm_.*/
32873483
- upload-coverage:
32883484
requires:
32893485
- llm_translation_testing
32903486
- mcp_testing
32913487
- google_generate_content_endpoint_testing
32923488
- guardrails_testing
32933489
- llm_responses_api_testing
3490+
- ocr_testing
3491+
- search_testing
32943492
- litellm_mapped_tests
32953493
- litellm_mapped_enterprise_tests
32963494
- batches_testing
32973495
- litellm_utils_testing
32983496
- pass_through_unit_testing
32993497
- image_gen_testing
33003498
- logging_testing
3499+
- audio_testing
33013500
- litellm_router_testing
33023501
- litellm_router_unit_testing
33033502
- caching_unit_tests
@@ -3353,13 +3552,16 @@ workflows:
33533552
- mcp_testing
33543553
- google_generate_content_endpoint_testing
33553554
- llm_responses_api_testing
3555+
- ocr_testing
3556+
- search_testing
33563557
- litellm_mapped_tests
33573558
- litellm_mapped_enterprise_tests
33583559
- batches_testing
33593560
- litellm_utils_testing
33603561
- pass_through_unit_testing
33613562
- image_gen_testing
33623563
- logging_testing
3564+
- audio_testing
33633565
- litellm_router_testing
33643566
- litellm_router_unit_testing
33653567
- caching_unit_tests

.github/workflows/interpret_load_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ def get_docker_run_command(release_version):
8888

8989

9090
if __name__ == "__main__":
91+
return
9192
csv_file = "load_test_stats.csv" # Change this to the path of your CSV file
9293
markdown_table = interpret_results(csv_file)
9394

.github/workflows/test-litellm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ jobs:
3333
poetry run pip install "google-genai==1.22.0"
3434
poetry run pip install "google-cloud-aiplatform>=1.38"
3535
poetry run pip install "fastapi-offline==1.7.3"
36+
poetry run pip install "python-multipart==0.0.18"
3637
- name: Setup litellm-enterprise as local package
3738
run: |
3839
cd enterprise
3940
python -m pip install -e .
4041
cd ..
4142
- name: Run tests
4243
run: |
43-
poetry run pytest tests/test_litellm --tb=short -vv --maxfail=10 -n 4
44+
poetry run pytest tests/test_litellm --tb=short -vv --maxfail=10 -n 4 --durations=50

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,6 @@ litellm_config.yaml
9797
.vscode/launch.json
9898
litellm/proxy/to_delete_loadtest_work/*
9999
update_model_cost_map.py
100+
tests/test_litellm/proxy/_experimental/mcp_server/test_mcp_server_manager.py
101+
litellm/proxy/_experimental/out/guardrails/index.html
102+
scripts/test_vertex_ai_search.py

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ install-proxy-dev-ci:
4545
install-test-deps: install-proxy-dev
4646
poetry run pip install "pytest-retry==1.6.3"
4747
poetry run pip install pytest-xdist
48-
cd enterprise && python -m pip install -e . && cd ..
48+
cd enterprise && poetry run pip install -e . && cd ..
4949

5050
install-helm-unittest:
5151
helm plugin install https://github.com/helm-unittest/helm-unittest --version v0.4.4 || echo "ignore error if plugin exists"

0 commit comments

Comments
 (0)