The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
Litellm Minor Fixes & Improvements (10/12/2024) (#6179)
Krish Dholakia2acb0c0675d8
diff --git a/docs/my-website/docs/providers/custom_llm_server.md b/docs/my-website/docs/providers/custom_llm_server.mdindex 6d201501041..2adb6a67cf8 100644--- a/docs/my-website/docs/providers/custom_llm_server.md+++ b/docs/my-website/docs/providers/custom_llm_server.md@@ -251,6 +251,105 @@ Expected Response}```+## Additional Parameters++Additional parameters are passed inside `optional_params` key in the `completion` or `image_generation` function.++Here's how to set this:++<Tabs>+<TabItem value="sdk" label="SDK">++```python+import litellm+from litellm import CustomLLM, completion, get_llm_provider+++class MyCustomLLM(CustomLLM):+ def completion(self, *args, **kwargs) -> litellm.ModelResponse:+ assert kwargs["optional_params"] == {"my_custom_param": "my-custom-param"} # 👈 CHECK HERE+ return litellm.completion(+ model="gpt-3.5-turbo",+ messages=[{"role": "user", "content": "Hello world"}],+ mock_response="Hi!",+ ) # type: ignore++my_custom_llm = MyCustomLLM()++litellm.custom_provider_map = [ # 👈 KEY STEP - REGISTER HANDLER+ {"provider": "my-custom-llm", "custom_handler": my_custom_llm}+ ]++resp = completion(model="my-custom-llm/my-model", my_custom_param="my-custom-param")+```++</TabItem>+<TabItem value="proxy" label="Proxy">+++1. Setup your `custom_handler.py` file+```python+import litellm+from litellm import CustomLLM+from litellm.types.utils import ImageResponse, ImageObject+++class MyCustomLLM(CustomLLM):+ async def aimage_generation(self, model: str, prompt: str, model_response: ImageResponse, optional_params: dict, logging_obj: Any, timeout: Optional[Union[float, httpx.Timeout]] = None, client: Optional[AsyncHTTPHandler] = None,) -> ImageResponse:+ assert optional_params == {"my_custom_param": "my-custom-param"} # 👈 CHECK HERE+ return ImageResponse(+ created=int(time.time()),+ data=[ImageObject(url="https://example.com/image.png")],+ )++my_custom_llm = MyCustomLLM()+```+++2. Add to `config.yaml`++In the config below, we pass++python_filename: `custom_handler.py`+custom_handler_instance_name: `my_custom_llm`. This is defined in Step 1++custom_handler: `custom_handler.my_custom_llm`++```yaml+model_list:+ - model_name: "test-model"+ litellm_params:+ model: "openai/text-embedding-ada-002"+ - model_name: "my-custom-model"+ litellm_params:+ model: "my-custom-llm/my-model"+ my_custom_param: "my-custom-param" # 👈 CUSTOM PARAM++litellm_settings:+ custom_provider_map:+ - {"provider": "my-custom-llm", "custom_handler": custom_handler.my_custom_llm}+```++```bash+litellm --config /path/to/config.yaml+```++3. Test it!++```bash+curl -X POST 'http://0.0.0.0:4000/v1/images/generations' \+-H 'Content-Type: application/json' \+-H 'Authorization: Bearer sk-1234' \+-d '{+ "model": "my-custom-model",+ "prompt": "A cute baby sea otter",+}'+```++</TabItem>+</Tabs>++## Custom Handler Specdiff --git a/litellm/caching.py b/litellm/caching.pyindex 91d9e6996f3..c9767b624db 100644--- a/litellm/caching.py+++ b/litellm/caching.py@@ -20,13 +20,13 @@ from datetime import timedeltafrom enum import Enumfrom typing import Any, List, Literal, Optional, Tuple, Union-from openai._models import BaseModel as OpenAIObject+from pydantic import BaseModelimport litellmfrom litellm._logging import verbose_loggerfrom litellm.litellm_core_utils.core_helpers import _get_parent_otel_span_from_kwargsfrom litellm.types.services import ServiceLoggerPayload, ServiceTypes-from litellm.types.utils import all_litellm_params+from litellm.types.utils import CachingSupportedCallTypes, all_litellm_paramsdef print_verbose(print_statement):@@ -2139,20 +2139,7 @@ class Cache:default_in_memory_ttl: Optional[float] = None,default_in_redis_ttl: Optional[float] = None,similarity_threshold: Optional[float] = None,- supported_call_types: Optional[- List[- Literal[- "completion",- "acompletion",- "embedding",- "aembedding",- "atranscription",- "transcription",- "atext_completion",- "text_completion",- ]- ]- ] = [+ supported_call_types: Optional[List[CachingSupportedCallTypes]] = ["completion","acompletion","embedding",@@ -2161,6 +2148,8 @@ class Cache:"transcription","atext_completion","text_completion",+ "arerank",+ "rerank",],# s3 Bucket, boto3 configurations3_bucket_name: Optional[str] = None,@@ -2353,9 +2342,20 @@ class Cache:"file","language",]+ rerank_only_kwargs = [+ "top_n",+ "rank_fields",+ "return_documents",+ "max_chunks_per_doc",+ "documents",+ "query",+ ]# combined_kwargs - NEEDS to be ordered across get_cache_key(). Do not use a set()combined_kwargs = (- completion_kwargs + embedding_only_kwargs + transcription_only_kwargs+ completion_kwargs+ + embedding_only_kwargs+ + transcription_only_kwargs+ + rerank_only_kwargs)litellm_param_kwargs = all_litellm_paramsfor param in kwargs:@@ -2557,7 +2557,7 @@ class Cache:else:cache_key = self.get_cache_key(*args, **kwargs)if cache_key is not None:- if isinstance(result, OpenAIObject):+ if isinstance(result, BaseModel):result = result.model_dump_json()## DEFAULT TTL ##@@ -2778,20 +2778,7 @@ def enable_cache(host: Optional[str] = None,port: Optional[str] = None,password: Optional[str] = None,- supported_call_types: Optional[- List[- Literal[- "completion",- "acompletion",- "embedding",- "aembedding",- "atranscription",- "transcription",- "atext_completion",- "text_completion",- ]- ]- ] = [+ supported_call_types: Optional[List[CachingSupportedCallTypes]] = ["completion","acompletion","embedding",@@ -2800,6 +2787,8 @@ def enable_cache("transcription","atext_completion","text_completion",+ "arerank",+ "rerank",],**kwargs,):@@ -2847,20 +2836,7 @@ def update_cache(host: Optional[str] = None,port: Optional[str] = None,password: Optional[str] = None,- supported_call_types: Optional[- List[- Literal[- "completion",- "acompletion",- "embedding",- "aembedding",- "atranscription",- "transcription",- "atext_completion",- "text_completion",- ]- ]- ] = [+ supported_call_types: Optional[List[CachingSupportedCallTypes]] = ["completion","acompletion","embedding",@@ -2869,6 +2845,8 @@ def update_cache("transcription","atext_completion","text_completion",+ "arerank",+ "rerank",],**kwargs,):diff --git a/litellm/integrations/langfuse.py b/litellm/integrations/langfuse.pyindex 177ff735c2f..c79b4342257 100644--- a/litellm/integrations/langfuse.py+++ b/litellm/integrations/langfuse.py@@ -191,7 +191,6 @@ class LangFuseLogger:pass# end of processing langfuse ########################-if (level == "ERROR"and status_message is not Nonediff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.pyindex 61cca6e074e..2572e695fb2 100644--- a/litellm/litellm_core_utils/exception_mapping_utils.py+++ b/litellm/litellm_core_utils/exception_mapping_utils.py@@ -67,25 +67,6 @@ def get_error_message(error_obj) -> Optional[str]:####### EXCEPTION MAPPING ################-def _get_litellm_response_headers(- original_exception: Exception,-) -> Optional[httpx.Headers]:- """- Extract and return the response headers from a mapped exception, if present.-- Used for accurate retry logic.- """- _response_headers: Optional[httpx.Headers] = None- try:- _response_headers = getattr(- original_exception, "litellm_response_headers", None- )- except Exception:- return None-- return _response_headers--def _get_response_headers(original_exception: Exception) -> Optional[httpx.Headers]:"""Extract and return the response headers from an exception, if present.@@ -96,8 +77,12 @@ def _get_response_headers(original_exception: Exception) -> Optional[httpx.Headetry:_response_headers = getattr(original_exception, "headers", None)error_response = getattr(original_exception, "response", None)- if _response_headers is None and error_response:+ if not _response_headers and error_response:_response_headers = getattr(error_response, "headers", None)+ if not _response_headers:+ _response_headers = getattr(+ original_exception, "litellm_response_headers", None+ )except Exception:return Nonediff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex a641be0194e..d3f15e6bc6b 100644--- a/litellm/litellm_core_utils/litellm_logging.py+++ b/litellm/litellm_core_utils/litellm_logging.py@@ -84,6 +84,7 @@ from ..integrations.s3 import S3Loggerfrom ..integrations.supabase import Supabasefrom ..integrations.traceloop import TraceloopLoggerfrom ..integrations.weights_biases import WeightsBiasesLogger+from .exception_mapping_utils import _get_response_headerstry:from ..proxy.enterprise.enterprise_callbacks.generic_api_callback import (@@ -1813,6 +1814,7 @@ class Logging:logging_obj=self,status="failure",error_str=str(exception),+ original_exception=exception,))return start_time, end_time@@ -2654,6 +2656,7 @@ def get_standard_logging_object_payload(logging_obj: Logging,status: StandardLoggingPayloadStatus,error_str: Optional[str] = None,+ original_exception: Optional[Exception] = None,) -> Optional[StandardLoggingPayload]:try:if kwargs is None:@@ -2670,6 +2673,19 @@ def get_standard_logging_object_payload(else:response_obj = {}+ if original_exception is not None and hidden_params is None:+ response_headers = _get_response_headers(original_exception)+ if response_headers is not None:+ hidden_params = dict(+ StandardLoggingHiddenParams(+ additional_headers=dict(response_headers),+ model_id=None,+ cache_key=None,+ api_base=None,+ response_cost=None,+ )+ )+# standardize this function to be used across, s3, dynamoDB, langfuse logginglitellm_params = kwargs.get("litellm_params", {})proxy_server_request = litellm_params.get("proxy_server_request") or {}diff --git a/litellm/model_prices_and_context_window_backup.json b/litellm/model_prices_and_context_window_backup.jsonindex c1a5e6b6700..962c629d7b9 100644--- a/litellm/model_prices_and_context_window_backup.json+++ b/litellm/model_prices_and_context_window_backup.json@@ -5075,6 +5075,116 @@"supports_function_calling": true,"supports_tool_choice": false},+ "meta.llama3-2-1b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.0000001,+ "output_cost_per_token": 0.0000001,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "us.meta.llama3-2-1b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.0000001,+ "output_cost_per_token": 0.0000001,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "eu.meta.llama3-2-1b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000013,+ "output_cost_per_token": 0.00000013,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "meta.llama3-2-3b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000015,+ "output_cost_per_token": 0.00000015,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "us.meta.llama3-2-3b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000015,+ "output_cost_per_token": 0.00000015,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "eu.meta.llama3-2-3b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000019,+ "output_cost_per_token": 0.00000019,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "meta.llama3-2-11b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000035,+ "output_cost_per_token": 0.00000035,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "us.meta.llama3-2-11b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000035,+ "output_cost_per_token": 0.00000035,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "meta.llama3-2-90b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.000002,+ "output_cost_per_token": 0.000002,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "us.meta.llama3-2-90b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.000002,+ "output_cost_per_token": 0.000002,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },"512-x-512/50-steps/stability.stable-diffusion-xl-v0": {"max_tokens": 77,"max_input_tokens": 77,diff --git a/litellm/proxy/_experimental/out/404.html b/litellm/proxy/_experimental/out/404.htmldeleted file mode 100644index 3387c26cee3..00000000000--- a/litellm/proxy/_experimental/out/404.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" href="/ui/_next/static/media/a34f9d1faa5f3315-s.p.woff2" as="font" crossorigin="" type="font/woff2"/><link rel="stylesheet" href="/ui/_next/static/css/00256a1984d35914.css" crossorigin="" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/ui/_next/static/chunks/webpack-e8ad0a25b0c46e0b.js" crossorigin=""/><script src="/ui/_next/static/chunks/fd9d1056-f593049e31b05aeb.js" async="" crossorigin=""></script><script src="/ui/_next/static/chunks/69-8316d07d1f41e39f.js" async="" crossorigin=""></script><script src="/ui/_next/static/chunks/main-app-9b4fb13a7db53edf.js" async="" crossorigin=""></script><title>404: This page could not be found.</title><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><meta name="next-size-adjust"/><script src="/ui/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js" crossorigin="" noModule=""></script></head><body class="__className_86ef86"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/ui/_next/static/chunks/webpack-e8ad0a25b0c46e0b.js" crossorigin="" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/ui/_next/static/media/a34f9d1faa5f3315-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/ui/_next/static/css/00256a1984d35914.css\",\"style\",{\"crossOrigin\":\"\"}]\n0:\"$L3\"\n"])</script><script>self.__next_f.push([1,"4:I[47690,[],\"\"]\n6:I[5613,[],\"\"]\n7:I[31778,[],\"\"]\nd:I[48955,[],\"\"]\n8:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n9:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\na:{\"display\":\"inline-block\"}\nb:{\"fontSize\":14,\"fontWe"])</script><script>self.__next_f.push([1,"ight\":400,\"lineHeight\":\"49px\",\"margin\":0}\ne:[]\n"])</script><script>self.__next_f.push([1,"3:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/ui/_next/static/css/00256a1984d35914.css\",\"precedence\":\"next\",\"crossOrigin\":\"\"}]],[\"$\",\"$L4\",null,{\"buildId\":\"Q5YcBgN0qLD3pcZcx1fRm\",\"assetPrefix\":\"/ui\",\"initialCanonicalUrl\":\"/_not-found\",\"initialTree\":[\"\",{\"children\":[\"__PAGE__\",{}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"__PAGE__\",{},[\"$L5\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],null]]},[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_86ef86\",\"children\":[\"$\",\"$L6\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L7\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$8\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$9\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$a\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$b\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[],\"styles\":null}]}]}],null]],\"initialHead\":[false,\"$Lc\"],\"globalErrorComponent\":\"$d\",\"missingSlots\":\"$We\"}]]\n"])</script><script>self.__next_f.push([1,"c:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"meta\",\"4\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script><script>self.__next_f.push([1,""])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_experimental/out/model_hub.html b/litellm/proxy/_experimental/out/model_hub.htmldeleted file mode 100644index bc65f3d703b..00000000000--- a/litellm/proxy/_experimental/out/model_hub.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/ui/_next/static/chunks/webpack-e8ad0a25b0c46e0b.js" crossorigin=""/><script src="/ui/_next/static/chunks/fd9d1056-f593049e31b05aeb.js" async="" crossorigin=""></script><script src="/ui/_next/static/chunks/69-8316d07d1f41e39f.js" async="" crossorigin=""></script><script src="/ui/_next/static/chunks/main-app-9b4fb13a7db53edf.js" async="" crossorigin=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/ui/favicon.ico" type="image/x-icon" sizes="16x16"/><meta name="next-size-adjust"/><script src="/ui/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js" crossorigin="" noModule=""></script></head><body><script src="/ui/_next/static/chunks/webpack-e8ad0a25b0c46e0b.js" crossorigin="" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/ui/_next/static/media/a34f9d1faa5f3315-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/ui/_next/static/css/00256a1984d35914.css\",\"style\",{\"crossOrigin\":\"\"}]\n0:\"$L3\"\n"])</script><script>self.__next_f.push([1,"4:I[47690,[],\"\"]\n6:I[77831,[],\"\"]\n7:I[87494,[\"902\",\"static/chunks/902-58bf23027703b2e8.js\",\"131\",\"static/chunks/131-3d2257b0ff5aadb2.js\",\"777\",\"static/chunks/777-a81b45dec53652df.js\",\"418\",\"static/chunks/app/model_hub/page-8ed460f3f33c0bf2.js\"],\"\"]\n8:I[5613,[],\"\"]\n9:I[31778,[],\"\"]\nb:I[48955,[],\"\"]\nc:[]\n"])</script><script>self.__next_f.push([1,"3:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/ui/_next/static/css/00256a1984d35914.css\",\"precedence\":\"next\",\"crossOrigin\":\"\"}]],[\"$\",\"$L4\",null,{\"buildId\":\"Q5YcBgN0qLD3pcZcx1fRm\",\"assetPrefix\":\"/ui\",\"initialCanonicalUrl\":\"/model_hub\",\"initialTree\":[\"\",{\"children\":[\"model_hub\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"model_hub\",{\"children\":[\"__PAGE__\",{},[\"$L5\",[\"$\",\"$L6\",null,{\"propsForComponent\":{\"params\":{}},\"Component\":\"$7\",\"isStaticGeneration\":true}],null]]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"model_hub\",\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}]]},[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_86ef86\",\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[],\"styles\":null}]}]}],null]],\"initialHead\":[false,\"$La\"],\"globalErrorComponent\":\"$b\",\"missingSlots\":\"$Wc\"}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/ui/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"meta\",\"5\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script><script>self.__next_f.push([1,""])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/_experimental/out/onboarding.html b/litellm/proxy/_experimental/out/onboarding.htmldeleted file mode 100644index 9ee6afdcbf1..00000000000--- a/litellm/proxy/_experimental/out/onboarding.html+++ /dev/null@@ -1 +0,0 @@-<!DOCTYPE html><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/ui/_next/static/chunks/webpack-e8ad0a25b0c46e0b.js" crossorigin=""/><script src="/ui/_next/static/chunks/fd9d1056-f593049e31b05aeb.js" async="" crossorigin=""></script><script src="/ui/_next/static/chunks/69-8316d07d1f41e39f.js" async="" crossorigin=""></script><script src="/ui/_next/static/chunks/main-app-9b4fb13a7db53edf.js" async="" crossorigin=""></script><title>LiteLLM Dashboard</title><meta name="description" content="LiteLLM Proxy Admin UI"/><link rel="icon" href="/ui/favicon.ico" type="image/x-icon" sizes="16x16"/><meta name="next-size-adjust"/><script src="/ui/_next/static/chunks/polyfills-c67a75d1b6f99dc8.js" crossorigin="" noModule=""></script></head><body><script src="/ui/_next/static/chunks/webpack-e8ad0a25b0c46e0b.js" crossorigin="" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/ui/_next/static/media/a34f9d1faa5f3315-s.p.woff2\",\"font\",{\"crossOrigin\":\"\",\"type\":\"font/woff2\"}]\n2:HL[\"/ui/_next/static/css/00256a1984d35914.css\",\"style\",{\"crossOrigin\":\"\"}]\n0:\"$L3\"\n"])</script><script>self.__next_f.push([1,"4:I[47690,[],\"\"]\n6:I[77831,[],\"\"]\n7:I[667,[\"665\",\"static/chunks/3014691f-b24e8254c7593934.js\",\"902\",\"static/chunks/902-58bf23027703b2e8.js\",\"684\",\"static/chunks/684-16b194c83a169f6d.js\",\"777\",\"static/chunks/777-a81b45dec53652df.js\",\"461\",\"static/chunks/app/onboarding/page-cba59362096ed469.js\"],\"\"]\n8:I[5613,[],\"\"]\n9:I[31778,[],\"\"]\nb:I[48955,[],\"\"]\nc:[]\n"])</script><script>self.__next_f.push([1,"3:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/ui/_next/static/css/00256a1984d35914.css\",\"precedence\":\"next\",\"crossOrigin\":\"\"}]],[\"$\",\"$L4\",null,{\"buildId\":\"Q5YcBgN0qLD3pcZcx1fRm\",\"assetPrefix\":\"/ui\",\"initialCanonicalUrl\":\"/onboarding\",\"initialTree\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"onboarding\",{\"children\":[\"__PAGE__\",{},[\"$L5\",[\"$\",\"$L6\",null,{\"propsForComponent\":{\"params\":{}},\"Component\":\"$7\",\"isStaticGeneration\":true}],null]]},[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"onboarding\",\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}]]},[null,[\"$\",\"html\",null,{\"lang\":\"en\",\"children\":[\"$\",\"body\",null,{\"className\":\"__className_86ef86\",\"children\":[\"$\",\"$L8\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"loading\":\"$undefined\",\"loadingStyles\":\"$undefined\",\"loadingScripts\":\"$undefined\",\"hasLoading\":false,\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L9\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[],\"styles\":null}]}]}],null]],\"initialHead\":[false,\"$La\"],\"globalErrorComponent\":\"$b\",\"missingSlots\":\"$Wc\"}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"LiteLLM Dashboard\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"LiteLLM Proxy Admin UI\"}],[\"$\",\"link\",\"4\",{\"rel\":\"icon\",\"href\":\"/ui/favicon.ico\",\"type\":\"image/x-icon\",\"sizes\":\"16x16\"}],[\"$\",\"meta\",\"5\",{\"name\":\"next-size-adjust\"}]]\n5:null\n"])</script><script>self.__next_f.push([1,""])</script></body></html>\ No newline at end of filediff --git a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.pyindex 510bec43e1c..0e2def3cba5 100644--- a/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py+++ b/litellm/proxy/pass_through_endpoints/pass_through_endpoints.py@@ -52,7 +52,7 @@ def get_response_body(response: httpx.Response):return response.text-async def set_env_variables_in_header(custom_headers: dict):+async def set_env_variables_in_header(custom_headers: Optional[dict]) -> Optional[dict]:"""checks if any headers on config.yaml are defined as os.environ/COHERE_API_KEY etc@@ -62,6 +62,8 @@ async def set_env_variables_in_header(custom_headers: dict):{"Authorization": "bearer os.environ/COHERE_API_KEY"}"""+ if custom_headers is None:+ return Noneheaders = {}for key, value in custom_headers.items():# langfuse Api requires base64 encoded headers - it's simpleer to just ask litellm users to set their langfuse public and secret keysdiff --git a/litellm/router.py b/litellm/router.pyindex 537c14ddc12..23880025e9c 100644--- a/litellm/router.py+++ b/litellm/router.py@@ -32,6 +32,8 @@ from openai import AsyncOpenAIfrom typing_extensions import overloadimport litellm+import litellm.litellm_core_utils+import litellm.litellm_core_utils.exception_mapping_utilsfrom litellm import get_secret_strfrom litellm._logging import verbose_router_loggerfrom litellm.assistants.main import AssistantDeleted@@ -3661,9 +3663,10 @@ class Router:kwargs.get("litellm_params", {}).get("metadata", None)_model_info = kwargs.get("litellm_params", {}).get("model_info", {})- exception_headers = litellm.utils._get_litellm_response_headers(+ exception_headers = litellm.litellm_core_utils.exception_mapping_utils._get_response_headers(original_exception=exception)+_time_to_cooldown = kwargs.get("litellm_params", {}).get("cooldown_time", self.cooldown_time)diff --git a/litellm/types/utils.py b/litellm/types/utils.pyindex c3118b453b9..2a36dd84d34 100644--- a/litellm/types/utils.py+++ b/litellm/types/utils.py@@ -1418,3 +1418,17 @@ class StandardCallbackDynamicParams(TypedDict, total=False):# GCS dynamic paramsgcs_bucket_name: Optional[str]gcs_path_service_account: Optional[str]+++CachingSupportedCallTypes = Literal[+ "completion",+ "acompletion",+ "embedding",+ "aembedding",+ "atranscription",+ "transcription",+ "atext_completion",+ "text_completion",+ "arerank",+ "rerank",+]diff --git a/litellm/utils.py b/litellm/utils.pyindex 9efde1be769..9524838d371 100644--- a/litellm/utils.py+++ b/litellm/utils.py@@ -60,7 +60,6 @@ from litellm.caching import DualCachefrom litellm.integrations.custom_logger import CustomLoggerfrom litellm.litellm_core_utils.core_helpers import map_finish_reasonfrom litellm.litellm_core_utils.exception_mapping_utils import (- _get_litellm_response_headers,_get_response_headers,exception_type,get_error_message,@@ -82,6 +81,7 @@ from litellm.types.llms.openai import (ChatCompletionToolParam,ChatCompletionToolParamFunctionChunk,)+from litellm.types.rerank import RerankResponsefrom litellm.types.utils import FileTypes # type: ignorefrom litellm.types.utils import (OPENAI_RESPONSE_HEADERS,@@ -720,6 +720,7 @@ def client(original_function):or kwargs.get("atext_completion", False) is Trueor kwargs.get("atranscription", False) is Trueor kwargs.get("arerank", False) is True+ or kwargs.get("_arealtime", False) is True):# [OPTIONAL] CHECK MAX RETRIES / REQUESTif litellm.num_retries_per_request is not None:@@ -819,6 +820,8 @@ def client(original_function):and kwargs.get("acompletion", False) is not Trueand kwargs.get("aimg_generation", False) is not Trueand kwargs.get("atranscription", False) is not True+ and kwargs.get("arerank", False) is not True+ and kwargs.get("_arealtime", False) is not True): # allow users to control returning cached responses from the completion function# checking cacheprint_verbose("INSIDE CHECKING CACHE")@@ -835,7 +838,6 @@ def client(original_function):)cached_result = litellm.cache.get_cache(*args, **kwargs)if cached_result is not None:- print_verbose("Cache Hit!")if "detail" in cached_result:# implies an error occurredpass@@ -867,7 +869,13 @@ def client(original_function):response_object=cached_result,response_type="embedding",)-+ elif call_type == CallTypes.rerank.value and isinstance(+ cached_result, dict+ ):+ cached_result = convert_to_model_response_object(+ response_object=cached_result,+ response_type="rerank",+ )# LOG SUCCESScache_hit = Trueend_time = datetime.datetime.now()@@ -916,6 +924,12 @@ def client(original_function):target=logging_obj.success_handler,args=(cached_result, start_time, end_time, cache_hit),).start()+ cache_key = kwargs.get("preset_cache_key", None)+ if (+ isinstance(cached_result, BaseModel)+ or isinstance(cached_result, CustomStreamWrapper)+ ) and hasattr(cached_result, "_hidden_params"):+ cached_result._hidden_params["cache_key"] = cache_key # type: ignorereturn cached_resultelse:print_verbose(@@ -991,8 +1005,7 @@ def client(original_function):if (litellm.cache is not Noneand litellm.cache.supported_call_types is not None- and str(original_function.__name__)- in litellm.cache.supported_call_types+ and call_type in litellm.cache.supported_call_types) and (kwargs.get("cache", {}).get("no-store", False) is not True):litellm.cache.add_cache(result, *args, **kwargs)@@ -1257,6 +1270,14 @@ def client(original_function):model_response_object=EmbeddingResponse(),response_type="embedding",)+ elif call_type == CallTypes.arerank.value and isinstance(+ cached_result, dict+ ):+ cached_result = convert_to_model_response_object(+ response_object=cached_result,+ model_response_object=None,+ response_type="rerank",+ )elif call_type == CallTypes.atranscription.value and isinstance(cached_result, dict):@@ -1460,6 +1481,7 @@ def client(original_function):isinstance(result, litellm.ModelResponse)or isinstance(result, litellm.EmbeddingResponse)or isinstance(result, TranscriptionResponse)+ or isinstance(result, RerankResponse)):if (isinstance(result, EmbeddingResponse)@@ -5880,10 +5902,16 @@ def convert_to_streaming_response(response_object: Optional[dict] = None):def convert_to_model_response_object(response_object: Optional[dict] = None,model_response_object: Optional[- Union[ModelResponse, EmbeddingResponse, ImageResponse, TranscriptionResponse]+ Union[+ ModelResponse,+ EmbeddingResponse,+ ImageResponse,+ TranscriptionResponse,+ RerankResponse,+ ]] = None,response_type: Literal[- "completion", "embedding", "image_generation", "audio_transcription"+ "completion", "embedding", "image_generation", "audio_transcription", "rerank"] = "completion",stream=False,start_time=None,@@ -6133,6 +6161,27 @@ def convert_to_model_response_object(if _response_headers is not None:model_response_object._response_headers = _response_headers+ return model_response_object+ elif response_type == "rerank" and (+ model_response_object is None+ or isinstance(model_response_object, RerankResponse)+ ):+ if response_object is None:+ raise Exception("Error in response object format")++ if model_response_object is None:+ model_response_object = RerankResponse(**response_object)+ return model_response_object++ if "id" in response_object:+ model_response_object.id = response_object["id"]++ if "meta" in response_object:+ model_response_object.meta = response_object["meta"]++ if "results" in response_object:+ model_response_object.results = response_object["results"]+return model_response_objectexcept Exception:raise Exception(diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.jsonindex c1a5e6b6700..962c629d7b9 100644--- a/model_prices_and_context_window.json+++ b/model_prices_and_context_window.json@@ -5075,6 +5075,116 @@"supports_function_calling": true,"supports_tool_choice": false},+ "meta.llama3-2-1b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.0000001,+ "output_cost_per_token": 0.0000001,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "us.meta.llama3-2-1b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.0000001,+ "output_cost_per_token": 0.0000001,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "eu.meta.llama3-2-1b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000013,+ "output_cost_per_token": 0.00000013,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "meta.llama3-2-3b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000015,+ "output_cost_per_token": 0.00000015,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "us.meta.llama3-2-3b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000015,+ "output_cost_per_token": 0.00000015,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "eu.meta.llama3-2-3b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000019,+ "output_cost_per_token": 0.00000019,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "meta.llama3-2-11b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000035,+ "output_cost_per_token": 0.00000035,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "us.meta.llama3-2-11b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.00000035,+ "output_cost_per_token": 0.00000035,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "meta.llama3-2-90b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.000002,+ "output_cost_per_token": 0.000002,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },+ "us.meta.llama3-2-90b-instruct-v1:0": {+ "max_tokens": 128000,+ "max_input_tokens": 128000,+ "max_output_tokens": 4096,+ "input_cost_per_token": 0.000002,+ "output_cost_per_token": 0.000002,+ "litellm_provider": "bedrock",+ "mode": "chat",+ "supports_function_calling": true,+ "supports_tool_choice": false+ },"512-x-512/50-steps/stability.stable-diffusion-xl-v0": {"max_tokens": 77,"max_input_tokens": 77,diff --git a/tests/local_testing/test_caching.py b/tests/local_testing/test_caching.pyindex a98b4760347..8ba788a5514 100644--- a/tests/local_testing/test_caching.py+++ b/tests/local_testing/test_caching.py@@ -5,6 +5,7 @@ import tracebackimport uuidfrom dotenv import load_dotenv+from test_rerank import assert_response_shapeload_dotenv()import os@@ -2234,3 +2235,56 @@ def test_logging_turn_off_message_logging_streaming():mock_client.assert_called_once()assert mock_client.call_args.args[0].choices[0].message.content == "hello"++[email protected]("sync_mode", [True, False])+ "top_n_1, top_n_2, expect_cache_hit",+ [+ (3, 3, True),+ (3, None, False),+ ],+)+async def test_basic_rerank_caching(sync_mode, top_n_1, top_n_2, expect_cache_hit):+ litellm.set_verbose = True+ litellm.cache = Cache(type="local")++ if sync_mode is True:+ for idx in range(2):+ if idx == 0:+ top_n = top_n_1+ else:+ top_n = top_n_2+ response = litellm.rerank(+ model="cohere/rerank-english-v3.0",+ query="hello",+ documents=["hello", "world"],+ top_n=top_n,+ )+ else:+ for idx in range(2):+ if idx == 0:+ top_n = top_n_1+ else:+ top_n = top_n_2+ response = await litellm.arerank(+ model="cohere/rerank-english-v3.0",+ query="hello",+ documents=["hello", "world"],+ top_n=top_n,+ )++ await asyncio.sleep(1)++ if expect_cache_hit is True:+ assert "cache_key" in response._hidden_params+ else:+ assert "cache_key" not in response._hidden_params++ print("re rank response: ", response)++ assert response.id is not None+ assert response.results is not None++ assert_response_shape(response, custom_llm_provider="cohere")diff --git a/tests/local_testing/test_custom_callback_input.py b/tests/local_testing/test_custom_callback_input.pyindex 384b4b6fd6a..c079123e797 100644--- a/tests/local_testing/test_custom_callback_input.py+++ b/tests/local_testing/test_custom_callback_input.py@@ -1385,9 +1385,9 @@ def test_logging_standard_payload_failure_call():resp = litellm.completion(model="gpt-3.5-turbo",messages=[{"role": "user", "content": "Hey, how's it going?"}],- mock_response="litellm.RateLimitError",+ api_key="my-bad-api-key",)- except litellm.RateLimitError:+ except litellm.AuthenticationError:passmock_client.assert_called_once()@@ -1401,6 +1401,7 @@ def test_logging_standard_payload_failure_call():standard_logging_object: StandardLoggingPayload = mock_client.call_args.kwargs["kwargs"]["standard_logging_object"]+ assert "additional_headers" in standard_logging_object["hidden_params"]@pytest.mark.parametrize("stream", [True, False])diff --git a/tests/local_testing/test_custom_llm.py b/tests/local_testing/test_custom_llm.pyindex 29daef48130..f21b27c43a2 100644--- a/tests/local_testing/test_custom_llm.py+++ b/tests/local_testing/test_custom_llm.py@@ -368,7 +368,7 @@ async def test_simple_image_generation_async():@pytest.mark.asyncio-async def test_image_generation_async_with_api_key_and_api_base():+async def test_image_generation_async_additional_params():my_custom_llm = MyCustomLLM()litellm.custom_provider_map = [{"provider": "custom_llm", "custom_handler": my_custom_llm}@@ -383,6 +383,7 @@ async def test_image_generation_async_with_api_key_and_api_base():prompt="Hello world",api_key="my-api-key",api_base="my-api-base",+ my_custom_param="my-custom-param",)print(resp)@@ -393,3 +394,6 @@ async def test_image_generation_async_with_api_key_and_api_base():mock_client.call_args.kwargs["api_key"] == "my-api-key"mock_client.call_args.kwargs["api_base"] == "my-api-base"+ mock_client.call_args.kwargs["optional_params"] == {+ "my_custom_param": "my-custom-param"+ }diff --git a/tests/local_testing/test_pass_through_endpoints.py b/tests/local_testing/test_pass_through_endpoints.pyindex 28e6acda9fd..b3977e93604 100644--- a/tests/local_testing/test_pass_through_endpoints.py+++ b/tests/local_testing/test_pass_through_endpoints.py@@ -39,6 +39,36 @@ def client():return TestClient(app)+async def test_pass_through_endpoint_no_headers(client, monkeypatch):+ # Mock the httpx.AsyncClient.request method+ monkeypatch.setattr("httpx.AsyncClient.request", mock_request)+ import litellm++ # Define a pass-through endpoint+ pass_through_endpoints = [+ {+ "path": "/test-endpoint",+ "target": "https://api.example.com/v1/chat/completions",+ }+ ]++ # Initialize the pass-through endpoint+ await initialize_pass_through_endpoints(pass_through_endpoints)+ general_settings: dict = (+ getattr(litellm.proxy.proxy_server, "general_settings", {}) or {}+ )+ general_settings.update({"pass_through_endpoints": pass_through_endpoints})+ setattr(litellm.proxy.proxy_server, "general_settings", general_settings)++ # Make a request to the pass-through endpoint+ response = client.post("/test-endpoint", json={"prompt": "Hello, world!"})++ # Assert the response+ assert response.status_code == 200+ assert response.json() == {"message": "Mocked response"}++@pytest.mark.asyncioasync def test_pass_through_endpoint(client, monkeypatch):# Mock the httpx.AsyncClient.request method