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
test whisper
Ishaan Jaffd6c3560ff130
diff --git a/litellm/tests/eagle.wav b/litellm/tests/eagle.wavnew file mode 100644index 00000000000..1c23657859eBinary files /dev/null and b/litellm/tests/eagle.wav differdiff --git a/litellm/tests/test_whisper.py b/litellm/tests/test_whisper.pyindex 9d26d2d4e6f..0ac8d094f20 100644--- a/litellm/tests/test_whisper.py+++ b/litellm/tests/test_whisper.py@@ -26,6 +26,10 @@ file_path = os.path.join(pwd, "gettysburg.wav")audio_file = open(file_path, "rb")++file2_path = os.path.join(pwd, "eagle.wav")+audio_file2 = open(file2_path, "rb")+load_dotenv()sys.path.insert(@@ -148,3 +152,44 @@ async def test_transcription_on_router():except Exception as e:traceback.print_exc()pytest.fail(f"Error occurred: {e}")+++async def test_transcription_caching():+ import litellm+ from litellm.caching import Cache++ litellm.set_verbose = True+ litellm.cache = Cache()++ # make raw llm api call++ response_1 = await litellm.atranscription(+ model="whisper-1",+ file=audio_file,+ )++ await asyncio.sleep(5)++ # cache hit++ response_2 = await litellm.atranscription(+ model="whisper-1",+ file=audio_file,+ )++ print("response_1", response_1)+ print("response_2", response_2)+ print("response2 hidden params", response_2._hidden_params)+ assert response_2._hidden_params["cache_hit"] is True++ # cache miss++ response_3 = await litellm.atranscription(+ model="whisper-1",+ file=audio_file2,+ )+ print("response_3", response_3)+ print("response3 hidden params", response_3._hidden_params)+ assert response_3._hidden_params.get("cache_hit") is not True+ assert response_3.text != response_2.text