test(test_lowest_latency_routing.py): use mock responses

This commit is contained in:
Krrish Dholakia 2024-06-20 21:05:23 -07:00
parent e96326a211
commit cd73ea245a

View file

@ -1,22 +1,29 @@
#### What this tests ####
# This tests the router's ability to pick deployment with lowest latency
import sys, os, asyncio, time, random
from datetime import datetime, timedelta
import asyncio
import os
import random
import sys
import time
import traceback
from datetime import datetime, timedelta
from dotenv import load_dotenv
load_dotenv()
import os, copy
import copy
import os
sys.path.insert(
0, os.path.abspath("../..")
) # Adds the parent directory to the system path
import pytest
from litellm import Router
from litellm.router_strategy.lowest_latency import LowestLatencyLoggingHandler
from litellm.caching import DualCache
import litellm
from litellm import Router
from litellm.caching import DualCache
from litellm.router_strategy.lowest_latency import LowestLatencyLoggingHandler
### UNIT TESTS FOR LATENCY ROUTING ###
@ -522,6 +529,7 @@ async def test_router_completion_streaming():
"api_key": "os.environ/AZURE_FRANCE_API_KEY",
"api_base": "https://openai-france-1234.openai.azure.com",
"rpm": 1440,
"mock_response": "Hello world",
},
"model_info": {"id": 1},
},
@ -532,6 +540,7 @@ async def test_router_completion_streaming():
"api_key": "os.environ/AZURE_EUROPE_API_KEY",
"api_base": "https://my-endpoint-europe-berri-992.openai.azure.com",
"rpm": 6,
"mock_response": "Hello world",
},
"model_info": {"id": 2},
},