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]

(Refactor) Code Quality improvement - remove `/prompt_templates/` , `base_aws_llm.py` from `/llms` folder (#7164)

Ishaan Jaffb5d55688e53b
diff --git a/litellm/integrations/argilla.py b/litellm/integrations/argilla.py
index 352543d82cf..d4719591f02 100644
--- a/litellm/integrations/argilla.py
+++ b/litellm/integrations/argilla.py
@@ -27,7 +27,7 @@ from litellm.llms.custom_httpx.http_handler import (
get_async_httpx_client,
httpxSpecialProvider,
)
-from litellm.llms.prompt_templates.common_utils import get_content_from_model_response
+from litellm.litellm_core_utils.prompt_templates.common_utils import get_content_from_model_response
from litellm.types.integrations.argilla import (
SUPPORTED_PAYLOAD_FIELDS,
ArgillaCredentialsObject,
diff --git a/litellm/llms/prompt_templates/common_utils.py b/litellm/litellm_core_utils/prompt_templates/common_utils.py
similarity index 100%
rename from litellm/llms/prompt_templates/common_utils.py
rename to litellm/litellm_core_utils/prompt_templates/common_utils.py
diff --git a/litellm/llms/prompt_templates/factory.py b/litellm/litellm_core_utils/prompt_templates/factory.py
similarity index 100%
rename from litellm/llms/prompt_templates/factory.py
rename to litellm/litellm_core_utils/prompt_templates/factory.py
diff --git a/litellm/llms/prompt_templates/image_handling.py b/litellm/litellm_core_utils/prompt_templates/image_handling.py
similarity index 100%
rename from litellm/llms/prompt_templates/image_handling.py
rename to litellm/litellm_core_utils/prompt_templates/image_handling.py
diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py
index 84549528863..860ba5eae85 100644
--- a/litellm/llms/anthropic/chat/transformation.py
+++ b/litellm/llms/anthropic/chat/transformation.py
@@ -21,7 +21,7 @@ import requests
import litellm
from litellm.litellm_core_utils.core_helpers import map_finish_reason
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
-from litellm.llms.prompt_templates.factory import anthropic_messages_pt
+from litellm.litellm_core_utils.prompt_templates.factory import anthropic_messages_pt
from litellm.types.llms.anthropic import (
AllAnthropicToolsValues,
AnthropicComputerTool,
diff --git a/litellm/llms/anthropic/completion/transformation.py b/litellm/llms/anthropic/completion/transformation.py
index e556b833baf..2435d7d4adc 100644
--- a/litellm/llms/anthropic/completion/transformation.py
+++ b/litellm/llms/anthropic/completion/transformation.py
@@ -17,7 +17,7 @@ from litellm.llms.base_llm.transformation import (
BaseLLMException,
LiteLLMLoggingObj,
)
-from litellm.llms.prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import (
ChatCompletionToolCallChunk,
diff --git a/litellm/llms/anthropic/experimental_pass_through/transformation.py b/litellm/llms/anthropic/experimental_pass_through/transformation.py
index 8d77c40af85..5de232e1ebd 100644
--- a/litellm/llms/anthropic/experimental_pass_through/transformation.py
+++ b/litellm/llms/anthropic/experimental_pass_through/transformation.py
@@ -57,7 +57,7 @@ from litellm.types.utils import Choices, GenericStreamingChunk
from litellm.utils import CustomStreamWrapper, ModelResponse, Usage
from ...base import BaseLLM
-from ...prompt_templates.factory import (
+from litellm.litellm_core_utils.prompt_templates.factory import (
anthropic_messages_pt,
custom_prompt,
prompt_factory,
diff --git a/litellm/llms/azure/chat/gpt_transformation.py b/litellm/llms/azure/chat/gpt_transformation.py
index 4e308d0ea29..bd737af2fb5 100644
--- a/litellm/llms/azure/chat/gpt_transformation.py
+++ b/litellm/llms/azure/chat/gpt_transformation.py
@@ -14,8 +14,9 @@ from ....types.llms.openai import (
ChatCompletionToolParam,
ChatCompletionToolParamFunctionChunk,
)
+
from ...base_llm.transformation import BaseConfig
-from ...prompt_templates.factory import convert_to_azure_openai_messages
+from litellm.litellm_core_utils.prompt_templates.factory import convert_to_azure_openai_messages
from ..common_utils import AzureOpenAIError
if TYPE_CHECKING:
@@ -25,7 +26,6 @@ if TYPE_CHECKING:
else:
LoggingClass = Any
-
class AzureOpenAIConfig(BaseConfig):
"""
Reference: https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions
diff --git a/litellm/llms/azure/completion/handler.py b/litellm/llms/azure/completion/handler.py
index 193776fd1d4..889d40d16f6 100644
--- a/litellm/llms/azure/completion/handler.py
+++ b/litellm/llms/azure/completion/handler.py
@@ -22,7 +22,7 @@ from litellm.utils import (
from ...base import BaseLLM
from ...openai.completion.handler import OpenAITextCompletion
from ...openai.completion.transformation import OpenAITextCompletionConfig
-from ...prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from ..common_utils import AzureOpenAIError
openai_text_completion_config = OpenAITextCompletionConfig()
diff --git a/litellm/llms/azure_ai/chat/transformation.py b/litellm/llms/azure_ai/chat/transformation.py
index e32e8f1685f..bce48e6fc01 100644
--- a/litellm/llms/azure_ai/chat/transformation.py
+++ b/litellm/llms/azure_ai/chat/transformation.py
@@ -3,7 +3,7 @@ from typing import List, Optional, Tuple
import litellm
from litellm._logging import verbose_logger
from litellm.llms.openai.openai import OpenAIConfig
-from litellm.llms.prompt_templates.common_utils import (
+from litellm.litellm_core_utils.prompt_templates.common_utils import (
_audio_or_image_in_message_content,
convert_content_list_to_str,
)
diff --git a/litellm/llms/base_aws_llm.py b/litellm/llms/bedrock/base_aws_llm.py
similarity index 99%
rename from litellm/llms/base_aws_llm.py
rename to litellm/llms/bedrock/base_aws_llm.py
index 9f3a58a8be8..9df9204b6c9 100644
--- a/litellm/llms/base_aws_llm.py
+++ b/litellm/llms/bedrock/base_aws_llm.py
@@ -10,7 +10,7 @@ from litellm._logging import verbose_logger
from litellm.caching.caching import DualCache, InMemoryCache
from litellm.secret_managers.main import get_secret, get_secret_str
-from .base import BaseLLM
+from litellm.llms.base import BaseLLM
if TYPE_CHECKING:
from botocore.credentials import Credentials
diff --git a/litellm/llms/bedrock/chat/converse_handler.py b/litellm/llms/bedrock/chat/converse_handler.py
index 743e596f8e2..4b1f1b4f70a 100644
--- a/litellm/llms/bedrock/chat/converse_handler.py
+++ b/litellm/llms/bedrock/chat/converse_handler.py
@@ -14,7 +14,7 @@ from litellm.llms.custom_httpx.http_handler import (
from litellm.types.utils import ModelResponse
from litellm.utils import CustomStreamWrapper, get_secret
-from ...base_aws_llm import BaseAWSLLM
+from ..base_aws_llm import BaseAWSLLM
from ..common_utils import BedrockError
from .invoke_handler import AWSEventStreamDecoder, MockResponseIterator, make_call
diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py
index 728fd83bc97..34c8b43657d 100644
--- a/litellm/llms/bedrock/chat/converse_transformation.py
+++ b/litellm/llms/bedrock/chat/converse_transformation.py
@@ -24,7 +24,7 @@ from litellm.types.llms.openai import (
from litellm.types.utils import ModelResponse, Usage
from litellm.utils import CustomStreamWrapper, add_dummy_tool, has_tool_call_blocks
-from ...prompt_templates.factory import _bedrock_converse_messages_pt, _bedrock_tools_pt
+from litellm.litellm_core_utils.prompt_templates.factory import _bedrock_converse_messages_pt, _bedrock_tools_pt
from ..common_utils import BedrockError, get_bedrock_tool_name
diff --git a/litellm/llms/bedrock/chat/invoke_handler.py b/litellm/llms/bedrock/chat/invoke_handler.py
index 3a72cf80576..a2a8228e272 100644
--- a/litellm/llms/bedrock/chat/invoke_handler.py
+++ b/litellm/llms/bedrock/chat/invoke_handler.py
@@ -52,8 +52,8 @@ from litellm.types.llms.openai import (
from litellm.types.utils import GenericStreamingChunk as GChunk
from litellm.utils import CustomStreamWrapper, ModelResponse, Usage, get_secret
-from ...base_aws_llm import BaseAWSLLM
-from ...prompt_templates.factory import (
+from ..base_aws_llm import BaseAWSLLM
+from litellm.litellm_core_utils.prompt_templates.factory import (
_bedrock_converse_messages_pt,
_bedrock_tools_pt,
cohere_message_pt,
diff --git a/litellm/llms/bedrock/embed/embedding.py b/litellm/llms/bedrock/embed/embedding.py
index 7a8591a94a2..9cb97f72f84 100644
--- a/litellm/llms/bedrock/embed/embedding.py
+++ b/litellm/llms/bedrock/embed/embedding.py
@@ -22,7 +22,7 @@ from litellm.secret_managers.main import get_secret
from litellm.types.llms.bedrock import AmazonEmbeddingRequest, CohereEmbeddingRequest
from litellm.types.utils import Embedding, EmbeddingResponse, Usage
-from ...base_aws_llm import BaseAWSLLM
+from ..base_aws_llm import BaseAWSLLM
from ..common_utils import BedrockError
from .amazon_titan_g1_transformation import AmazonTitanG1Config
from .amazon_titan_multimodal_transformation import (
diff --git a/litellm/llms/bedrock/image/image_handler.py b/litellm/llms/bedrock/image/image_handler.py
index 31af2910f9f..a32161c2227 100644
--- a/litellm/llms/bedrock/image/image_handler.py
+++ b/litellm/llms/bedrock/image/image_handler.py
@@ -16,7 +16,7 @@ from litellm.llms.custom_httpx.http_handler import (
)
from litellm.types.utils import ImageResponse
-from ...base_aws_llm import BaseAWSLLM
+from ..base_aws_llm import BaseAWSLLM
from ..common_utils import BedrockError
if TYPE_CHECKING:
diff --git a/litellm/llms/bedrock/rerank/handler.py b/litellm/llms/bedrock/rerank/handler.py
index d604760e351..e11ed8d84a0 100644
--- a/litellm/llms/bedrock/rerank/handler.py
+++ b/litellm/llms/bedrock/rerank/handler.py
@@ -18,7 +18,7 @@ from litellm.types.llms.bedrock import BedrockPreparedRequest, BedrockRerankRequ
from litellm.types.rerank import RerankRequest
from litellm.types.utils import RerankResponse
-from ...base_aws_llm import BaseAWSLLM
+from ..base_aws_llm import BaseAWSLLM
from ..common_utils import BedrockError
from .transformation import BedrockRerankConfig
diff --git a/litellm/llms/clarifai/chat/transformation.py b/litellm/llms/clarifai/chat/transformation.py
index 9eb48031800..53ddfcdfa61 100644
--- a/litellm/llms/clarifai/chat/transformation.py
+++ b/litellm/llms/clarifai/chat/transformation.py
@@ -7,7 +7,7 @@ import httpx
import litellm
from litellm.llms.base_llm.base_model_iterator import FakeStreamResponseIterator
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
-from litellm.llms.prompt_templates.common_utils import convert_content_list_to_str
+from litellm.litellm_core_utils.prompt_templates.common_utils import convert_content_list_to_str
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import (
ChatCompletionToolCallChunk,
diff --git a/litellm/llms/cohere/chat/transformation.py b/litellm/llms/cohere/chat/transformation.py
index 204137f793f..8002bf914f7 100644
--- a/litellm/llms/cohere/chat/transformation.py
+++ b/litellm/llms/cohere/chat/transformation.py
@@ -6,7 +6,7 @@ import httpx
import litellm
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
-from litellm.llms.prompt_templates.factory import cohere_messages_pt_v2
+from litellm.litellm_core_utils.prompt_templates.factory import cohere_messages_pt_v2
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import ModelResponse, Usage
diff --git a/litellm/llms/cohere/completion/transformation.py b/litellm/llms/cohere/completion/transformation.py
index b94d6d24e66..2240d4ea711 100644
--- a/litellm/llms/cohere/completion/transformation.py
+++ b/litellm/llms/cohere/completion/transformation.py
@@ -7,7 +7,7 @@ import httpx
import litellm
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
-from litellm.llms.prompt_templates.common_utils import convert_content_list_to_str
+from litellm.litellm_core_utils.prompt_templates.common_utils import convert_content_list_to_str
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import (
ChatCompletionToolCallChunk,
diff --git a/litellm/llms/custom_llm.py b/litellm/llms/custom_llm.py
index de09df19c04..c19ba621b95 100644
--- a/litellm/llms/custom_llm.py
+++ b/litellm/llms/custom_llm.py
@@ -45,8 +45,6 @@ from litellm.utils import (
)
from .base import BaseLLM
-from .prompt_templates.factory import custom_prompt, prompt_factory
-
class CustomLLMError(Exception): # use this for all your exceptions
def __init__(
diff --git a/litellm/llms/databricks/chat/transformation.py b/litellm/llms/databricks/chat/transformation.py
index 584b413373d..581eb1366c8 100644
--- a/litellm/llms/databricks/chat/transformation.py
+++ b/litellm/llms/databricks/chat/transformation.py
@@ -11,7 +11,7 @@ from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import ProviderField
from ...openai_like.chat.transformation import OpenAILikeChatConfig
-from ...prompt_templates.common_utils import (
+from litellm.litellm_core_utils.prompt_templates.common_utils import (
handle_messages_with_content_list_to_str_conversion,
strip_name_from_messages,
)
diff --git a/litellm/llms/deepseek/chat/transformation.py b/litellm/llms/deepseek/chat/transformation.py
index 650bae07738..288b1b7c16a 100644
--- a/litellm/llms/deepseek/chat/transformation.py
+++ b/litellm/llms/deepseek/chat/transformation.py
@@ -13,7 +13,7 @@ from litellm.types.llms.openai import AllMessageValues, ChatCompletionAssistantM
from ....utils import _remove_additional_properties, _remove_strict_from_schema
from ...openai.chat.gpt_transformation import OpenAIGPTConfig
-from ...prompt_templates.common_utils import (
+from litellm.litellm_core_utils.prompt_templates.common_utils import (
handle_messages_with_content_list_to_str_conversion,
)
diff --git a/litellm/llms/huggingface/chat/handler.py b/litellm/llms/huggingface/chat/handler.py
index 608bfc6ed88..1ba31d490ce 100644
--- a/litellm/llms/huggingface/chat/handler.py
+++ b/litellm/llms/huggingface/chat/handler.py
@@ -40,7 +40,6 @@ from litellm.types.utils import Logprobs as TextCompletionLogprobs
from litellm.utils import Choices, CustomStreamWrapper, Message, ModelResponse, Usage
from ...base import BaseLLM
-from ...prompt_templates.factory import custom_prompt, prompt_factory
from ..common_utils import HuggingfaceError, hf_task_list, hf_tasks
hf_chat_config = HuggingfaceConfig()
diff --git a/litellm/llms/huggingface/chat/transformation.py b/litellm/llms/huggingface/chat/transformation.py
index 8880ec41c35..155fc8dc816 100644
--- a/litellm/llms/huggingface/chat/transformation.py
+++ b/litellm/llms/huggingface/chat/transformation.py
@@ -10,8 +10,8 @@ import httpx
import litellm
from litellm.litellm_core_utils.streaming_handler import CustomStreamWrapper
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
-from litellm.llms.prompt_templates.common_utils import convert_content_list_to_str
-from litellm.llms.prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.common_utils import convert_content_list_to_str
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from litellm.secret_managers.main import get_secret_str
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import Choices, Message, ModelResponse, Usage
diff --git a/litellm/llms/mistral/mistral_chat_transformation.py b/litellm/llms/mistral/mistral_chat_transformation.py
index 50f08771c1b..2279e807fcc 100644
--- a/litellm/llms/mistral/mistral_chat_transformation.py
+++ b/litellm/llms/mistral/mistral_chat_transformation.py
@@ -10,7 +10,7 @@ import types
from typing import List, Literal, Optional, Tuple, Union
from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
-from litellm.llms.prompt_templates.common_utils import (
+from litellm.litellm_core_utils.prompt_templates.common_utils import (
handle_messages_with_content_list_to_str_conversion,
strip_none_values_from_message,
)
diff --git a/litellm/llms/nlp_cloud/chat/transformation.py b/litellm/llms/nlp_cloud/chat/transformation.py
index ec5540ca626..e547f38d22c 100644
--- a/litellm/llms/nlp_cloud/chat/transformation.py
+++ b/litellm/llms/nlp_cloud/chat/transformation.py
@@ -5,7 +5,7 @@ from typing import TYPE_CHECKING, Any, List, Optional, Union
import httpx
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
-from litellm.llms.prompt_templates.common_utils import convert_content_list_to_str
+from litellm.litellm_core_utils.prompt_templates.common_utils import convert_content_list_to_str
from litellm.types.llms.openai import AllMessageValues
from litellm.utils import ModelResponse, Usage
diff --git a/litellm/llms/ollama/completion/handler.py b/litellm/llms/ollama/completion/handler.py
index 74a9501deb1..5d6e2ef2dc8 100644
--- a/litellm/llms/ollama/completion/handler.py
+++ b/litellm/llms/ollama/completion/handler.py
@@ -18,7 +18,7 @@ from litellm.llms.custom_httpx.http_handler import get_async_httpx_client
from litellm.secret_managers.main import get_secret_str
from litellm.types.utils import ModelInfo, ProviderField, StreamingChoices
-from ...prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from ..common_utils import OllamaError
from .transformation import OllamaConfig
diff --git a/litellm/llms/oobabooga/chat/oobabooga.py b/litellm/llms/oobabooga/chat/oobabooga.py
index b7852eed49d..96b50ebbc45 100644
--- a/litellm/llms/oobabooga/chat/oobabooga.py
+++ b/litellm/llms/oobabooga/chat/oobabooga.py
@@ -9,7 +9,7 @@ import requests # type: ignore
from litellm.llms.custom_httpx.http_handler import HTTPHandler, _get_httpx_client
from litellm.utils import EmbeddingResponse, ModelResponse, Usage
-from ...prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from ..common_utils import OobaboogaError
from .transformation import OobaboogaConfig
diff --git a/litellm/llms/oobabooga/chat/transformation.py b/litellm/llms/oobabooga/chat/transformation.py
index 18944a7b80e..6780991bea3 100644
--- a/litellm/llms/oobabooga/chat/transformation.py
+++ b/litellm/llms/oobabooga/chat/transformation.py
@@ -8,8 +8,6 @@ import httpx
import litellm
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
from litellm.llms.openai.chat.gpt_transformation import OpenAIGPTConfig
-from litellm.llms.prompt_templates.common_utils import convert_content_list_to_str
-from litellm.llms.prompt_templates.factory import custom_prompt, prompt_factory
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import Choices, Message, ModelResponse, Usage
from litellm.utils import token_counter
diff --git a/litellm/llms/openai/completion/transformation.py b/litellm/llms/openai/completion/transformation.py
index cb6baba3393..e7ff85d557f 100644
--- a/litellm/llms/openai/completion/transformation.py
+++ b/litellm/llms/openai/completion/transformation.py
@@ -14,7 +14,7 @@ from litellm.types.llms.openai import (
)
from litellm.types.utils import Choices, Message, ModelResponse, TextCompletionResponse
-from ...prompt_templates.common_utils import convert_content_list_to_str
+from litellm.litellm_core_utils.prompt_templates.common_utils import convert_content_list_to_str
from ..chat.gpt_transformation import OpenAIGPTConfig
from ..common_utils import OpenAIError
from .utils import is_tokens_or_list_of_tokens
diff --git a/litellm/llms/openai/openai.py b/litellm/llms/openai/openai.py
index 54f52c50fef..cc1552ba0bd 100644
--- a/litellm/llms/openai/openai.py
+++ b/litellm/llms/openai/openai.py
@@ -45,7 +45,7 @@ from litellm.utils import (
from ...types.llms.openai import *
from ..base import BaseLLM
-from ..prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from .chat.gpt_transformation import OpenAIGPTConfig
from .common_utils import OpenAIError, drop_params_from_unprocessable_entity_error
diff --git a/litellm/llms/petals.py b/litellm/llms/petals.py
index 28e27e5dfee..9194781f4f6 100644
--- a/litellm/llms/petals.py
+++ b/litellm/llms/petals.py
@@ -10,7 +10,7 @@ import requests # type: ignore
import litellm
from litellm.utils import ModelResponse, Usage
-from .prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
class PetalsError(Exception):
diff --git a/litellm/llms/predibase.py b/litellm/llms/predibase.py
index e80964551e2..66698124643 100644
--- a/litellm/llms/predibase.py
+++ b/litellm/llms/predibase.py
@@ -26,7 +26,7 @@ from litellm.llms.custom_httpx.http_handler import (
from litellm.utils import Choices, CustomStreamWrapper, Message, ModelResponse, Usage
from .base import BaseLLM
-from .prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
class PredibaseError(Exception):
diff --git a/litellm/llms/replicate/chat/handler.py b/litellm/llms/replicate/chat/handler.py
index 898f350bace..4f7a1156991 100644
--- a/litellm/llms/replicate/chat/handler.py
+++ b/litellm/llms/replicate/chat/handler.py
@@ -17,7 +17,6 @@ from litellm.llms.custom_httpx.http_handler import (
from litellm.types.llms.openai import AllMessageValues
from litellm.utils import CustomStreamWrapper, ModelResponse, Usage
-from ...prompt_templates.factory import custom_prompt, prompt_factory
from ..common_utils import ReplicateError
from .transformation import ReplicateConfig
diff --git a/litellm/llms/replicate/chat/transformation.py b/litellm/llms/replicate/chat/transformation.py
index 180c67271ed..184a2cb8098 100644
--- a/litellm/llms/replicate/chat/transformation.py
+++ b/litellm/llms/replicate/chat/transformation.py
@@ -5,8 +5,8 @@ import httpx
import litellm
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
-from litellm.llms.prompt_templates.common_utils import convert_content_list_to_str
-from litellm.llms.prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.common_utils import convert_content_list_to_str
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import Choices, Message, ModelResponse, Usage
from litellm.utils import token_counter
diff --git a/litellm/llms/sagemaker/chat/handler.py b/litellm/llms/sagemaker/chat/handler.py
index f7024b94e32..5daa91277d5 100644
--- a/litellm/llms/sagemaker/chat/handler.py
+++ b/litellm/llms/sagemaker/chat/handler.py
@@ -6,8 +6,8 @@ import httpx
from litellm.utils import ModelResponse, get_secret
-from ...base_aws_llm import BaseAWSLLM
-from ...prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from ..common_utils import AWSEventStreamDecoder
from .transformation import SagemakerChatConfig
diff --git a/litellm/llms/sagemaker/completion/handler.py b/litellm/llms/sagemaker/completion/handler.py
index a0961621fd4..41744f25433 100644
--- a/litellm/llms/sagemaker/completion/handler.py
+++ b/litellm/llms/sagemaker/completion/handler.py
@@ -31,8 +31,8 @@ from litellm.utils import (
get_secret,
)
-from ...base_aws_llm import BaseAWSLLM
-from ...prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from ..common_utils import AWSEventStreamDecoder, SagemakerError
from .transformation import SagemakerConfig
diff --git a/litellm/llms/sagemaker/completion/transformation.py b/litellm/llms/sagemaker/completion/transformation.py
index 91efa86adfa..f7bac46b6f3 100644
--- a/litellm/llms/sagemaker/completion/transformation.py
+++ b/litellm/llms/sagemaker/completion/transformation.py
@@ -14,7 +14,7 @@ from httpx._models import Headers, Response
import litellm
from litellm.litellm_core_utils.asyncify import asyncify
from litellm.llms.base_llm.transformation import BaseConfig, BaseLLMException
-from litellm.llms.prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
from litellm.types.llms.openai import AllMessageValues
from litellm.types.utils import Usage
diff --git a/litellm/llms/text_completion_codestral.py b/litellm/llms/text_completion_codestral.py
index f951b897b81..035da49409b 100644
--- a/litellm/llms/text_completion_codestral.py
+++ b/litellm/llms/text_completion_codestral.py
@@ -33,7 +33,7 @@ from litellm.utils import (
)
from .base import BaseLLM
-from .prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
class TextCompletionCodestralError(Exception):
diff --git a/litellm/llms/triton.py b/litellm/llms/triton.py
index efd0d0a2d19..dd715fda44e 100644
--- a/litellm/llms/triton.py
+++ b/litellm/llms/triton.py
@@ -25,7 +25,7 @@ from litellm.utils import (
)
from .base import BaseLLM
-from .prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
class TritonError(Exception):
diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/gemini/transformation.py b/litellm/llms/vertex_ai_and_google_ai_studio/gemini/transformation.py
index 7e16571f555..d67419767ae 100644
--- a/litellm/llms/vertex_ai_and_google_ai_studio/gemini/transformation.py
+++ b/litellm/llms/vertex_ai_and_google_ai_studio/gemini/transformation.py
@@ -13,7 +13,7 @@ from pydantic import BaseModel
import litellm
from litellm._logging import verbose_logger
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
-from litellm.llms.prompt_templates.factory import (
+from litellm.litellm_core_utils.prompt_templates.factory import (
convert_to_anthropic_image_obj,
convert_to_gemini_tool_call_invoke,
convert_to_gemini_tool_call_result,
diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/gemini/vertex_and_google_ai_studio_gemini.py b/litellm/llms/vertex_ai_and_google_ai_studio/gemini/vertex_and_google_ai_studio_gemini.py
index 454da4d4afc..09b74ad9929 100644
--- a/litellm/llms/vertex_ai_and_google_ai_studio/gemini/vertex_and_google_ai_studio_gemini.py
+++ b/litellm/llms/vertex_ai_and_google_ai_studio/gemini/vertex_and_google_ai_studio_gemini.py
@@ -37,7 +37,7 @@ from litellm.llms.custom_httpx.http_handler import (
HTTPHandler,
get_async_httpx_client,
)
-from litellm.llms.prompt_templates.factory import (
+from litellm.litellm_core_utils.prompt_templates.factory import (
convert_generic_image_chunk_to_openai_image_obj,
convert_to_anthropic_image_obj,
)
diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/vertex_ai_non_gemini.py b/litellm/llms/vertex_ai_and_google_ai_studio/vertex_ai_non_gemini.py
index 829bf652890..d365cfac14b 100644
--- a/litellm/llms/vertex_ai_and_google_ai_studio/vertex_ai_non_gemini.py
+++ b/litellm/llms/vertex_ai_and_google_ai_studio/vertex_ai_non_gemini.py
@@ -15,7 +15,7 @@ import litellm
from litellm._logging import verbose_logger
from litellm.litellm_core_utils.core_helpers import map_finish_reason
from litellm.llms.custom_httpx.http_handler import _DEFAULT_TTL_FOR_HTTPX_CLIENTS
-from litellm.llms.prompt_templates.factory import (
+from litellm.litellm_core_utils.prompt_templates.factory import (
convert_to_anthropic_image_obj,
convert_to_gemini_tool_call_invoke,
convert_to_gemini_tool_call_result,
diff --git a/litellm/llms/vertex_ai_and_google_ai_studio/vertex_ai_partner_models/anthropic/transformation.py b/litellm/llms/vertex_ai_and_google_ai_studio/vertex_ai_partner_models/anthropic/transformation.py
index 882a1aed271..93031656c25 100644
--- a/litellm/llms/vertex_ai_and_google_ai_studio/vertex_ai_partner_models/anthropic/transformation.py
+++ b/litellm/llms/vertex_ai_and_google_ai_studio/vertex_ai_partner_models/anthropic/transformation.py
@@ -24,7 +24,7 @@ from litellm.types.utils import ResponseFormatChunk
from litellm.utils import CustomStreamWrapper, ModelResponse, Usage
from ....anthropic.chat.transformation import AnthropicConfig
-from ....prompt_templates.factory import (
+from litellm.litellm_core_utils.prompt_templates.factory import (
construct_tool_use_system_prompt,
contains_tag,
custom_prompt,
diff --git a/litellm/llms/vllm/completion/handler.py b/litellm/llms/vllm/completion/handler.py
index 34cb52d126d..b2371ffca3c 100644
--- a/litellm/llms/vllm/completion/handler.py
+++ b/litellm/llms/vllm/completion/handler.py
@@ -9,7 +9,7 @@ import requests # type: ignore
from litellm.utils import ModelResponse, Usage
-from ...prompt_templates.factory import custom_prompt, prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import custom_prompt, prompt_factory
llm = None
diff --git a/litellm/llms/watsonx/completion/handler.py b/litellm/llms/watsonx/completion/handler.py
index 9cd884e3f61..599338c3081 100644
--- a/litellm/llms/watsonx/completion/handler.py
+++ b/litellm/llms/watsonx/completion/handler.py
@@ -34,7 +34,7 @@ from litellm.types.llms.watsonx import WatsonXAIEndpoint
from litellm.utils import EmbeddingResponse, ModelResponse, Usage, map_finish_reason
from ...base import BaseLLM
-from ...prompt_templates import factory as ptf
+from litellm.litellm_core_utils.prompt_templates import factory as ptf
from ..common_utils import WatsonXAIError, _get_api_params, generate_iam_token
from .transformation import IBMWatsonXAIConfig
diff --git a/litellm/llms/watsonx/completion/transformation.py b/litellm/llms/watsonx/completion/transformation.py
index 6f2b1881067..9e68be930e2 100644
--- a/litellm/llms/watsonx/completion/transformation.py
+++ b/litellm/llms/watsonx/completion/transformation.py
@@ -36,7 +36,7 @@ from litellm.utils import EmbeddingResponse, ModelResponse, Usage, map_finish_re
from ...base import BaseLLM
from ...base_llm.transformation import BaseConfig
-from ...prompt_templates import factory as ptf
+from litellm.litellm_core_utils.prompt_templates import factory as ptf
from ..common_utils import WatsonXAIError, _get_api_params, generate_iam_token
if TYPE_CHECKING:
diff --git a/litellm/main.py b/litellm/main.py
index cab0c7167d7..e524a3b73ce 100644
--- a/litellm/main.py
+++ b/litellm/main.py
@@ -57,7 +57,7 @@ from litellm.litellm_core_utils.mock_functions import (
mock_image_generation,
)
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
-from litellm.llms.prompt_templates.common_utils import get_content_from_model_response
+from litellm.litellm_core_utils.prompt_templates.common_utils import get_content_from_model_response
from litellm.secret_managers.main import get_secret_str
from litellm.utils import (
CustomStreamWrapper,
@@ -110,8 +110,8 @@ from .llms.openai.openai import OpenAIChatCompletion
from .llms.openai_like.chat.handler import OpenAILikeChatHandler
from .llms.openai_like.embedding.handler import OpenAILikeEmbeddingHandler
from .llms.predibase import PredibaseChatCompletion
-from .llms.prompt_templates.common_utils import get_completion_messages
-from .llms.prompt_templates.factory import (
+from .litellm_core_utils.prompt_templates.common_utils import get_completion_messages
+from .litellm_core_utils.prompt_templates.factory import (
custom_prompt,
function_call_prompt,
map_system_message_pt,
diff --git a/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py b/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
index ef41ce9b1ba..db5972a7cf0 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/bedrock_guardrails.py
@@ -30,7 +30,7 @@ from litellm.integrations.custom_guardrail import CustomGuardrail
from litellm.litellm_core_utils.logging_utils import (
convert_litellm_response_object_to_str,
)
-from litellm.llms.base_aws_llm import BaseAWSLLM
+from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM
from litellm.llms.custom_httpx.http_handler import (
AsyncHTTPHandler,
get_async_httpx_client,
diff --git a/litellm/proxy/guardrails/guardrail_hooks/guardrails_ai.py b/litellm/proxy/guardrails/guardrail_hooks/guardrails_ai.py
index c8d8900139a..2dd08432a74 100644
--- a/litellm/proxy/guardrails/guardrail_hooks/guardrails_ai.py
+++ b/litellm/proxy/guardrails/guardrail_hooks/guardrails_ai.py
@@ -14,7 +14,7 @@ import litellm
from litellm._logging import verbose_proxy_logger
from litellm.caching.caching import DualCache
from litellm.integrations.custom_guardrail import CustomGuardrail
-from litellm.llms.prompt_templates.common_utils import (
+from litellm.litellm_core_utils.prompt_templates.common_utils import (
convert_openai_message_to_only_content_messages,
get_content_from_model_response,
)
diff --git a/litellm/proxy/hooks/prompt_injection_detection.py b/litellm/proxy/hooks/prompt_injection_detection.py
index bbe820ffdea..be4eb79885d 100644
--- a/litellm/proxy/hooks/prompt_injection_detection.py
+++ b/litellm/proxy/hooks/prompt_injection_detection.py
@@ -20,7 +20,7 @@ import litellm
from litellm._logging import verbose_proxy_logger
from litellm.caching.caching import DualCache
from litellm.integrations.custom_logger import CustomLogger
-from litellm.llms.prompt_templates.factory import prompt_injection_detection_default_pt
+from litellm.litellm_core_utils.prompt_templates.factory import prompt_injection_detection_default_pt
from litellm.proxy._types import LiteLLMPromptInjectionParams, UserAPIKeyAuth
from litellm.utils import get_formatted_prompt
diff --git a/litellm/secret_managers/aws_secret_manager_v2.py b/litellm/secret_managers/aws_secret_manager_v2.py
index 32653f57dc1..acee00b929c 100644
--- a/litellm/secret_managers/aws_secret_manager_v2.py
+++ b/litellm/secret_managers/aws_secret_manager_v2.py
@@ -26,14 +26,13 @@ import httpx
import litellm
from litellm._logging import verbose_logger
-from litellm.llms.base_aws_llm import BaseAWSLLM
from litellm.llms.custom_httpx.http_handler import (
_get_httpx_client,
get_async_httpx_client,
)
from litellm.proxy._types import KeyManagementSystem
from litellm.types.llms.custom_http import httpxSpecialProvider
-
+from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM
class AWSSecretsManagerV2(BaseAWSLLM):
@classmethod
diff --git a/tests/code_coverage_tests/enforce_llms_folder_style.py b/tests/code_coverage_tests/enforce_llms_folder_style.py
new file mode 100644
index 00000000000..7f7c2c3be1e
--- /dev/null
+++ b/tests/code_coverage_tests/enforce_llms_folder_style.py
@@ -0,0 +1,61 @@
+import ast
+import os
+import sys
+
+sys.path.insert(
+ 0, os.path.abspath("../..")
+)
+
+import litellm
+
+ALLOWED_FILES_IN_LLMS_FOLDER = ["__init__", "base", "base_llm", "custom_httpx", "custom_llm", "deprecated_providers"]
+
+def get_unique_names_from_llms_dir(base_dir="./litellm/llms/"):
+ """
+ Returns a set of unique file and folder names from the root level of litellm/llms directory,
+ excluding file extensions and __init__.py
+ """
+ unique_names = set()
+
+ if not os.path.exists(base_dir):
+ print(f"Warning: Directory {base_dir} does not exist.")
+ return unique_names
+
+ # Get only root level items
+ items = os.listdir(base_dir)
+
+ for item in items:
+ item_path = os.path.join(base_dir, item)
+
+ if os.path.isdir(item_path):
+ if item != "__pycache__":
+ unique_names.add(item)
+ elif item.endswith(".py") and item != "__init__.py":
+ name_without_ext = os.path.splitext(item)[0]
+ unique_names.add(name_without_ext)
+
+ return unique_names
+
+
+def run_lint_check(unique_names):
+ _all_litellm_providers = [str(provider.value) for provider in litellm.LlmProviders]
+ violations = []
+ for name in unique_names:
+ if name.lower() not in _all_litellm_providers and name not in ALLOWED_FILES_IN_LLMS_FOLDER:
+ violations.append(name)
+
+ if len(violations) > 0:
+ raise ValueError(f"There are {len(violations)} violations in the llms folder. \n\n {violations}. \n\n Valid providers: {_all_litellm_providers}")
+
+def main():
+ llms_dir = "./litellm/llms/" # Update this path if needed
+ llms_dir = "../../litellm/llms/" # LOCAL TESTING
+
+ unique_names = get_unique_names_from_llms_dir(llms_dir)
+ print("Unique names in llms directory:", sorted(list(unique_names)))
+ run_lint_check(unique_names)
+
+
+
+if __name__ == "__main__":
+ main()
\ No newline at end of file
diff --git a/tests/llm_translation/test_anthropic_completion.py b/tests/llm_translation/test_anthropic_completion.py
index 32d0ef1a4fe..967b2d27229 100644
--- a/tests/llm_translation/test_anthropic_completion.py
+++ b/tests/llm_translation/test_anthropic_completion.py
@@ -670,7 +670,7 @@ class TestAnthropicCompletion(BaseLLMChatTest):
def test_tool_call_no_arguments(self, tool_call_no_arguments):
"""Test that tool calls with no arguments is translated correctly. Relevant issue: https://github.com/BerriAI/litellm/issues/6833"""
- from litellm.llms.prompt_templates.factory import (
+ from litellm.litellm_core_utils.prompt_templates.factory import (
convert_to_anthropic_tool_invoke,
)
@@ -767,7 +767,7 @@ def test_convert_tool_response_to_message_no_arguments():
def test_anthropic_tool_with_image():
- from litellm.llms.prompt_templates.factory import prompt_factory
+ from litellm.litellm_core_utils.prompt_templates.factory import prompt_factory
import json
b64_data = "iVBORw0KGgoAAAANSUhEu6U3//C9t/fKv5wDgpP1r5796XwC4zyH1D565bHGDqbY85AMb0nIQe+u3J390Xbtb9XgXxcK0/aqRXpdYcwgARbCN03FJk"
diff --git a/tests/llm_translation/test_bedrock_completion.py b/tests/llm_translation/test_bedrock_completion.py
index 62803e40a2f..651424b313f 100644
--- a/tests/llm_translation/test_bedrock_completion.py
+++ b/tests/llm_translation/test_bedrock_completion.py
@@ -33,7 +33,7 @@ from litellm import (
)
from litellm.llms.bedrock.chat import BedrockLLM
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
-from litellm.llms.prompt_templates.factory import _bedrock_tools_pt
+from litellm.litellm_core_utils.prompt_templates.factory import _bedrock_tools_pt
from base_llm_unit_tests import BaseLLMChatTest
from base_rerank_unit_tests import BaseLLMRerankTest
@@ -1262,7 +1262,7 @@ def test_bedrock_get_base_model(model, expected_base_model):
assert litellm.AmazonConverseConfig()._get_base_model(model) == expected_base_model
-from litellm.llms.prompt_templates.factory import _bedrock_converse_messages_pt
+from litellm.litellm_core_utils.prompt_templates.factory import _bedrock_converse_messages_pt
def test_bedrock_converse_translation_tool_message():
@@ -1320,7 +1320,7 @@ def test_base_aws_llm_get_credentials():
import boto3
- from litellm.llms.base_aws_llm import BaseAWSLLM
+ from litellm.llms.bedrock.base_aws_llm import BaseAWSLLM
start_time = time.time()
session = boto3.Session(
@@ -1603,7 +1603,7 @@ def test_bedrock_completion_test_3():
Check if content in tool result is formatted correctly
"""
from litellm.types.utils import ChatCompletionMessageToolCall, Function, Message
- from litellm.llms.prompt_templates.factory import _bedrock_converse_messages_pt
+ from litellm.litellm_core_utils.prompt_templates.factory import _bedrock_converse_messages_pt
messages = [
{
diff --git a/tests/llm_translation/test_gemini.py b/tests/llm_translation/test_gemini.py
index 4e6c5118dc2..23b6f7dde7c 100644
--- a/tests/llm_translation/test_gemini.py
+++ b/tests/llm_translation/test_gemini.py
@@ -7,7 +7,7 @@ class TestGoogleAIStudioGemini(BaseLLMChatTest):
def test_tool_call_no_arguments(self, tool_call_no_arguments):
"""Test that tool calls with no arguments is translated correctly. Relevant issue: https://github.com/BerriAI/litellm/issues/6833"""
- from litellm.llms.prompt_templates.factory import (
+ from litellm.litellm_core_utils.prompt_templates.factory import (
convert_to_gemini_tool_call_invoke,
)
diff --git a/tests/llm_translation/test_optional_params.py b/tests/llm_translation/test_optional_params.py
index 8acfbf0863b..bfd5ee2a476 100644
--- a/tests/llm_translation/test_optional_params.py
+++ b/tests/llm_translation/test_optional_params.py
@@ -13,7 +13,7 @@ sys.path.insert(0, os.path.abspath("../.."))
from unittest.mock import MagicMock, patch
import litellm
-from litellm.llms.prompt_templates.factory import map_system_message_pt
+from litellm.litellm_core_utils.prompt_templates.factory import map_system_message_pt
from litellm.types.completion import (
ChatCompletionMessageParam,
ChatCompletionSystemMessageParam,
diff --git a/tests/llm_translation/test_prompt_factory.py b/tests/llm_translation/test_prompt_factory.py
index 005c62113ad..735deb84cef 100644
--- a/tests/llm_translation/test_prompt_factory.py
+++ b/tests/llm_translation/test_prompt_factory.py
@@ -9,10 +9,10 @@ sys.path.insert(0, os.path.abspath("../.."))
from typing import Union
-# from litellm.llms.prompt_templates.factory import prompt_factory
+# from litellm.litellm_core_utils.prompt_templates.factory import prompt_factory
import litellm
from litellm import completion
-from litellm.llms.prompt_templates.factory import (
+from litellm.litellm_core_utils.prompt_templates.factory import (
_bedrock_tools_pt,
anthropic_messages_pt,
anthropic_pt,
@@ -22,7 +22,7 @@ from litellm.llms.prompt_templates.factory import (
llama_2_chat_pt,
prompt_factory,
)
-from litellm.llms.prompt_templates.common_utils import (
+from litellm.litellm_core_utils.prompt_templates.common_utils import (
get_completion_messages,
)
from litellm.llms.vertex_ai_and_google_ai_studio.gemini.transformation import (
@@ -327,7 +327,7 @@ def test_bedrock_parallel_tool_calling_pt(provider):
"""
Make sure parallel tool call blocks are merged correctly - https://github.com/BerriAI/litellm/issues/5277
"""
- from litellm.llms.prompt_templates.factory import _bedrock_converse_messages_pt
+ from litellm.litellm_core_utils.prompt_templates.factory import _bedrock_converse_messages_pt
from litellm.types.utils import ChatCompletionMessageToolCall, Function, Message
messages = [
@@ -682,7 +682,7 @@ def test_alternating_roles_e2e():
def test_just_system_message():
- from litellm.llms.prompt_templates.factory import _bedrock_converse_messages_pt
+ from litellm.litellm_core_utils.prompt_templates.factory import _bedrock_converse_messages_pt
with pytest.raises(litellm.BadRequestError) as e:
_bedrock_converse_messages_pt(
@@ -694,7 +694,7 @@ def test_just_system_message():
def test_convert_generic_image_chunk_to_openai_image_obj():
- from litellm.llms.prompt_templates.factory import (
+ from litellm.litellm_core_utils.prompt_templates.factory import (
convert_generic_image_chunk_to_openai_image_obj,
convert_to_anthropic_image_obj,
)
diff --git a/tests/local_testing/test_anthropic_prompt_caching.py b/tests/local_testing/test_anthropic_prompt_caching.py
index cdee1938470..ad63072d74d 100644
--- a/tests/local_testing/test_anthropic_prompt_caching.py
+++ b/tests/local_testing/test_anthropic_prompt_caching.py
@@ -23,7 +23,7 @@ import pytest
import litellm
from litellm import RateLimitError, Timeout, completion, completion_cost, embedding
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
-from litellm.llms.prompt_templates.factory import anthropic_messages_pt
+from litellm.litellm_core_utils.prompt_templates.factory import anthropic_messages_pt
# litellm.num_retries =3
litellm.cache = None
diff --git a/tests/local_testing/test_azure_openai.py b/tests/local_testing/test_azure_openai.py
index fa4226b1493..013a775370c 100644
--- a/tests/local_testing/test_azure_openai.py
+++ b/tests/local_testing/test_azure_openai.py
@@ -27,7 +27,7 @@ from respx import MockRouter
import litellm
from litellm import RateLimitError, Timeout, completion, completion_cost, embedding
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
-from litellm.llms.prompt_templates.factory import anthropic_messages_pt
+from litellm.litellm_core_utils.prompt_templates.factory import anthropic_messages_pt
from litellm.router import Router
diff --git a/tests/local_testing/test_completion.py b/tests/local_testing/test_completion.py
index 833dbb8ffaa..c95932bc55c 100644
--- a/tests/local_testing/test_completion.py
+++ b/tests/local_testing/test_completion.py
@@ -22,7 +22,7 @@ import pytest
import litellm
from litellm import RateLimitError, Timeout, completion, completion_cost, embedding
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
-from litellm.llms.prompt_templates.factory import anthropic_messages_pt
+from litellm.litellm_core_utils.prompt_templates.factory import anthropic_messages_pt
# litellm.num_retries=3
@@ -696,7 +696,7 @@ async def test_anthropic_no_content_error():
def test_parse_xml_params():
- from litellm.llms.prompt_templates.factory import parse_xml_params
+ from litellm.litellm_core_utils.prompt_templates.factory import parse_xml_params
## SCENARIO 1 ## - W/ ARRAY
xml_content = """<invoke><tool_name>return_list_of_str</tool_name>\n<parameters>\n<value>\n<item>apple</item>\n<item>banana</item>\n<item>orange</item>\n</value>\n</parameters></invoke>"""
diff --git a/tests/local_testing/test_hf_prompt_templates.py b/tests/local_testing/test_hf_prompt_templates.py
index ea1e6a7d88f..b20f10bdfbd 100644
--- a/tests/local_testing/test_hf_prompt_templates.py
+++ b/tests/local_testing/test_hf_prompt_templates.py
@@ -9,7 +9,7 @@ sys.path.insert(
0, os.path.abspath("../..")
) # Adds the parent directory to the system path
import pytest
-from litellm.llms.prompt_templates.factory import prompt_factory
+from litellm.litellm_core_utils.prompt_templates.factory import prompt_factory
def test_prompt_formatting():
diff --git a/tests/local_testing/test_sagemaker.py b/tests/local_testing/test_sagemaker.py
index f602067338a..8438c3c6ba1 100644
--- a/tests/local_testing/test_sagemaker.py
+++ b/tests/local_testing/test_sagemaker.py
@@ -23,7 +23,7 @@ import pytest
import litellm
from litellm import RateLimitError, Timeout, completion, completion_cost, embedding
from litellm.llms.custom_httpx.http_handler import AsyncHTTPHandler, HTTPHandler
-from litellm.llms.prompt_templates.factory import anthropic_messages_pt
+from litellm.litellm_core_utils.prompt_templates.factory import anthropic_messages_pt
# litellm.num_retries =3
litellm.cache = None