Skip to content

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]

fix: use fastuuid helper (#14903)

Alexsander Hamireaa04cd8ce29
diff --git a/cookbook/litellm_router_load_test/memory_usage/router_endpoint.py b/cookbook/litellm_router_load_test/memory_usage/router_endpoint.py
index 689f105bc5f..1dc2d914857 100644
--- a/cookbook/litellm_router_load_test/memory_usage/router_endpoint.py
+++ b/cookbook/litellm_router_load_test/memory_usage/router_endpoint.py
@@ -5,7 +5,7 @@ import os
import litellm
from litellm import Router
from dotenv import load_dotenv
-import uuid
+from litellm._uuid import uuid
load_dotenv()
diff --git a/cookbook/litellm_router_load_test/memory_usage/router_memory_usage copy.py b/cookbook/litellm_router_load_test/memory_usage/router_memory_usage copy.py
index a8aa506e8a2..76d5d3913f5 100644
--- a/cookbook/litellm_router_load_test/memory_usage/router_memory_usage copy.py
+++ b/cookbook/litellm_router_load_test/memory_usage/router_memory_usage copy.py
@@ -12,7 +12,7 @@ sys.path.insert(
import litellm
from litellm import Router
from dotenv import load_dotenv
-import uuid
+from litellm._uuid import uuid
load_dotenv()
diff --git a/cookbook/litellm_router_load_test/memory_usage/router_memory_usage.py b/cookbook/litellm_router_load_test/memory_usage/router_memory_usage.py
index a8aa506e8a2..76d5d3913f5 100644
--- a/cookbook/litellm_router_load_test/memory_usage/router_memory_usage.py
+++ b/cookbook/litellm_router_load_test/memory_usage/router_memory_usage.py
@@ -12,7 +12,7 @@ sys.path.insert(
import litellm
from litellm import Router
from dotenv import load_dotenv
-import uuid
+from litellm._uuid import uuid
load_dotenv()
diff --git a/enterprise/litellm_enterprise/enterprise_callbacks/generic_api_callback.py b/enterprise/litellm_enterprise/enterprise_callbacks/generic_api_callback.py
index d239be41257..7e259d4e19d 100644
--- a/enterprise/litellm_enterprise/enterprise_callbacks/generic_api_callback.py
+++ b/enterprise/litellm_enterprise/enterprise_callbacks/generic_api_callback.py
@@ -9,7 +9,7 @@ Callback to log events to a Generic API Endpoint
import asyncio
import os
import traceback
-import uuid
+from litellm._uuid import uuid
from typing import Dict, List, Optional, Union
import litellm
diff --git a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py
index 6edd198cd8e..4b1bb024ac6 100644
--- a/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py
+++ b/enterprise/litellm_enterprise/proxy/common_utils/check_batch_cost.py
@@ -2,7 +2,7 @@
Polls LiteLLM_ManagedObjectTable to check if the batch job is complete, and if the cost has been tracked.
"""
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from typing import TYPE_CHECKING, Optional, cast
diff --git a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py
index e069a89b9c5..e2963f8fb87 100644
--- a/enterprise/litellm_enterprise/proxy/hooks/managed_files.py
+++ b/enterprise/litellm_enterprise/proxy/hooks/managed_files.py
@@ -4,7 +4,7 @@
import asyncio
import base64
import json
-import uuid
+from litellm._uuid import uuid
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union, cast
from fastapi import HTTPException
diff --git a/litellm/caching/qdrant_semantic_cache.py b/litellm/caching/qdrant_semantic_cache.py
index 32d4d8b0fdc..0e77b5a6c21 100644
--- a/litellm/caching/qdrant_semantic_cache.py
+++ b/litellm/caching/qdrant_semantic_cache.py
@@ -168,7 +168,7 @@ class QdrantSemanticCache(BaseCache):
def set_cache(self, key, value, **kwargs):
print_verbose(f"qdrant semantic-cache set_cache, kwargs: {kwargs}")
- import uuid
+ from litellm._uuid import uuid
# get the prompt
messages = kwargs["messages"]
@@ -279,7 +279,7 @@ class QdrantSemanticCache(BaseCache):
pass
async def async_set_cache(self, key, value, **kwargs):
- import uuid
+ from litellm._uuid import uuid
from litellm.proxy.proxy_server import llm_model_list, llm_router
diff --git a/litellm/integrations/azure_storage/azure_storage.py b/litellm/integrations/azure_storage/azure_storage.py
index 6ffb1e542fc..b4362665a4c 100644
--- a/litellm/integrations/azure_storage/azure_storage.py
+++ b/litellm/integrations/azure_storage/azure_storage.py
@@ -2,7 +2,7 @@ import asyncio
import json
import os
import time
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timedelta
from typing import List, Optional
diff --git a/litellm/integrations/datadog/datadog.py b/litellm/integrations/datadog/datadog.py
index f5a0883bea4..0c62667f749 100644
--- a/litellm/integrations/datadog/datadog.py
+++ b/litellm/integrations/datadog/datadog.py
@@ -17,7 +17,7 @@ import asyncio
import datetime
import os
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime as datetimeObj
from typing import Any, Dict, List, Optional, Union
diff --git a/litellm/integrations/datadog/datadog_llm_obs.py b/litellm/integrations/datadog/datadog_llm_obs.py
index 2702192f637..fc3cf4b9ff2 100644
--- a/litellm/integrations/datadog/datadog_llm_obs.py
+++ b/litellm/integrations/datadog/datadog_llm_obs.py
@@ -9,7 +9,7 @@ API Reference: https://docs.datadoghq.com/llm_observability/setup/api/?tab=examp
import asyncio
import json
import os
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from typing import Any, Dict, List, Literal, Optional, Union
diff --git a/litellm/integrations/deepeval/deepeval.py b/litellm/integrations/deepeval/deepeval.py
index f548ff50d73..972843e120a 100644
--- a/litellm/integrations/deepeval/deepeval.py
+++ b/litellm/integrations/deepeval/deepeval.py
@@ -1,5 +1,5 @@
import os
-import uuid
+from litellm._uuid import uuid
from litellm.integrations.custom_logger import CustomLogger
from litellm.integrations.deepeval.api import Api, Endpoints, HttpMethods
from litellm.integrations.deepeval.types import (
diff --git a/litellm/integrations/dynamodb.py b/litellm/integrations/dynamodb.py
index 2c527ea8aa9..dfc05ae1f32 100644
--- a/litellm/integrations/dynamodb.py
+++ b/litellm/integrations/dynamodb.py
@@ -3,7 +3,7 @@
import os
import traceback
-import uuid
+from litellm._uuid import uuid
from typing import Any
import litellm
diff --git a/litellm/integrations/gcs_bucket/gcs_bucket.py b/litellm/integrations/gcs_bucket/gcs_bucket.py
index 972a0236666..9190f921d50 100644
--- a/litellm/integrations/gcs_bucket/gcs_bucket.py
+++ b/litellm/integrations/gcs_bucket/gcs_bucket.py
@@ -1,7 +1,7 @@
import asyncio
import json
import os
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timedelta, timezone
from typing import TYPE_CHECKING, Any, Dict, List, Optional
from urllib.parse import quote
diff --git a/litellm/integrations/lago.py b/litellm/integrations/lago.py
index 5dfb1ce097d..b881193e869 100644
--- a/litellm/integrations/lago.py
+++ b/litellm/integrations/lago.py
@@ -3,7 +3,7 @@
import json
import os
-import uuid
+from litellm._uuid import uuid
from typing import Literal, Optional
import httpx
diff --git a/litellm/integrations/langsmith.py b/litellm/integrations/langsmith.py
index 7783b704b46..cc9b361b69d 100644
--- a/litellm/integrations/langsmith.py
+++ b/litellm/integrations/langsmith.py
@@ -5,7 +5,7 @@ import os
import random
import traceback
import types
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional
diff --git a/litellm/integrations/literal_ai.py b/litellm/integrations/literal_ai.py
index 5bf9afd7eb4..042779ba844 100644
--- a/litellm/integrations/literal_ai.py
+++ b/litellm/integrations/literal_ai.py
@@ -2,7 +2,7 @@
# This file contains the LiteralAILogger class which is used to log steps to the LiteralAI observability platform.
import asyncio
import os
-import uuid
+from litellm._uuid import uuid
from typing import List, Optional
import httpx
diff --git a/litellm/integrations/logfire_logger.py b/litellm/integrations/logfire_logger.py
index 516bd4a8e28..2345dc869c6 100644
--- a/litellm/integrations/logfire_logger.py
+++ b/litellm/integrations/logfire_logger.py
@@ -3,7 +3,7 @@
import os
import traceback
-import uuid
+from litellm._uuid import uuid
from enum import Enum
from typing import Any, Dict, NamedTuple
diff --git a/litellm/integrations/posthog.py b/litellm/integrations/posthog.py
index d321135f289..5298e538a72 100644
--- a/litellm/integrations/posthog.py
+++ b/litellm/integrations/posthog.py
@@ -11,7 +11,7 @@ For batching specific details see CustomBatchLogger class
import asyncio
import os
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, Optional
diff --git a/litellm/litellm_core_utils/fallback_utils.py b/litellm/litellm_core_utils/fallback_utils.py
index a5b0c85c816..7ce53862089 100644
--- a/litellm/litellm_core_utils/fallback_utils.py
+++ b/litellm/litellm_core_utils/fallback_utils.py
@@ -1,4 +1,4 @@
-import uuid
+from litellm._uuid import uuid
from typing import Optional
import litellm
diff --git a/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py b/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py
index ce054b91cc9..2def52ed7e6 100644
--- a/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py
+++ b/litellm/litellm_core_utils/llm_response_utils/convert_dict_to_response.py
@@ -2,7 +2,7 @@ import asyncio
import json
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from typing import Dict, Iterable, List, Literal, Optional, Tuple, Union
import litellm
diff --git a/litellm/litellm_core_utils/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py
index b9cc5e50c3b..c1d8a1cd41b 100644
--- a/litellm/litellm_core_utils/prompt_templates/factory.py
+++ b/litellm/litellm_core_utils/prompt_templates/factory.py
@@ -2,7 +2,7 @@ import copy
import json
import mimetypes
import re
-import uuid
+from litellm._uuid import uuid
import xml.etree.ElementTree as ET
from enum import Enum
from typing import Any, List, Optional, Tuple, cast, overload
diff --git a/litellm/litellm_core_utils/streaming_handler.py b/litellm/litellm_core_utils/streaming_handler.py
index bc0fbdf5c11..b2f6c621407 100644
--- a/litellm/litellm_core_utils/streaming_handler.py
+++ b/litellm/litellm_core_utils/streaming_handler.py
@@ -5,7 +5,7 @@ import json
import threading
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from typing import Any, Callable, Dict, List, Optional, Union, cast
import httpx
diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py
index e4191a945f3..306bcd9bb2c 100644
--- a/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py
+++ b/litellm/llms/anthropic/experimental_pass_through/adapters/streaming_iterator.py
@@ -2,7 +2,7 @@
## Translates OpenAI call to Anthropic `/v1/messages` format
import json
import traceback
-import uuid
+from litellm._uuid import uuid
from collections import deque
from typing import TYPE_CHECKING, Any, AsyncIterator, Iterator, Literal, Optional
diff --git a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py
index d38e7adc231..7de2a1e1c66 100644
--- a/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py
+++ b/litellm/llms/anthropic/experimental_pass_through/adapters/transformation.py
@@ -458,7 +458,7 @@ class LiteLLMAnthropicMessagesAdapter:
Literal["text", "tool_use"],
"ContentBlockContentBlockDict",
]:
- import uuid
+ from litellm._uuid import uuid
from litellm.types.llms.anthropic import TextBlock, ToolUseBlock
diff --git a/litellm/llms/azure/audio_transcriptions.py b/litellm/llms/azure/audio_transcriptions.py
index 1f09ac7574a..8519b1c35a5 100644
--- a/litellm/llms/azure/audio_transcriptions.py
+++ b/litellm/llms/azure/audio_transcriptions.py
@@ -1,4 +1,4 @@
-import uuid
+from litellm._uuid import uuid
from typing import Any, Coroutine, Optional, Union
from openai import AsyncAzureOpenAI, AzureOpenAI
diff --git a/litellm/llms/bedrock/chat/invoke_agent/transformation.py b/litellm/llms/bedrock/chat/invoke_agent/transformation.py
index e4ff6d398ea..4a7c33ed204 100644
--- a/litellm/llms/bedrock/chat/invoke_agent/transformation.py
+++ b/litellm/llms/bedrock/chat/invoke_agent/transformation.py
@@ -5,7 +5,7 @@ https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent-runtime_Invoke
"""
import base64
import json
-import uuid
+from litellm._uuid import uuid
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
import httpx
diff --git a/litellm/llms/bedrock/chat/invoke_handler.py b/litellm/llms/bedrock/chat/invoke_handler.py
index 42cdb34fc1a..0d1b4102c94 100644
--- a/litellm/llms/bedrock/chat/invoke_handler.py
+++ b/litellm/llms/bedrock/chat/invoke_handler.py
@@ -7,7 +7,7 @@ import json
import time
import types
import urllib.parse
-import uuid
+from litellm._uuid import uuid
from functools import partial
from typing import (
Any,
diff --git a/litellm/llms/bedrock/common_utils.py b/litellm/llms/bedrock/common_utils.py
index 63c366c9480..2b111cde600 100644
--- a/litellm/llms/bedrock/common_utils.py
+++ b/litellm/llms/bedrock/common_utils.py
@@ -802,7 +802,7 @@ class CommonBatchFilesUtils:
Tuple of (bucket_name, object_key)
"""
import time
- import uuid
+ from litellm._uuid import uuid
# Get bucket name
bucket_name = (
diff --git a/litellm/llms/bedrock/files/transformation.py b/litellm/llms/bedrock/files/transformation.py
index d493deddb62..0a95cf9168f 100644
--- a/litellm/llms/bedrock/files/transformation.py
+++ b/litellm/llms/bedrock/files/transformation.py
@@ -1,7 +1,7 @@
import json
import os
import time
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, List, Optional, Tuple, Union
from httpx import Headers, Response
diff --git a/litellm/llms/bedrock/rerank/transformation.py b/litellm/llms/bedrock/rerank/transformation.py
index be8250a9671..b5d33eda49f 100644
--- a/litellm/llms/bedrock/rerank/transformation.py
+++ b/litellm/llms/bedrock/rerank/transformation.py
@@ -4,7 +4,7 @@ Translates from Cohere's `/v1/rerank` input format to Bedrock's `/rerank` input
Why separate file? Make it easy to see how transformation works
"""
-import uuid
+from litellm._uuid import uuid
from typing import List, Optional, Union
from litellm.types.llms.bedrock import (
diff --git a/litellm/llms/deepinfra/rerank/transformation.py b/litellm/llms/deepinfra/rerank/transformation.py
index 8259c6075bb..6a3244a3c88 100644
--- a/litellm/llms/deepinfra/rerank/transformation.py
+++ b/litellm/llms/deepinfra/rerank/transformation.py
@@ -2,7 +2,7 @@
Translate between Cohere's `/rerank` format and Deepinfra's `/rerank` format.
"""
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, List, Optional, Union
import httpx
diff --git a/litellm/llms/fireworks_ai/chat/transformation.py b/litellm/llms/fireworks_ai/chat/transformation.py
index 31d749032b4..524b1c97145 100644
--- a/litellm/llms/fireworks_ai/chat/transformation.py
+++ b/litellm/llms/fireworks_ai/chat/transformation.py
@@ -1,5 +1,5 @@
import json
-import uuid
+from litellm._uuid import uuid
from typing import Any, List, Literal, Optional, Tuple, Union, cast
import httpx
diff --git a/litellm/llms/gemini/realtime/transformation.py b/litellm/llms/gemini/realtime/transformation.py
index f32a404c9e8..e1dd6f146f3 100644
--- a/litellm/llms/gemini/realtime/transformation.py
+++ b/litellm/llms/gemini/realtime/transformation.py
@@ -3,7 +3,7 @@ This file contains the transformation logic for the Gemini realtime API.
"""
import json
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, List, Optional, Union, cast
from litellm import verbose_logger
diff --git a/litellm/llms/hosted_vllm/rerank/transformation.py b/litellm/llms/hosted_vllm/rerank/transformation.py
index 419327d9d5c..c0a57c43534 100644
--- a/litellm/llms/hosted_vllm/rerank/transformation.py
+++ b/litellm/llms/hosted_vllm/rerank/transformation.py
@@ -2,7 +2,7 @@
Transformation logic for Hosted VLLM rerank
"""
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, List, Optional, Union
from litellm.types.rerank import (
diff --git a/litellm/llms/huggingface/rerank/transformation.py b/litellm/llms/huggingface/rerank/transformation.py
index 9c3234c3512..aa0f37bc6ba 100644
--- a/litellm/llms/huggingface/rerank/transformation.py
+++ b/litellm/llms/huggingface/rerank/transformation.py
@@ -1,5 +1,5 @@
import os
-import uuid
+from litellm._uuid import uuid
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
import httpx
diff --git a/litellm/llms/infinity/rerank/transformation.py b/litellm/llms/infinity/rerank/transformation.py
index 4b75fa121b2..6259d445aec 100644
--- a/litellm/llms/infinity/rerank/transformation.py
+++ b/litellm/llms/infinity/rerank/transformation.py
@@ -4,7 +4,7 @@ Transformation logic from Cohere's /v1/rerank format to Infinity's `/v1/rerank`
Why separate file? Make it easy to see how transformation works
"""
-import uuid
+from litellm._uuid import uuid
from typing import List, Optional
import httpx
diff --git a/litellm/llms/jina_ai/rerank/transformation.py b/litellm/llms/jina_ai/rerank/transformation.py
index 8d0a9b1431c..d8569b01b83 100644
--- a/litellm/llms/jina_ai/rerank/transformation.py
+++ b/litellm/llms/jina_ai/rerank/transformation.py
@@ -6,7 +6,7 @@ Why separate file? Make it easy to see how transformation works
Docs - https://jina.ai/reranker
"""
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, List, Optional, Tuple, Union
from httpx import URL, Response
diff --git a/litellm/llms/ollama/chat/transformation.py b/litellm/llms/ollama/chat/transformation.py
index 3527a579218..3b755e79330 100644
--- a/litellm/llms/ollama/chat/transformation.py
+++ b/litellm/llms/ollama/chat/transformation.py
@@ -1,6 +1,6 @@
import json
import time
-import uuid
+from litellm._uuid import uuid
from typing import (
TYPE_CHECKING,
Any,
diff --git a/litellm/llms/ollama/completion/transformation.py b/litellm/llms/ollama/completion/transformation.py
index bfb0b7f1877..981a987ec91 100644
--- a/litellm/llms/ollama/completion/transformation.py
+++ b/litellm/llms/ollama/completion/transformation.py
@@ -1,6 +1,6 @@
import json
import time
-import uuid
+from litellm._uuid import uuid
from typing import TYPE_CHECKING, Any, AsyncIterator, Iterator, List, Optional, Union
from httpx._models import Headers, Response
diff --git a/litellm/llms/ollama_chat.py b/litellm/llms/ollama_chat.py
index d46e7145194..082312d28f2 100644
--- a/litellm/llms/ollama_chat.py
+++ b/litellm/llms/ollama_chat.py
@@ -1,6 +1,6 @@
import json
import time
-import uuid
+from litellm._uuid import uuid
from typing import Any, List, Optional, Union
import aiohttp
diff --git a/litellm/llms/together_ai/rerank/transformation.py b/litellm/llms/together_ai/rerank/transformation.py
index 1fdb772adde..63b593dfe42 100644
--- a/litellm/llms/together_ai/rerank/transformation.py
+++ b/litellm/llms/together_ai/rerank/transformation.py
@@ -4,7 +4,7 @@ Transformation logic from Cohere's /v1/rerank format to Together AI's `/v1/rera
Why separate file? Make it easy to see how transformation works
"""
-import uuid
+from litellm._uuid import uuid
from typing import List, Optional
from litellm.types.rerank import (
diff --git a/litellm/llms/vertex_ai/batches/transformation.py b/litellm/llms/vertex_ai/batches/transformation.py
index 5b6d21b5948..22cd0bd402a 100644
--- a/litellm/llms/vertex_ai/batches/transformation.py
+++ b/litellm/llms/vertex_ai/batches/transformation.py
@@ -1,4 +1,4 @@
-import uuid
+from litellm._uuid import uuid
from typing import Dict
from litellm.llms.vertex_ai.common_utils import (
diff --git a/litellm/llms/vertex_ai/files/transformation.py b/litellm/llms/vertex_ai/files/transformation.py
index f2e5a5b5d25..01f6c86fd4d 100644
--- a/litellm/llms/vertex_ai/files/transformation.py
+++ b/litellm/llms/vertex_ai/files/transformation.py
@@ -1,7 +1,7 @@
import json
import os
import time
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, List, Optional, Tuple, Union
from httpx import Headers, Response
diff --git a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
index 9376b28cbec..dc3a6cf15e5 100644
--- a/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
+++ b/litellm/llms/vertex_ai/gemini/vertex_and_google_ai_studio_gemini.py
@@ -3,7 +3,7 @@
## Initial implementation - covers gemini + image gen calls
import json
import time
-import uuid
+from litellm._uuid import uuid
from copy import deepcopy
from functools import partial
from typing import (
diff --git a/litellm/main.py b/litellm/main.py
index 50de09c3dbf..f0b1820cbb5 100644
--- a/litellm/main.py
+++ b/litellm/main.py
@@ -17,7 +17,7 @@ import random
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from concurrent import futures
from concurrent.futures import FIRST_COMPLETED, ThreadPoolExecutor, wait
from copy import deepcopy
diff --git a/litellm/proxy/_experimental/mcp_server/db.py b/litellm/proxy/_experimental/mcp_server/db.py
index d5d9f978908..79e3b0f7623 100644
--- a/litellm/proxy/_experimental/mcp_server/db.py
+++ b/litellm/proxy/_experimental/mcp_server/db.py
@@ -1,4 +1,4 @@
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, Iterable, List, Optional, Set, Union
from litellm._logging import verbose_proxy_logger
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
index a92b7d8ad2e..6f2732af371 100644
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -1,6 +1,6 @@
import enum
import json
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from typing import (
TYPE_CHECKING,
diff --git a/litellm/proxy/client/cli/commands/auth.py b/litellm/proxy/client/cli/commands/auth.py
index 78cbb5ecf82..ff9f05fd32a 100644
--- a/litellm/proxy/client/cli/commands/auth.py
+++ b/litellm/proxy/client/cli/commands/auth.py
@@ -336,7 +336,7 @@ def _handle_team_assignment(base_url: str, api_key: str, user_id: str) -> None:
@click.pass_context
def login(ctx: click.Context):
"""Login to LiteLLM proxy using SSO authentication"""
- import uuid
+ from litellm._uuid import uuid
from litellm.constants import LITELLM_CLI_SOURCE_IDENTIFIER
from litellm.proxy.client.cli.interface import show_commands
diff --git a/litellm/proxy/db/db_transaction_queue/pod_lock_manager.py b/litellm/proxy/db/db_transaction_queue/pod_lock_manager.py
index 2dab963b02a..bb5424b0e90 100644
--- a/litellm/proxy/db/db_transaction_queue/pod_lock_manager.py
+++ b/litellm/proxy/db/db_transaction_queue/pod_lock_manager.py
@@ -1,5 +1,5 @@
import asyncio
-import uuid
+from litellm._uuid import uuid
from typing import TYPE_CHECKING, Any, Optional
from litellm._logging import verbose_proxy_logger
diff --git a/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py b/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py
index db72a9e9d29..8ca29506771 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/panw_prisma_airs/panw_prisma_airs.py
@@ -5,7 +5,7 @@ PANW Prisma AIRS Built-in Guardrail for LiteLLM
"""
import os
-import uuid
+from litellm._uuid import uuid
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Type, cast
from fastapi import HTTPException
diff --git a/litellm/proxy/guardrails/guardrail_hooks/presidio.py b/litellm/proxy/guardrails/guardrail_hooks/presidio.py
index e3f114c746f..38a17595c46 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/presidio.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/presidio.py
@@ -10,7 +10,7 @@
import asyncio
import json
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from typing import (
Any,
diff --git a/litellm/proxy/guardrails/guardrail_registry.py b/litellm/proxy/guardrails/guardrail_registry.py
index 69c8fd8084e..b5ae8437d86 100644
--- a/litellm/proxy/guardrails/guardrail_registry.py
+++ b/litellm/proxy/guardrails/guardrail_registry.py
@@ -2,7 +2,7 @@
import importlib
import os
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
from typing import Dict, List, Optional, Type, cast
diff --git a/litellm/proxy/hooks/key_management_event_hooks.py b/litellm/proxy/hooks/key_management_event_hooks.py
index 0289a929613..7ad1aaffc10 100644
--- a/litellm/proxy/hooks/key_management_event_hooks.py
+++ b/litellm/proxy/hooks/key_management_event_hooks.py
@@ -1,6 +1,6 @@
import asyncio
import json
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
from typing import Any, List, Optional
diff --git a/litellm/proxy/hooks/user_management_event_hooks.py b/litellm/proxy/hooks/user_management_event_hooks.py
index cc33f63837c..9579298e5c7 100644
--- a/litellm/proxy/hooks/user_management_event_hooks.py
+++ b/litellm/proxy/hooks/user_management_event_hooks.py
@@ -3,7 +3,7 @@ Hooks that are triggered when a litellm user event occurs
"""
import asyncio
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
from typing import Optional
diff --git a/litellm/proxy/management_endpoints/internal_user_endpoints.py b/litellm/proxy/management_endpoints/internal_user_endpoints.py
index 68e6342d6b6..66085b69b3d 100644
--- a/litellm/proxy/management_endpoints/internal_user_endpoints.py
+++ b/litellm/proxy/management_endpoints/internal_user_endpoints.py
@@ -14,7 +14,7 @@ These are members of a Team on LiteLLM
import asyncio
import json
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional, Union, cast
diff --git a/litellm/proxy/management_endpoints/key_management_endpoints.py b/litellm/proxy/management_endpoints/key_management_endpoints.py
index eb389450f91..aa56cc68a8a 100644
--- a/litellm/proxy/management_endpoints/key_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/key_management_endpoints.py
@@ -14,7 +14,7 @@ import copy
import json
import secrets
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timedelta, timezone
from typing import List, Literal, Optional, Tuple, cast
diff --git a/litellm/proxy/management_endpoints/model_management_endpoints.py b/litellm/proxy/management_endpoints/model_management_endpoints.py
index 9180e6100be..8f9c6edd2b7 100644
--- a/litellm/proxy/management_endpoints/model_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/model_management_endpoints.py
@@ -13,7 +13,7 @@ model/{model_id}/update - PATCH endpoint for model update.
import asyncio
import datetime
import json
-import uuid
+from litellm._uuid import uuid
from typing import Dict, List, Literal, Optional, Tuple, Union, cast
from fastapi import APIRouter, Depends, HTTPException, Request, status
diff --git a/litellm/proxy/management_endpoints/organization_endpoints.py b/litellm/proxy/management_endpoints/organization_endpoints.py
index c3fca196d57..2b52b6fc51c 100644
--- a/litellm/proxy/management_endpoints/organization_endpoints.py
+++ b/litellm/proxy/management_endpoints/organization_endpoints.py
@@ -11,7 +11,7 @@ Endpoints for /organization operations
#### ORGANIZATION MANAGEMENT ####
-import uuid
+from litellm._uuid import uuid
from typing import List, Optional, Tuple
from fastapi import APIRouter, Depends, HTTPException, Request, status
diff --git a/litellm/proxy/management_endpoints/scim/scim_v2.py b/litellm/proxy/management_endpoints/scim/scim_v2.py
index 6720f0c3b71..fd7d150a7f4 100644
--- a/litellm/proxy/management_endpoints/scim/scim_v2.py
+++ b/litellm/proxy/management_endpoints/scim/scim_v2.py
@@ -4,7 +4,7 @@
This is an enterprise feature and requires a premium license.
"""
-import uuid
+from litellm._uuid import uuid
from typing import Any, Dict, List, Optional, Set, Tuple
from fastapi import (
diff --git a/litellm/proxy/management_endpoints/team_endpoints.py b/litellm/proxy/management_endpoints/team_endpoints.py
index 97663863446..cbea3da1744 100644
--- a/litellm/proxy/management_endpoints/team_endpoints.py
+++ b/litellm/proxy/management_endpoints/team_endpoints.py
@@ -12,7 +12,7 @@ All /team management endpoints
import asyncio
import json
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
from typing import Any, Dict, List, Optional, Tuple, Union, cast
diff --git a/litellm/proxy/management_endpoints/ui_sso.py b/litellm/proxy/management_endpoints/ui_sso.py
index 2af940ec654..dc8b96656c4 100644
--- a/litellm/proxy/management_endpoints/ui_sso.py
+++ b/litellm/proxy/management_endpoints/ui_sso.py
@@ -10,7 +10,7 @@ Has all /sso/* routes
import asyncio
import os
-import uuid
+from litellm._uuid import uuid
from copy import deepcopy
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union, cast
diff --git a/litellm/proxy/management_helpers/audit_logs.py b/litellm/proxy/management_helpers/audit_logs.py
index b1b2fdf1ca9..ea082f468ae 100644
--- a/litellm/proxy/management_helpers/audit_logs.py
+++ b/litellm/proxy/management_helpers/audit_logs.py
@@ -3,7 +3,7 @@ Functions to create audit logs for LiteLLM Proxy
"""
import json
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
import litellm
diff --git a/litellm/proxy/management_helpers/object_permission_utils.py b/litellm/proxy/management_helpers/object_permission_utils.py
index 3b55974b7bf..5299bc9209d 100644
--- a/litellm/proxy/management_helpers/object_permission_utils.py
+++ b/litellm/proxy/management_helpers/object_permission_utils.py
@@ -4,7 +4,7 @@ organizations, teams, and keys.
"""
import json
-import uuid
+from litellm._uuid import uuid
from typing import Dict, Optional, Union
from litellm._logging import verbose_proxy_logger
diff --git a/litellm/proxy/management_helpers/utils.py b/litellm/proxy/management_helpers/utils.py
index 246fa0b6390..e25208a216a 100644
--- a/litellm/proxy/management_helpers/utils.py
+++ b/litellm/proxy/management_helpers/utils.py
@@ -1,6 +1,6 @@
# What is this?
## Helper utils for the management endpoints (keys/users/teams)
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from functools import wraps
from typing import Optional, Tuple
diff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
index a1f43d0ca50..628784f6f1f 100644
--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py
@@ -3,7 +3,7 @@ import asyncio
import copy
import json
import traceback
-import uuid
+from litellm._uuid import uuid
from base64 import b64encode
from datetime import datetime
from typing import Dict, List, Optional, Tuple, Union
@@ -922,7 +922,7 @@ def create_pass_through_route(
cost_per_request: Optional[float] = None,
):
# check if target is an adapter.py or a url
- import uuid
+ from litellm._uuid import uuid
from litellm.proxy.types_utils.utils import get_instance_fn
@@ -1123,7 +1123,7 @@ async def initialize_pass_through_endpoints(
Returns:
None
"""
- import uuid
+ from litellm._uuid import uuid
verbose_proxy_logger.debug("initializing pass through endpoints")
from litellm.proxy._types import CommonProxyErrors, LiteLLMRoutes
@@ -1366,7 +1366,7 @@ async def create_pass_through_endpoints(
"""
Create new pass-through endpoint
"""
- import uuid
+ from litellm._uuid import uuid
from litellm.proxy.proxy_server import (
get_config_general_settings,
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
index 7255161b8bc..9fff2478804 100644
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -9,7 +9,7 @@ import subprocess
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
import warnings
from datetime import datetime, timedelta
from typing import (
diff --git a/litellm/proxy/spend_tracking/spend_tracking_utils.py b/litellm/proxy/spend_tracking/spend_tracking_utils.py
index 8c59020bc24..7b78200b043 100644
--- a/litellm/proxy/spend_tracking/spend_tracking_utils.py
+++ b/litellm/proxy/spend_tracking/spend_tracking_utils.py
@@ -370,7 +370,7 @@ def _get_session_id_for_spend_log(
This ensures each spend log is associated with a unique session id.
"""
- import uuid
+ from litellm._uuid import uuid
if (
standard_logging_payload is not None
diff --git a/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py b/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
index e2ca3078384..8c11760904c 100644
--- a/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
+++ b/litellm/proxy/ui_crud_endpoints/proxy_setting_endpoints.py
@@ -671,7 +671,7 @@ async def upload_logo(file: UploadFile = File(...)):
os.makedirs(upload_dir, exist_ok=True)
# Generate unique filename
- import uuid
+ from litellm._uuid import uuid
unique_filename = f"logo_{uuid.uuid4().hex}{file_extension}"
file_path = os.path.join(upload_dir, unique_filename)
diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py
index f3affa707ae..036b3174b63 100644
--- a/litellm/proxy/utils.py
+++ b/litellm/proxy/utils.py
@@ -1308,7 +1308,7 @@ class ProxyLogging:
"litellm_logging_obj", None
)
if litellm_logging_obj is None:
- import uuid
+ from litellm._uuid import uuid
request_data["litellm_call_id"] = str(uuid.uuid4())
user_api_key_logged_metadata = (
diff --git a/litellm/responses/main.py b/litellm/responses/main.py
index d3cb5a7de2a..c190d8e2d21 100644
--- a/litellm/responses/main.py
+++ b/litellm/responses/main.py
@@ -211,7 +211,7 @@ async def aresponses_api_with_mcp(
# Handle MCP streaming if requested
if stream and mcp_tools_with_litellm_proxy:
# Generate MCP discovery events using the already processed tools
- import uuid
+ from litellm._uuid import uuid
from litellm.responses.mcp.mcp_streaming_iterator import (
create_mcp_list_tools_events,
diff --git a/litellm/responses/mcp/litellm_proxy_mcp_handler.py b/litellm/responses/mcp/litellm_proxy_mcp_handler.py
index 3e5ab38af2f..2600d53a171 100644
--- a/litellm/responses/mcp/litellm_proxy_mcp_handler.py
+++ b/litellm/responses/mcp/litellm_proxy_mcp_handler.py
@@ -630,7 +630,7 @@ class LiteLLM_Proxy_MCP_Handler:
Returns:
List of MCP tool execution events for streaming
"""
- import uuid
+ from litellm._uuid import uuid
from litellm.responses.mcp.mcp_streaming_iterator import create_mcp_call_events
@@ -714,7 +714,7 @@ class LiteLLM_Proxy_MCP_Handler:
"""Add custom output elements to the final response for MCP tool execution."""
# Import the required classes for creating output items
import json
- import uuid
+ from litellm._uuid import uuid
from litellm.types.responses.main import GenericResponseOutputItem, OutputText
diff --git a/litellm/responses/mcp/mcp_streaming_iterator.py b/litellm/responses/mcp/mcp_streaming_iterator.py
index 8045d1c1dca..7d53452c1c0 100644
--- a/litellm/responses/mcp/mcp_streaming_iterator.py
+++ b/litellm/responses/mcp/mcp_streaming_iterator.py
@@ -1,4 +1,4 @@
-import uuid
+from litellm._uuid import uuid
from typing import (
TYPE_CHECKING,
Any,
@@ -444,9 +444,6 @@ class MCPEnhancedStreamingIterator(BaseResponsesAPIStreamingIterator):
"""Generate tool execution events and execute tools"""
if not self.collected_response:
return
-
- import uuid
-
from litellm.responses.mcp.litellm_proxy_mcp_handler import (
LiteLLM_Proxy_MCP_Handler,
)
diff --git a/litellm/router.py b/litellm/router.py
index 1d6b4f5dd9b..9c87f0bb029 100644
--- a/litellm/router.py
+++ b/litellm/router.py
@@ -17,7 +17,7 @@ import logging
import threading
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from collections import defaultdict
from functools import lru_cache
from typing import (
diff --git a/litellm/secret_managers/aws_secret_manager_v2.py b/litellm/secret_managers/aws_secret_manager_v2.py
index 327dbf3d196..ff9921ebcb5 100644
--- a/litellm/secret_managers/aws_secret_manager_v2.py
+++ b/litellm/secret_managers/aws_secret_manager_v2.py
@@ -215,7 +215,7 @@ class AWSSecretsManagerV2(BaseAWSLLM, BaseSecretManager):
optional_params: Additional AWS parameters
timeout: Request timeout
"""
- import uuid
+ from litellm._uuid import uuid
# Prepare the request data
data = {"Name": secret_name, "SecretString": secret_value}
diff --git a/litellm/types/router.py b/litellm/types/router.py
index 8bed2bdccda..62f1c13eb4b 100644
--- a/litellm/types/router.py
+++ b/litellm/types/router.py
@@ -4,7 +4,7 @@ litellm.Router Types - includes RouterConfig, UpdateRouterConfig, ModelInfo etc
import datetime
import enum
-import uuid
+from litellm._uuid import uuid
from dataclasses import dataclass
from typing import Any, Dict, List, Literal, Optional, Tuple, Union, get_type_hints
diff --git a/litellm/types/services.py b/litellm/types/services.py
index e038100e279..78cb0cb3ceb 100644
--- a/litellm/types/services.py
+++ b/litellm/types/services.py
@@ -1,5 +1,5 @@
import enum
-import uuid
+from litellm._uuid import uuid
from typing import List, Optional
from pydantic import BaseModel, Field
diff --git a/tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py b/tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py
index a18af7a54d2..e2abf9c4c75 100644
--- a/tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py
+++ b/tests/enterprise/litellm_enterprise/enterprise_callbacks/test_prometheus_logging_callbacks.py
@@ -6,7 +6,7 @@ sys.path.insert(0, os.path.abspath("../.."))
import asyncio
import logging
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timedelta, timezone
from unittest.mock import MagicMock, call, patch
diff --git a/tests/guardrails_tests/test_guardrails_config.py b/tests/guardrails_tests/test_guardrails_config.py
index 110c0a30a9e..80b408a2dd1 100644
--- a/tests/guardrails_tests/test_guardrails_config.py
+++ b/tests/guardrails_tests/test_guardrails_config.py
@@ -6,7 +6,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
import pytest
diff --git a/tests/litellm_utils_tests/test_aws_secret_manager.py b/tests/litellm_utils_tests/test_aws_secret_manager.py
index e64c42b26c6..5aa608acb86 100644
--- a/tests/litellm_utils_tests/test_aws_secret_manager.py
+++ b/tests/litellm_utils_tests/test_aws_secret_manager.py
@@ -28,7 +28,7 @@ from typing import Optional
from unittest.mock import MagicMock, patch
import pytest
-import uuid
+from litellm._uuid import uuid
import json
from litellm.secret_managers.aws_secret_manager_v2 import AWSSecretsManagerV2
diff --git a/tests/litellm_utils_tests/test_hashicorp.py b/tests/litellm_utils_tests/test_hashicorp.py
index c61168c99dd..055112d88c0 100644
--- a/tests/litellm_utils_tests/test_hashicorp.py
+++ b/tests/litellm_utils_tests/test_hashicorp.py
@@ -13,7 +13,7 @@ sys.path.insert(
from unittest.mock import patch, MagicMock
import logging
from litellm._logging import verbose_logger
-import uuid
+from litellm._uuid import uuid
verbose_logger.setLevel(logging.DEBUG)
diff --git a/tests/litellm_utils_tests/test_secret_manager.py b/tests/litellm_utils_tests/test_secret_manager.py
index cc0977cc519..8c604fd2e68 100644
--- a/tests/litellm_utils_tests/test_secret_manager.py
+++ b/tests/litellm_utils_tests/test_secret_manager.py
@@ -2,7 +2,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
import json
diff --git a/tests/llm_responses_api_testing/base_responses_api.py b/tests/llm_responses_api_testing/base_responses_api.py
index 8436f130e1a..855aeff246c 100644
--- a/tests/llm_responses_api_testing/base_responses_api.py
+++ b/tests/llm_responses_api_testing/base_responses_api.py
@@ -5,7 +5,7 @@ import sys
from typing import Any, Dict, List
from unittest.mock import MagicMock, Mock, patch
import os
-import uuid
+from litellm._uuid import uuid
import time
import base64
diff --git a/tests/llm_translation/base_audio_transcription_unit_tests.py b/tests/llm_translation/base_audio_transcription_unit_tests.py
index 958a02d9f46..4ee00fd4e9f 100644
--- a/tests/llm_translation/base_audio_transcription_unit_tests.py
+++ b/tests/llm_translation/base_audio_transcription_unit_tests.py
@@ -5,7 +5,7 @@ import sys
from typing import Any, Dict, List
from unittest.mock import MagicMock, Mock, patch
import os
-import uuid
+from litellm._uuid import uuid
sys.path.insert(
0, os.path.abspath("../..")
diff --git a/tests/llm_translation/base_llm_unit_tests.py b/tests/llm_translation/base_llm_unit_tests.py
index e7f60b3caae..1419edaea42 100644
--- a/tests/llm_translation/base_llm_unit_tests.py
+++ b/tests/llm_translation/base_llm_unit_tests.py
@@ -5,7 +5,7 @@ import sys
from typing import Any, Dict, List
from unittest.mock import MagicMock, Mock, patch
import os
-import uuid
+from litellm._uuid import uuid
import time
import base64
import inspect
diff --git a/tests/local_testing/cache_unit_tests.py b/tests/local_testing/cache_unit_tests.py
index 8b82bbdfe66..d29eed33687 100644
--- a/tests/local_testing/cache_unit_tests.py
+++ b/tests/local_testing/cache_unit_tests.py
@@ -4,7 +4,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
diff --git a/tests/local_testing/test_add_update_models.py b/tests/local_testing/test_add_update_models.py
index 163687c1c21..6d7ae597b54 100644
--- a/tests/local_testing/test_add_update_models.py
+++ b/tests/local_testing/test_add_update_models.py
@@ -1,7 +1,7 @@
import sys, os
import traceback
import json
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
from fastapi import Request
from datetime import datetime
@@ -72,7 +72,7 @@ async def test_add_new_model(prisma_client):
await litellm.proxy.proxy_server.prisma_client.connect()
from litellm.proxy.proxy_server import user_api_key_cache
- import uuid
+ from litellm._uuid import uuid
_new_model_id = f"local-test-{uuid.uuid4().hex}"
@@ -121,7 +121,7 @@ async def test_add_update_model(prisma_client):
await litellm.proxy.proxy_server.prisma_client.connect()
from litellm.proxy.proxy_server import user_api_key_cache
- import uuid
+ from litellm._uuid import uuid
_new_model_id = f"local-test-{uuid.uuid4().hex}"
@@ -230,7 +230,7 @@ async def test_add_team_model_to_db(prisma_client):
from litellm.proxy.management_endpoints.model_management_endpoints import (
_add_team_model_to_db,
)
- import uuid
+ from litellm._uuid import uuid
new_team = await _create_new_team(prisma_client)
team_id = new_team.team_id
diff --git a/tests/local_testing/test_alangfuse.py b/tests/local_testing/test_alangfuse.py
index 2eea4264786..75dc07f9d5c 100644
--- a/tests/local_testing/test_alangfuse.py
+++ b/tests/local_testing/test_alangfuse.py
@@ -212,7 +212,7 @@ def create_async_task(**completion_kwargs):
@pytest.mark.flaky(retries=12, delay=2)
async def test_langfuse_logging_without_request_response(stream, langfuse_client):
try:
- import uuid
+ from litellm._uuid import uuid
_unique_trace_name = f"litellm-test-{str(uuid.uuid4())}"
litellm.set_verbose = True
@@ -276,7 +276,7 @@ async def test_langfuse_logging_audio_transcriptions(langfuse_client):
"""
Test that creates a trace with masked input and output
"""
- import uuid
+ from litellm._uuid import uuid
_unique_trace_name = f"litellm-test-{str(uuid.uuid4())}"
litellm.set_verbose = True
@@ -314,7 +314,7 @@ async def test_langfuse_masked_input_output(langfuse_client):
"""
Test that creates a trace with masked input and output
"""
- import uuid
+ from litellm._uuid import uuid
for mask_value in [True, False]:
_unique_trace_name = f"litellm-test-{str(uuid.uuid4())}"
@@ -364,7 +364,7 @@ async def test_aaalangfuse_logging_metadata(langfuse_client):
Release is just set for the trace
Tags is just set for the trace
"""
- import uuid
+ from litellm._uuid import uuid
litellm.set_verbose = True
litellm.success_callback = ["langfuse"]
@@ -939,7 +939,7 @@ def test_aaalangfuse_dynamic_logging():
Covers the team-logging scenario.
"""
- import uuid
+ from litellm._uuid import uuid
import langfuse
diff --git a/tests/local_testing/test_amazing_vertex_completion.py b/tests/local_testing/test_amazing_vertex_completion.py
index 2aae51110d3..ebaafcf43ba 100644
--- a/tests/local_testing/test_amazing_vertex_completion.py
+++ b/tests/local_testing/test_amazing_vertex_completion.py
@@ -2489,7 +2489,7 @@ def mock_gemini_list_request(*args, **kwargs):
return mock_response
-import uuid
+from litellm._uuid import uuid
@pytest.mark.parametrize(
diff --git a/tests/local_testing/test_audio_speech.py b/tests/local_testing/test_audio_speech.py
index 9e8817d6e62..1d9247f9981 100644
--- a/tests/local_testing/test_audio_speech.py
+++ b/tests/local_testing/test_audio_speech.py
@@ -7,7 +7,7 @@ import random
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
diff --git a/tests/local_testing/test_caching.py b/tests/local_testing/test_caching.py
index d1abec5ff70..39019ef35ac 100644
--- a/tests/local_testing/test_caching.py
+++ b/tests/local_testing/test_caching.py
@@ -2,7 +2,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
@@ -659,7 +659,7 @@ async def test_embedding_caching_base_64():
host=os.environ["REDIS_HOST"],
port=os.environ["REDIS_PORT"],
)
- import uuid
+ from litellm._uuid import uuid
inputs = [
f"{uuid.uuid4()} hello this is ishaan",
@@ -788,7 +788,7 @@ async def test_redis_batch_cache_write():
- read from client
"""
litellm.set_verbose = True
- import uuid
+ from litellm._uuid import uuid
messages = [
{"role": "user", "content": f"write a one sentence poem about: {uuid.uuid4()}"},
@@ -1479,7 +1479,7 @@ async def test_cache_control_overrides():
)
print("Testing cache override")
litellm.set_verbose = True
- import uuid
+ from litellm._uuid import uuid
unique_num = str(uuid.uuid4())
@@ -1527,7 +1527,7 @@ def test_sync_cache_control_overrides():
)
print("Testing cache override")
litellm.set_verbose = True
- import uuid
+ from litellm._uuid import uuid
unique_num = str(uuid.uuid4())
@@ -2050,7 +2050,7 @@ async def test_redis_proxy_batch_redis_get_cache():
user_api_key_cache = DualCache()
- import uuid
+ from litellm._uuid import uuid
batch_redis_get_obj.in_memory_cache = user_api_key_cache.in_memory_cache
@@ -2493,7 +2493,7 @@ def test_redis_caching_multiple_namespaces():
The same request with different namespaces should not be cached under the same key
"""
- import uuid
+ from litellm._uuid import uuid
from unittest.mock import patch, MagicMock
import litellm
from litellm.caching import Cache
@@ -2639,7 +2639,7 @@ def test_caching_with_reasoning_content():
Test that reasoning content is cached
"""
- import uuid
+ from litellm._uuid import uuid
messages = [{"role": "user", "content": f"what is litellm? {uuid.uuid4()}"}]
litellm.cache = Cache()
diff --git a/tests/local_testing/test_caching_handler.py b/tests/local_testing/test_caching_handler.py
index 1006d23df32..70217257a75 100644
--- a/tests/local_testing/test_caching_handler.py
+++ b/tests/local_testing/test_caching_handler.py
@@ -2,7 +2,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
diff --git a/tests/local_testing/test_custom_callback_input.py b/tests/local_testing/test_custom_callback_input.py
index 90d1d15c5a9..fb7ca510404 100644
--- a/tests/local_testing/test_custom_callback_input.py
+++ b/tests/local_testing/test_custom_callback_input.py
@@ -6,7 +6,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
import pytest
diff --git a/tests/local_testing/test_dual_cache.py b/tests/local_testing/test_dual_cache.py
index 657e00dae19..2da3df2783c 100644
--- a/tests/local_testing/test_dual_cache.py
+++ b/tests/local_testing/test_dual_cache.py
@@ -2,7 +2,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
diff --git a/tests/local_testing/test_dynamic_rate_limit_handler.py b/tests/local_testing/test_dynamic_rate_limit_handler.py
index 3f52e25389a..ff540e22e7a 100644
--- a/tests/local_testing/test_dynamic_rate_limit_handler.py
+++ b/tests/local_testing/test_dynamic_rate_limit_handler.py
@@ -6,7 +6,7 @@ import random
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from typing import Optional, Tuple
diff --git a/tests/local_testing/test_gcs_bucket.py b/tests/local_testing/test_gcs_bucket.py
index 0004fae7c48..5a9c99108c3 100644
--- a/tests/local_testing/test_gcs_bucket.py
+++ b/tests/local_testing/test_gcs_bucket.py
@@ -8,7 +8,7 @@ import asyncio
import json
import logging
import tempfile
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
import pytest
diff --git a/tests/local_testing/test_helicone_integration.py b/tests/local_testing/test_helicone_integration.py
index 3a6fa0309b1..4d77058598f 100644
--- a/tests/local_testing/test_helicone_integration.py
+++ b/tests/local_testing/test_helicone_integration.py
@@ -97,7 +97,7 @@ def create_async_task(**completion_kwargs):
reason="Authentication missing for openai",
)
async def test_helicone_logging_metadata():
- import uuid
+ from litellm._uuid import uuid
litellm.success_callback = ["helicone"]
diff --git a/tests/local_testing/test_langsmith.py b/tests/local_testing/test_langsmith.py
index ff4c677d164..af7ac46a1cf 100644
--- a/tests/local_testing/test_langsmith.py
+++ b/tests/local_testing/test_langsmith.py
@@ -6,7 +6,7 @@ sys.path.insert(0, os.path.abspath("../.."))
import asyncio
import logging
-import uuid
+from litellm._uuid import uuid
import pytest
diff --git a/tests/local_testing/test_mem_usage.py b/tests/local_testing/test_mem_usage.py
index 9f18fb1e2d6..f91852899ad 100644
--- a/tests/local_testing/test_mem_usage.py
+++ b/tests/local_testing/test_mem_usage.py
@@ -13,7 +13,7 @@
# from concurrent.futures import ThreadPoolExecutor
# from collections import defaultdict
# from dotenv import load_dotenv
-# import uuid
+# from litellm._uuid import uuid
# import tracemalloc
# import objgraph
diff --git a/tests/local_testing/test_pass_through_endpoints.py b/tests/local_testing/test_pass_through_endpoints.py
index 6cc6a66007f..9c5f5995218 100644
--- a/tests/local_testing/test_pass_through_endpoints.py
+++ b/tests/local_testing/test_pass_through_endpoints.py
@@ -1,6 +1,6 @@
import os
import sys
-import uuid
+from litellm._uuid import uuid
from functools import partial
from typing import Optional
diff --git a/tests/local_testing/test_router_timeout.py b/tests/local_testing/test_router_timeout.py
index 8ca58f84455..882c1684356 100644
--- a/tests/local_testing/test_router_timeout.py
+++ b/tests/local_testing/test_router_timeout.py
@@ -96,7 +96,7 @@ def test_router_timeouts():
@pytest.mark.asyncio
async def test_router_timeouts_bedrock():
- import uuid
+ from litellm._uuid import uuid
import openai
diff --git a/tests/local_testing/test_streaming.py b/tests/local_testing/test_streaming.py
index 5ce437a49d4..630ae2b184f 100644
--- a/tests/local_testing/test_streaming.py
+++ b/tests/local_testing/test_streaming.py
@@ -7,7 +7,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from typing import Tuple
from unittest.mock import AsyncMock, MagicMock, patch
@@ -2784,7 +2784,7 @@ def test_azure_streaming_and_function_calling():
@pytest.mark.asyncio
async def test_azure_astreaming_and_function_calling():
- import uuid
+ from litellm._uuid import uuid
tools = [
{
diff --git a/tests/local_testing/test_timeout.py b/tests/local_testing/test_timeout.py
index 2f8050affed..007c32e4476 100644
--- a/tests/local_testing/test_timeout.py
+++ b/tests/local_testing/test_timeout.py
@@ -9,7 +9,7 @@ sys.path.insert(
0, os.path.abspath("../..")
) # Adds the parent directory to the system path
import time
-import uuid
+from litellm._uuid import uuid
import httpx
import openai
diff --git a/tests/local_testing/test_unit_test_caching.py b/tests/local_testing/test_unit_test_caching.py
index 033fb774f0c..fa5cf802546 100644
--- a/tests/local_testing/test_unit_test_caching.py
+++ b/tests/local_testing/test_unit_test_caching.py
@@ -2,7 +2,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
diff --git a/tests/logging_callback_tests/test_alerting.py b/tests/logging_callback_tests/test_alerting.py
index e431f99129f..b9ecfaeb3f0 100644
--- a/tests/logging_callback_tests/test_alerting.py
+++ b/tests/logging_callback_tests/test_alerting.py
@@ -8,7 +8,7 @@ import os
import random
import sys
import time
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timedelta
from typing import Optional
diff --git a/tests/logging_callback_tests/test_built_in_tools_cost_tracking.py b/tests/logging_callback_tests/test_built_in_tools_cost_tracking.py
index 4d0f1accaba..bd1465f1564 100644
--- a/tests/logging_callback_tests/test_built_in_tools_cost_tracking.py
+++ b/tests/logging_callback_tests/test_built_in_tools_cost_tracking.py
@@ -1,7 +1,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
import pytest
from dotenv import load_dotenv
from fastapi import Request
@@ -98,7 +98,7 @@ async def test_openai_web_search_logging_cost_tracking(
):
"""Test web search cost tracking with different search context sizes"""
test_custom_logger = await _setup_web_search_test()
- import uuid
+ from litellm._uuid import uuid
diff --git a/tests/logging_callback_tests/test_langfuse_e2e_test.py b/tests/logging_callback_tests/test_langfuse_e2e_test.py
index 8d5e63fcdc0..3e76a685630 100644
--- a/tests/logging_callback_tests/test_langfuse_e2e_test.py
+++ b/tests/logging_callback_tests/test_langfuse_e2e_test.py
@@ -119,7 +119,7 @@ class TestLangfuseLogging:
@pytest.fixture
async def mock_setup(self):
"""Common setup for Langfuse logging tests"""
- import uuid
+ from litellm._uuid import uuid
from unittest.mock import AsyncMock, patch
import httpx
diff --git a/tests/logging_callback_tests/test_moderations_api_logging.py b/tests/logging_callback_tests/test_moderations_api_logging.py
index 1d3b5356b0f..5e2011afbba 100644
--- a/tests/logging_callback_tests/test_moderations_api_logging.py
+++ b/tests/logging_callback_tests/test_moderations_api_logging.py
@@ -1,7 +1,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
import pytest
from dotenv import load_dotenv
from fastapi import Request
diff --git a/tests/logging_callback_tests/test_spend_logs.py b/tests/logging_callback_tests/test_spend_logs.py
index 881e170f8aa..500419eb04d 100644
--- a/tests/logging_callback_tests/test_spend_logs.py
+++ b/tests/logging_callback_tests/test_spend_logs.py
@@ -1,7 +1,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
from fastapi import Request
diff --git a/tests/logging_callback_tests/test_token_counting.py b/tests/logging_callback_tests/test_token_counting.py
index 1a44229140a..6f84b7c18fe 100644
--- a/tests/logging_callback_tests/test_token_counting.py
+++ b/tests/logging_callback_tests/test_token_counting.py
@@ -1,7 +1,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
import pytest
from dotenv import load_dotenv
from fastapi import Request
diff --git a/tests/logging_callback_tests/test_view_request_resp_logs.py b/tests/logging_callback_tests/test_view_request_resp_logs.py
index a8018b62ee2..34e8d01303a 100644
--- a/tests/logging_callback_tests/test_view_request_resp_logs.py
+++ b/tests/logging_callback_tests/test_view_request_resp_logs.py
@@ -8,7 +8,7 @@ import asyncio
import json
import logging
import tempfile
-import uuid
+from litellm._uuid import uuid
import json
from datetime import datetime, timedelta, timezone
diff --git a/tests/multi_instance_e2e_tests/test_update_team_e2e.py b/tests/multi_instance_e2e_tests/test_update_team_e2e.py
index c4769aa6a57..dfbfbd310ee 100644
--- a/tests/multi_instance_e2e_tests/test_update_team_e2e.py
+++ b/tests/multi_instance_e2e_tests/test_update_team_e2e.py
@@ -52,7 +52,7 @@ async def chat_completion_on_port(
Accepts an optional prompt string.
"""
from openai import AsyncOpenAI
- import uuid
+ from litellm._uuid import uuid
if prompt is None:
prompt = f"Say hello! {uuid.uuid4()}" * 100
diff --git a/tests/old_proxy_tests/tests/bursty_load_test_completion.py b/tests/old_proxy_tests/tests/bursty_load_test_completion.py
index 529f2ce9f69..642bd9f14d4 100644
--- a/tests/old_proxy_tests/tests/bursty_load_test_completion.py
+++ b/tests/old_proxy_tests/tests/bursty_load_test_completion.py
@@ -1,6 +1,6 @@
import time, asyncio
from openai import AsyncOpenAI
-import uuid
+from litellm._uuid import uuid
import traceback
diff --git a/tests/old_proxy_tests/tests/load_test_completion.py b/tests/old_proxy_tests/tests/load_test_completion.py
index 29d8924ab5f..afbd74a7900 100644
--- a/tests/old_proxy_tests/tests/load_test_completion.py
+++ b/tests/old_proxy_tests/tests/load_test_completion.py
@@ -2,7 +2,7 @@ import time
import asyncio
import os
from openai import AsyncOpenAI, AsyncAzureOpenAI
-import uuid
+from litellm._uuid import uuid
import traceback
from large_text import text
from dotenv import load_dotenv
diff --git a/tests/old_proxy_tests/tests/load_test_embedding_100.py b/tests/old_proxy_tests/tests/load_test_embedding_100.py
index 38ae8990aaa..8cd4d250249 100644
--- a/tests/old_proxy_tests/tests/load_test_embedding_100.py
+++ b/tests/old_proxy_tests/tests/load_test_embedding_100.py
@@ -1,6 +1,6 @@
import time, asyncio
from openai import AsyncOpenAI
-import uuid
+from litellm._uuid import uuid
import traceback
diff --git a/tests/old_proxy_tests/tests/test_simple_traceparent_openai.py b/tests/old_proxy_tests/tests/test_simple_traceparent_openai.py
index caa10051abf..d4c36029948 100644
--- a/tests/old_proxy_tests/tests/test_simple_traceparent_openai.py
+++ b/tests/old_proxy_tests/tests/test_simple_traceparent_openai.py
@@ -1,5 +1,5 @@
# mypy: ignore-errors
-import uuid
+from litellm._uuid import uuid
import openai
diff --git a/tests/otel_tests/test_e2e_budgeting.py b/tests/otel_tests/test_e2e_budgeting.py
index 8af9fa9cbd4..e3b4c8b2b55 100644
--- a/tests/otel_tests/test_e2e_budgeting.py
+++ b/tests/otel_tests/test_e2e_budgeting.py
@@ -61,7 +61,7 @@ async def generate_key(
async def chat_completion(session, key: str, model: str):
"""Make a chat completion request using OpenAI SDK"""
from openai import AsyncOpenAI
- import uuid
+ from litellm._uuid import uuid
client = AsyncOpenAI(
api_key=key, base_url="http://0.0.0.0:4000/v1" # Point to our local proxy
diff --git a/tests/otel_tests/test_e2e_model_access.py b/tests/otel_tests/test_e2e_model_access.py
index 4628dc7e9c8..ade319c2d43 100644
--- a/tests/otel_tests/test_e2e_model_access.py
+++ b/tests/otel_tests/test_e2e_model_access.py
@@ -35,7 +35,7 @@ async def generate_team(session, models: Optional[List[str]] = None):
async def mock_chat_completion(session, key: str, model: str):
"""Make a chat completion request using OpenAI SDK"""
from openai import AsyncOpenAI
- import uuid
+ from litellm._uuid import uuid
client = AsyncOpenAI(api_key=key, base_url="http://0.0.0.0:4000/v1")
diff --git a/tests/otel_tests/test_guardrails.py b/tests/otel_tests/test_guardrails.py
index cfad6985a0f..5345944bcb1 100644
--- a/tests/otel_tests/test_guardrails.py
+++ b/tests/otel_tests/test_guardrails.py
@@ -4,7 +4,7 @@ import aiohttp, openai
from openai import OpenAI, AsyncOpenAI
from typing import Optional, List, Union
import json
-import uuid
+from litellm._uuid import uuid
async def chat_completion(
diff --git a/tests/otel_tests/test_moderations.py b/tests/otel_tests/test_moderations.py
index 21abf748922..a0218b039fa 100644
--- a/tests/otel_tests/test_moderations.py
+++ b/tests/otel_tests/test_moderations.py
@@ -3,7 +3,7 @@ import asyncio
import aiohttp, openai
from openai import OpenAI, AsyncOpenAI
from typing import Optional, List, Union
-import uuid
+from litellm._uuid import uuid
async def make_moderations_curl_request(
diff --git a/tests/otel_tests/test_otel.py b/tests/otel_tests/test_otel.py
index b252fcb5b57..e546b7d4a9d 100644
--- a/tests/otel_tests/test_otel.py
+++ b/tests/otel_tests/test_otel.py
@@ -5,7 +5,7 @@ import asyncio
import aiohttp, openai
from openai import OpenAI, AsyncOpenAI
from typing import Optional, List, Union
-import uuid
+from litellm._uuid import uuid
async def generate_key(
diff --git a/tests/otel_tests/test_prometheus.py b/tests/otel_tests/test_prometheus.py
index 4e459508cc8..69c1f9413e3 100644
--- a/tests/otel_tests/test_prometheus.py
+++ b/tests/otel_tests/test_prometheus.py
@@ -5,7 +5,7 @@ Unit tests for prometheus metrics
import pytest
import aiohttp
import asyncio
-import uuid
+from litellm._uuid import uuid
import os
import sys
from openai import AsyncOpenAI
diff --git a/tests/otel_tests/test_rerank.py b/tests/otel_tests/test_rerank.py
index 47fe109e7f6..f04d82442a3 100644
--- a/tests/otel_tests/test_rerank.py
+++ b/tests/otel_tests/test_rerank.py
@@ -3,7 +3,7 @@ import asyncio
import aiohttp, openai
from openai import OpenAI, AsyncOpenAI
from typing import Optional, List, Union
-import uuid
+from litellm._uuid import uuid
async def make_rerank_curl_request(
diff --git a/tests/otel_tests/test_team_member_permissions.py b/tests/otel_tests/test_team_member_permissions.py
index 3b266a9e68d..d8187e2bc15 100644
--- a/tests/otel_tests/test_team_member_permissions.py
+++ b/tests/otel_tests/test_team_member_permissions.py
@@ -45,7 +45,7 @@
import pytest
import asyncio
import aiohttp, openai
-import uuid
+from litellm._uuid import uuid
import json
from litellm.proxy._types import ProxyErrorTypes
from typing import Optional
diff --git a/tests/otel_tests/test_team_tag_routing.py b/tests/otel_tests/test_team_tag_routing.py
index 842b76d946e..17570e7363c 100644
--- a/tests/otel_tests/test_team_tag_routing.py
+++ b/tests/otel_tests/test_team_tag_routing.py
@@ -5,7 +5,7 @@ import asyncio
import aiohttp, openai
from openai import OpenAI, AsyncOpenAI
from typing import Optional, List, Union
-import uuid
+from litellm._uuid import uuid
LITELLM_MASTER_KEY = "sk-1234"
diff --git a/tests/proxy_admin_ui_tests/test_key_management.py b/tests/proxy_admin_ui_tests/test_key_management.py
index b3522c88164..589a394cbbc 100644
--- a/tests/proxy_admin_ui_tests/test_key_management.py
+++ b/tests/proxy_admin_ui_tests/test_key_management.py
@@ -1,7 +1,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
import datetime as dt
from datetime import datetime
@@ -228,7 +228,7 @@ async def test_regenerate_api_key_with_new_alias_and_expiration(prisma_client):
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
setattr(litellm.proxy.proxy_server, "master_key", "sk-1234")
await litellm.proxy.proxy_server.prisma_client.connect()
- import uuid
+ from litellm._uuid import uuid
# generate new key
key_alias = f"test_alias_regenerate_key-{uuid.uuid4()}"
@@ -279,7 +279,7 @@ async def test_regenerate_key_ui(prisma_client):
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
setattr(litellm.proxy.proxy_server, "master_key", "sk-1234")
await litellm.proxy.proxy_server.prisma_client.connect()
- import uuid
+ from litellm._uuid import uuid
# generate new key
key_alias = f"test_alias_regenerate_key-{uuid.uuid4()}"
@@ -1076,7 +1076,7 @@ async def test_list_key_helper_team_filtering(prisma_client):
from litellm.proxy.management_endpoints.key_management_endpoints import (
_list_key_helper,
)
- import uuid
+ from litellm._uuid import uuid
# Setup
setattr(litellm.proxy.proxy_server, "prisma_client", prisma_client)
diff --git a/tests/proxy_admin_ui_tests/test_role_based_access.py b/tests/proxy_admin_ui_tests/test_role_based_access.py
index a1c4e9a399a..6d3fb357499 100644
--- a/tests/proxy_admin_ui_tests/test_role_based_access.py
+++ b/tests/proxy_admin_ui_tests/test_role_based_access.py
@@ -5,7 +5,7 @@ RBAC tests
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from dotenv import load_dotenv
diff --git a/tests/proxy_admin_ui_tests/test_route_check_unit_tests.py b/tests/proxy_admin_ui_tests/test_route_check_unit_tests.py
index 8f758884683..dacda602c01 100644
--- a/tests/proxy_admin_ui_tests/test_route_check_unit_tests.py
+++ b/tests/proxy_admin_ui_tests/test_route_check_unit_tests.py
@@ -1,7 +1,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
import datetime as dt
from datetime import datetime
diff --git a/tests/proxy_admin_ui_tests/test_sso_sign_in.py b/tests/proxy_admin_ui_tests/test_sso_sign_in.py
index 28e0cbf8cc5..83bddf5b8b2 100644
--- a/tests/proxy_admin_ui_tests/test_sso_sign_in.py
+++ b/tests/proxy_admin_ui_tests/test_sso_sign_in.py
@@ -60,7 +60,7 @@ async def test_auth_callback_new_user(mock_google_sso, mock_env_vars, prisma_cli
"""
Tests that a new SSO Sign In user is by default given an 'INTERNAL_USER_VIEW_ONLY' role
"""
- import uuid
+ from litellm._uuid import uuid
import litellm
litellm._turn_on_debug()
@@ -133,7 +133,7 @@ async def test_auth_callback_new_user_with_sso_default(
Tests that a new SSO Sign In user is by default given an 'INTERNAL_USER' role
"""
- import uuid
+ from litellm._uuid import uuid
# Generate a unique user ID
unique_user_id = str(uuid.uuid4())
diff --git a/tests/proxy_admin_ui_tests/test_usage_endpoints.py b/tests/proxy_admin_ui_tests/test_usage_endpoints.py
index 61d4e944936..3d3360b8ff6 100644
--- a/tests/proxy_admin_ui_tests/test_usage_endpoints.py
+++ b/tests/proxy_admin_ui_tests/test_usage_endpoints.py
@@ -16,7 +16,7 @@ For all tests - test the following:
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from dotenv import load_dotenv
diff --git a/tests/proxy_unit_tests/test_audit_logs_proxy.py b/tests/proxy_unit_tests/test_audit_logs_proxy.py
index a4506950dd1..ec7d42805d2 100644
--- a/tests/proxy_unit_tests/test_audit_logs_proxy.py
+++ b/tests/proxy_unit_tests/test_audit_logs_proxy.py
@@ -1,7 +1,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from dotenv import load_dotenv
@@ -24,7 +24,7 @@ import logging
load_dotenv()
import pytest
-import uuid
+from litellm._uuid import uuid
import litellm
from litellm._logging import verbose_proxy_logger
diff --git a/tests/proxy_unit_tests/test_custom_callback_input.py b/tests/proxy_unit_tests/test_custom_callback_input.py
index d98c7619e32..71a7e94b180 100644
--- a/tests/proxy_unit_tests/test_custom_callback_input.py
+++ b/tests/proxy_unit_tests/test_custom_callback_input.py
@@ -6,7 +6,7 @@ import os
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
import pytest
diff --git a/tests/proxy_unit_tests/test_e2e_pod_lock_manager.py b/tests/proxy_unit_tests/test_e2e_pod_lock_manager.py
index 5f4a16f4a0e..e52e8816a30 100644
--- a/tests/proxy_unit_tests/test_e2e_pod_lock_manager.py
+++ b/tests/proxy_unit_tests/test_e2e_pod_lock_manager.py
@@ -1,7 +1,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
from typing import List
from datetime import datetime, timezone, timedelta
@@ -379,7 +379,7 @@ async def test_e2e_size_of_redis_buffer():
from litellm.proxy.db.db_spend_update_writer import DBSpendUpdateWriter
from litellm.proxy.db.db_transaction_queue.base_update_queue import BaseUpdateQueue
from litellm.caching import RedisCache
- import uuid
+ from litellm._uuid import uuid
redis_cache = RedisCache(host=os.getenv("REDIS_HOST"), port=os.getenv("REDIS_PORT"), password=os.getenv("REDIS_PASSWORD"))
diff --git a/tests/proxy_unit_tests/test_jwt.py b/tests/proxy_unit_tests/test_jwt.py
index 57514817e88..2e54ade688f 100644
--- a/tests/proxy_unit_tests/test_jwt.py
+++ b/tests/proxy_unit_tests/test_jwt.py
@@ -7,7 +7,7 @@ import random
import sys
import time
import traceback
-import uuid
+from litellm._uuid import uuid
from dotenv import load_dotenv
@@ -240,7 +240,7 @@ def prisma_client():
@pytest.fixture
def team_token_tuple():
import json
- import uuid
+ from litellm._uuid import uuid
import jwt
from cryptography.hazmat.backends import default_backend
@@ -305,7 +305,7 @@ def team_token_tuple():
@pytest.mark.asyncio
async def test_team_token_output(prisma_client, audience, monkeypatch):
import json
- import uuid
+ from litellm._uuid import uuid
import jwt
from cryptography.hazmat.backends import default_backend
@@ -478,7 +478,7 @@ async def test_team_token_output(prisma_client, audience, monkeypatch):
async def aaaatest_user_token_output(
prisma_client, audience, team_id_set, default_team_id, user_id_upsert, monkeypatch
):
- import uuid
+ from litellm._uuid import uuid
args = locals()
print(f"received args - {args}")
@@ -491,7 +491,7 @@ async def aaaatest_user_token_output(
- retry -> it should pass now
"""
import json
- import uuid
+ from litellm._uuid import uuid
import jwt
from cryptography.hazmat.backends import default_backend
@@ -726,7 +726,7 @@ async def test_allowed_routes_admin(
- check if admin passes user_api_key_auth for them
"""
import json
- import uuid
+ from litellm._uuid import uuid
import jwt
from cryptography.hazmat.backends import default_backend
diff --git a/tests/proxy_unit_tests/test_key_generate_prisma.py b/tests/proxy_unit_tests/test_key_generate_prisma.py
index be29ce1e343..6eb4efa7d63 100644
--- a/tests/proxy_unit_tests/test_key_generate_prisma.py
+++ b/tests/proxy_unit_tests/test_key_generate_prisma.py
@@ -22,7 +22,7 @@
import os
import sys
import traceback
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
from dotenv import load_dotenv
@@ -1236,7 +1236,7 @@ def test_generate_and_update_key(prisma_client):
# 11. Generate a Key, cal key/info, call key/update, call key/info
# Check if data gets updated
# Check if untouched data does not get updated
- import uuid
+ from litellm._uuid import uuid
print("prisma client=", prisma_client)
@@ -1554,7 +1554,7 @@ def test_call_with_key_over_budget(prisma_client):
litellm.cache = Cache()
import time
- import uuid
+ from litellm._uuid import uuid
request_id = f"chatcmpl-e41836bb-bb8b-4df2-8e70-8f3e160155ac{uuid.uuid4()}"
@@ -1676,7 +1676,7 @@ def test_call_with_key_over_budget_no_cache(prisma_client):
litellm.cache = Cache()
import time
- import uuid
+ from litellm._uuid import uuid
request_id = f"chatcmpl-e41836bb-bb8b-4df2-8e70-8f3e160155ac{uuid.uuid4()}"
@@ -1900,7 +1900,7 @@ async def test_call_with_key_never_over_budget(prisma_client):
# update spend using track_cost callback, make 2nd request, it should fail
import time
- import uuid
+ from litellm._uuid import uuid
from litellm import Choices, Message, ModelResponse, Usage
from litellm.proxy.proxy_server import _ProxyDBLogger
@@ -1991,7 +1991,7 @@ async def test_call_with_key_over_budget_stream(prisma_client):
# update spend using track_cost callback, make 2nd request, it should fail
import time
- import uuid
+ from litellm._uuid import uuid
from litellm import Choices, Message, ModelResponse, Usage
from litellm.proxy.proxy_server import _ProxyDBLogger
@@ -2440,7 +2440,7 @@ async def test_key_with_no_permissions(prisma_client):
async def track_cost_callback_helper_fn(generated_key: str, user_id: str):
- import uuid
+ from litellm._uuid import uuid
from litellm import Choices, Message, ModelResponse, Usage
from litellm.proxy.proxy_server import _ProxyDBLogger
@@ -2549,7 +2549,7 @@ async def test_proxy_load_test_db(prisma_client):
@pytest.mark.asyncio()
async def test_master_key_hashing(prisma_client):
try:
- import uuid
+ from litellm._uuid import uuid
print("prisma client=", prisma_client)
diff --git a/tests/proxy_unit_tests/test_proxy_server.py b/tests/proxy_unit_tests/test_proxy_server.py
index 139c90fd3cb..4e72580b8be 100644
--- a/tests/proxy_unit_tests/test_proxy_server.py
+++ b/tests/proxy_unit_tests/test_proxy_server.py
@@ -928,7 +928,7 @@ async def test_get_team_redis(client_no_auth):
import random
-import uuid
+from litellm._uuid import uuid
from unittest.mock import AsyncMock, MagicMock, PropertyMock, patch
from litellm.proxy._types import (
diff --git a/tests/spend_tracking_tests/test_spend_accuracy_tests.py b/tests/spend_tracking_tests/test_spend_accuracy_tests.py
index 93228c2d06a..821709250da 100644
--- a/tests/spend_tracking_tests/test_spend_accuracy_tests.py
+++ b/tests/spend_tracking_tests/test_spend_accuracy_tests.py
@@ -4,7 +4,7 @@ import aiohttp
import json
from httpx import AsyncClient
from typing import Any, Optional
-import uuid
+from litellm._uuid import uuid
"""
Tests to run
@@ -89,7 +89,7 @@ async def generate_key(session, user_id: str, team_id: str):
async def chat_completion(session, key: str):
"""Make a chat completion request"""
from openai import AsyncOpenAI
- import uuid
+ from litellm._uuid import uuid
client = AsyncOpenAI(api_key=key, base_url="http://0.0.0.0:4000/v1")
diff --git a/tests/store_model_in_db_tests/test_mcp_servers.py b/tests/store_model_in_db_tests/test_mcp_servers.py
index 7a524c16d22..a396c37832a 100644
--- a/tests/store_model_in_db_tests/test_mcp_servers.py
+++ b/tests/store_model_in_db_tests/test_mcp_servers.py
@@ -1,7 +1,7 @@
from datetime import datetime
from typing import List, Optional
import pytest
-import uuid
+from litellm._uuid import uuid
import os
import asyncio
from unittest import mock
diff --git a/tests/store_model_in_db_tests/test_team_models.py b/tests/store_model_in_db_tests/test_team_models.py
index 0faa01c8ee7..83822433a63 100644
--- a/tests/store_model_in_db_tests/test_team_models.py
+++ b/tests/store_model_in_db_tests/test_team_models.py
@@ -3,9 +3,9 @@ import asyncio
import aiohttp
import json
from openai import AsyncOpenAI
-import uuid
+from litellm._uuid import uuid
from httpx import AsyncClient
-import uuid
+from litellm._uuid import uuid
import os
TEST_MASTER_KEY = "sk-1234"
diff --git a/tests/test_budget_management.py b/tests/test_budget_management.py
index 8175a9b1df4..5863cea9d3b 100644
--- a/tests/test_budget_management.py
+++ b/tests/test_budget_management.py
@@ -1,6 +1,6 @@
# What is this?
## Unit tests for the /budget/* endpoints
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timedelta
import aiohttp
diff --git a/tests/test_callbacks_on_proxy.py b/tests/test_callbacks_on_proxy.py
index 42665c35bce..831ca449f83 100644
--- a/tests/test_callbacks_on_proxy.py
+++ b/tests/test_callbacks_on_proxy.py
@@ -108,7 +108,7 @@ async def test_check_num_callbacks():
-> sleep for 30 seconds
-> check current callbacks
"""
- import uuid
+ from litellm._uuid import uuid
async with aiohttp.ClientSession() as session:
await asyncio.sleep(30)
@@ -158,7 +158,7 @@ async def test_check_num_callbacks_on_lowest_latency():
-> check current callbacks
-> update back to original routing-strategy
"""
- import uuid
+ from litellm._uuid import uuid
async with aiohttp.ClientSession() as session:
await asyncio.sleep(30)
diff --git a/tests/test_config.py b/tests/test_config.py
index 76316368f6c..8ec65341963 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -83,7 +83,7 @@ async def test_team_logging():
await config_update(session)
# 2. Call /chat/completions with a specific trace id
- import uuid
+ from litellm._uuid import uuid
_trace_id = f"trace-{uuid.uuid4()}"
_request_metadata = {
diff --git a/tests/test_end_users.py b/tests/test_end_users.py
index 0ce1694147b..c175bb371e2 100644
--- a/tests/test_end_users.py
+++ b/tests/test_end_users.py
@@ -4,7 +4,7 @@ import pytest
import asyncio
import aiohttp
import time
-import uuid
+from litellm._uuid import uuid
from openai import AsyncOpenAI
from typing import Optional
diff --git a/tests/test_litellm/integrations/test_deepeval.py b/tests/test_litellm/integrations/test_deepeval.py
index 26e79585c91..6dd3aef0a03 100644
--- a/tests/test_litellm/integrations/test_deepeval.py
+++ b/tests/test_litellm/integrations/test_deepeval.py
@@ -1,6 +1,6 @@
import os
import unittest
-import uuid
+from litellm._uuid import uuid
from datetime import datetime, timezone
from unittest.mock import MagicMock, patch
diff --git a/tests/test_litellm/llms/bedrock/invoke_agent/test_bedrock_agent_transformation.py b/tests/test_litellm/llms/bedrock/invoke_agent/test_bedrock_agent_transformation.py
index ef2bb3757fc..ffd3526698a 100644
--- a/tests/test_litellm/llms/bedrock/invoke_agent/test_bedrock_agent_transformation.py
+++ b/tests/test_litellm/llms/bedrock/invoke_agent/test_bedrock_agent_transformation.py
@@ -2,7 +2,7 @@ import base64
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from unittest.mock import MagicMock, Mock, patch
import pytest
diff --git a/tests/test_litellm/llms/ollama/test_ollama_completion_transformation.py b/tests/test_litellm/llms/ollama/test_ollama_completion_transformation.py
index 452f5a94024..39386fe4fd2 100644
--- a/tests/test_litellm/llms/ollama/test_ollama_completion_transformation.py
+++ b/tests/test_litellm/llms/ollama/test_ollama_completion_transformation.py
@@ -1,7 +1,7 @@
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from unittest.mock import MagicMock, patch
import pytest
diff --git a/tests/test_litellm/proxy/management_endpoints/scim/test_scim_transformations.py b/tests/test_litellm/proxy/management_endpoints/scim/test_scim_transformations.py
index be24444afaf..bacdfb225fb 100644
--- a/tests/test_litellm/proxy/management_endpoints/scim/test_scim_transformations.py
+++ b/tests/test_litellm/proxy/management_endpoints/scim/test_scim_transformations.py
@@ -2,7 +2,7 @@ import asyncio
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from typing import Optional, cast
from unittest.mock import AsyncMock, MagicMock, patch
diff --git a/tests/test_litellm/proxy/management_endpoints/test_mcp_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_mcp_management_endpoints.py
index f1594c36e7e..215e0d050a3 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_mcp_management_endpoints.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_mcp_management_endpoints.py
@@ -1,7 +1,7 @@
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from datetime import datetime
from typing import List
from unittest.mock import AsyncMock, MagicMock, patch
diff --git a/tests/test_litellm/proxy/management_endpoints/test_model_management_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_model_management_endpoints.py
index bd37e9cbe41..2f736e4e1d1 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_model_management_endpoints.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_model_management_endpoints.py
@@ -1,7 +1,7 @@
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from typing import Dict, Optional
from unittest.mock import AsyncMock, MagicMock, patch
diff --git a/tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py
index c05e528846d..981c26d6db9 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_organization_endpoints.py
@@ -2,7 +2,7 @@ import asyncio
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from typing import Optional, cast
from unittest.mock import AsyncMock, MagicMock, patch
diff --git a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py
index 84454160572..c895e016e3e 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_team_endpoints.py
@@ -2,7 +2,7 @@ import asyncio
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from typing import Optional, cast
from unittest.mock import AsyncMock, MagicMock, patch
diff --git a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py
index 639b4756533..86339c0d227 100644
--- a/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py
+++ b/tests/test_litellm/proxy/management_endpoints/test_ui_sso.py
@@ -2,7 +2,7 @@ import asyncio
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from typing import Optional, cast
from unittest.mock import AsyncMock, MagicMock, patch
diff --git a/tests/test_litellm/proxy/management_helpers/test_management_helpers_utils.py b/tests/test_litellm/proxy/management_helpers/test_management_helpers_utils.py
index 14306197603..5f46d469ddb 100644
--- a/tests/test_litellm/proxy/management_helpers/test_management_helpers_utils.py
+++ b/tests/test_litellm/proxy/management_helpers/test_management_helpers_utils.py
@@ -1,7 +1,7 @@
import json
import os
import sys
-import uuid
+from litellm._uuid import uuid
from unittest.mock import AsyncMock, MagicMock
import pytest
diff --git a/tests/test_litellm/proxy/test_common_request_processing.py b/tests/test_litellm/proxy/test_common_request_processing.py
index 6a8d1ae1339..ef1aec2e764 100644
--- a/tests/test_litellm/proxy/test_common_request_processing.py
+++ b/tests/test_litellm/proxy/test_common_request_processing.py
@@ -1,5 +1,5 @@
import copy
-import uuid
+from litellm._uuid import uuid
from unittest.mock import AsyncMock, MagicMock
import pytest
diff --git a/tests/test_models.py b/tests/test_models.py
index 5a61d2eafd8..a0fa0525273 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -280,7 +280,7 @@ async def test_add_and_delete_models():
- Delete model
- Call model -> expect to fail
"""
- import uuid
+ from litellm._uuid import uuid
async with aiohttp.ClientSession() as session:
key_gen = await generate_key(session=session)
@@ -404,7 +404,7 @@ async def test_add_model_run_health():
Call /health
-> Ensure the health check for the endpoint is working as expected
"""
- import uuid
+ from litellm._uuid import uuid
async with aiohttp.ClientSession() as session:
key_gen = await generate_key(session=session)
@@ -528,7 +528,7 @@ async def test_team_model_e2e():
"""
from tests.test_users import new_user
from tests.test_team import new_team
- import uuid
+ from litellm._uuid import uuid
async with aiohttp.ClientSession() as session:
# Creat a user
diff --git a/tests/test_openai_endpoints.py b/tests/test_openai_endpoints.py
index c90fd91a5d7..fd997ebb71c 100644
--- a/tests/test_openai_endpoints.py
+++ b/tests/test_openai_endpoints.py
@@ -5,7 +5,7 @@ import asyncio
import aiohttp, openai
from openai import OpenAI, AsyncOpenAI, AzureOpenAI, AsyncAzureOpenAI
from typing import Optional, List, Union
-import uuid
+from litellm._uuid import uuid
LITELLM_MASTER_KEY = "sk-1234"
diff --git a/tests/test_team_logging.py b/tests/test_team_logging.py
index 516b6fa13b4..913b1e19496 100644
--- a/tests/test_team_logging.py
+++ b/tests/test_team_logging.py
@@ -78,7 +78,7 @@ async def test_aaateam_logging():
session, models=["fake-openai-endpoint"], team_id="team-1"
) # team-1 logs to project 1
- import uuid
+ from litellm._uuid import uuid
_trace_id = f"trace-{uuid.uuid4()}"
_request_metadata = {
@@ -144,7 +144,7 @@ async def test_team_2logging():
session, models=["fake-openai-endpoint"], team_id="team-2"
) # team-1 logs to project 1
- import uuid
+ from litellm._uuid import uuid
_trace_id = f"trace-{uuid.uuid4()}"
_request_metadata = {
diff --git a/tests/test_team_members.py b/tests/test_team_members.py
index d8981f84a62..a3d64eae803 100644
--- a/tests/test_team_members.py
+++ b/tests/test_team_members.py
@@ -3,7 +3,7 @@ import requests
import time
from typing import Dict, List
import logging
-import uuid
+from litellm._uuid import uuid
# Configure logging
logging.basicConfig(level=logging.INFO)
diff --git a/tests/test_users.py b/tests/test_users.py
index 08cbf9f1035..9b8eca789b2 100644
--- a/tests/test_users.py
+++ b/tests/test_users.py
@@ -318,7 +318,7 @@ async def test_user_model_access():
import json
-import uuid
+from litellm._uuid import uuid
import pytest
import aiohttp
from typing import Dict, Tuple
diff --git a/tests/vector_store_tests/base_vector_store_test.py b/tests/vector_store_tests/base_vector_store_test.py
index d3b58d8338d..414b5ee3334 100644
--- a/tests/vector_store_tests/base_vector_store_test.py
+++ b/tests/vector_store_tests/base_vector_store_test.py
@@ -5,7 +5,7 @@ import sys
from typing import Any, Dict, List
from unittest.mock import MagicMock, Mock, patch
import os
-import uuid
+from litellm._uuid import uuid
import time
import base64