The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
[Bug Fix]: ImportError: cannot import name 'T' from 're' (#7314)
Ishaan Jaffa790d4311656
diff --git a/.circleci/config.yml b/.circleci/config.ymlindex c31a07a22b0..7789d57c1ff 100644--- a/.circleci/config.yml+++ b/.circleci/config.yml@@ -785,7 +785,33 @@ jobs:command: |pwdls- python -m pytest -vv tests/local_testing/test_python_38.py+ python -m pytest -vv tests/local_testing/test_basic_python_version.py++ installing_litellm_on_python_3_13:+ docker:+ - image: cimg/python:3.13.1+ auth:+ username: ${DOCKERHUB_USERNAME}+ password: ${DOCKERHUB_PASSWORD}+ working_directory: ~/project++ steps:+ - checkout+ - run:+ name: Install Dependencies+ command: |+ python -m pip install --upgrade pip+ python -m pip install -r requirements.txt+ pip install "pytest==7.3.1"+ pip install "pytest-retry==1.6.3"+ pip install "pytest-asyncio==0.21.1"+ pip install "pytest-cov==5.0.0"+ - run:+ name: Run tests+ command: |+ pwd+ ls+ python -m pytest -vv tests/local_testing/test_basic_python_version.pycheck_code_and_doc_quality:docker:@@ -1607,6 +1633,12 @@ workflows:only:- main- /litellm_.*/+ - installing_litellm_on_python_3_13:+ filters:+ branches:+ only:+ - main+ - /litellm_.*/- load_testing:filters:branches:@@ -1638,6 +1670,7 @@ workflows:- e2e_ui_testing- litellm_proxy_unit_testing- installing_litellm_on_python+ - installing_litellm_on_python_3_13- proxy_logging_guardrails_model_info_tests- proxy_pass_through_endpoint_tests- check_code_and_doc_qualitydiff --git a/requirements.txt b/requirements.txtindex 51d3718a52a..352c8c1e854 100644--- a/requirements.txt+++ b/requirements.txt@@ -4,12 +4,12 @@ httpx==0.27.0 # Pin Httpx dependencyopenai==1.55.3 # openai req.fastapi==0.111.0 # server depbackoff==2.2.1 # server dep-pyyaml==6.0.0 # server dep+pyyaml==6.0.2 # server depuvicorn==0.29.0 # server depgunicorn==22.0.0 # server depboto3==1.34.34 # aws bedrock/sagemaker callsredis==5.0.0 # caching-numpy==1.24.3 # semantic caching+numpy==2.1.1 # semantic cachingprisma==0.11.0 # for dbmangum==0.17.0 # for aws lambda functionspynacl==1.5.0 # for encrypting keys@@ -19,12 +19,12 @@ google-generativeai==0.5.0 # for vertex ai callsasync_generator==1.10.0 # for async ollama callslangfuse==2.45.0 # for langfuse self-hosted loggingprometheus_client==0.20.0 # for /metrics endpoint on proxy-orjson==3.9.15 # fast /embedding responses+orjson==3.10.12 # fast /embedding responsesapscheduler==3.10.4 # for resetting budget in backgroundfastapi-sso==0.10.0 # admin UI, SSOpyjwt[crypto]==2.9.0python-multipart==0.0.9 # admin UI-Pillow==10.3.0+Pillow==11.0.0azure-ai-contentsafety==1.0.0 # for azure content safetyazure-identity==1.16.1 # for azure content safetyazure-storage-file-datalake==12.15.0 # for azure buck storage logging@@ -37,16 +37,16 @@ cryptography==42.0.7### LITELLM PACKAGE DEPENDENCIESpython-dotenv==1.0.0 # for env-tiktoken==0.7.0 # for calculating usage+tiktoken==0.8.0 # for calculating usageimportlib-metadata==6.8.0 # for random utils-tokenizers==0.14.0 # for calculating usage+tokenizers==0.20.2 # for calculating usageclick==8.1.7 # for proxy clijinja2==3.1.4 # for prompt templatescertifi==2024.7.4 # [TODO] clean upaiohttp==3.10.2 # for network callsaioboto3==12.3.0 # for async sagemaker callstenacity==8.2.3 # for retrying requests, when litellm.num_retries set-pydantic==2.7.1 # proxy + openai req.+pydantic==2.10.0 # proxy + openai req.jsonschema==4.22.0 # validating json schemawebsockets==10.4 # for realtime API####\ No newline at end of filediff --git a/tests/llm_translation/test_anthropic_text_completion.py b/tests/llm_translation/test_anthropic_text_completion.pyindex bd0aefda182..3a18d1ccbd0 100644--- a/tests/llm_translation/test_anthropic_text_completion.py+++ b/tests/llm_translation/test_anthropic_text_completion.py@@ -1,6 +1,5 @@import asyncioimport os-from re import Timport sysimport tracebackdiff --git a/tests/local_testing/test_python_38.py b/tests/local_testing/test_basic_python_version.pysimilarity index 100%rename from tests/local_testing/test_python_38.pyrename to tests/local_testing/test_basic_python_version.pydiff --git a/tests/logging_callback_tests/test_assemble_streaming_responses.py b/tests/logging_callback_tests/test_assemble_streaming_responses.pyindex 1cd08c3b291..7b28f69917e 100644--- a/tests/logging_callback_tests/test_assemble_streaming_responses.py+++ b/tests/logging_callback_tests/test_assemble_streaming_responses.py@@ -14,8 +14,6 @@ import sysfrom datetime import datetimefrom unittest.mock import AsyncMock-from pydantic.main import Model-sys.path.insert(0, os.path.abspath("../..")) # Adds the parent directory to the system pathdiff --git a/tests/logging_callback_tests/test_otel_logging.py b/tests/logging_callback_tests/test_otel_logging.pyindex 55c9baeed46..b35f0fe9cb1 100644--- a/tests/logging_callback_tests/test_otel_logging.py+++ b/tests/logging_callback_tests/test_otel_logging.py@@ -4,8 +4,6 @@ import sysfrom datetime import datetimefrom unittest.mock import AsyncMock-from pydantic.main import Model-sys.path.insert(0, os.path.abspath("../..")) # Adds the parent directory to the system-pathdiff --git a/tests/logging_callback_tests/test_standard_logging_payload.py b/tests/logging_callback_tests/test_standard_logging_payload.pyindex 5bda02c5627..bd8e7f46a6e 100644--- a/tests/logging_callback_tests/test_standard_logging_payload.py+++ b/tests/logging_callback_tests/test_standard_logging_payload.py@@ -8,8 +8,6 @@ import sysfrom datetime import datetimefrom unittest.mock import AsyncMock-from pydantic.main import Model-sys.path.insert(0, os.path.abspath("../..")) # Adds the parent directory to the system-pathdiff --git a/tests/logging_callback_tests/test_unit_tests_init_callbacks.py b/tests/logging_callback_tests/test_unit_tests_init_callbacks.pyindex 8e994631a57..7cf2052c2aa 100644--- a/tests/logging_callback_tests/test_unit_tests_init_callbacks.py+++ b/tests/logging_callback_tests/test_unit_tests_init_callbacks.py@@ -4,8 +4,6 @@ import sysfrom datetime import datetimefrom unittest.mock import AsyncMock-from pydantic.main import Model-sys.path.insert(0, os.path.abspath("../..")) # Adds the parent directory to the system-pathdiff --git a/tests/proxy_unit_tests/test_unit_test_max_model_budget_limiter.py b/tests/proxy_unit_tests/test_unit_test_max_model_budget_limiter.pyindex 52a8b03909a..82d85cf2f7d 100644--- a/tests/proxy_unit_tests/test_unit_test_max_model_budget_limiter.py+++ b/tests/proxy_unit_tests/test_unit_test_max_model_budget_limiter.py@@ -4,8 +4,6 @@ import sysfrom datetime import datetimefrom unittest.mock import AsyncMock-from pydantic.main import Model-sys.path.insert(0, os.path.abspath("../..")) # Adds the parent directory to the system-path