forked from phoenix/litellm-mirror
(test) test reading configs on proxy
This commit is contained in:
parent
aeee8fd3da
commit
13201edc4b
1 changed files with 29 additions and 15 deletions
|
@ -285,40 +285,50 @@ from litellm.proxy.proxy_server import ProxyConfig
|
|||
|
||||
def test_load_router_config():
|
||||
try:
|
||||
import asyncio
|
||||
|
||||
print("testing reading config")
|
||||
# this is a basic config.yaml with only a model
|
||||
filepath = os.path.dirname(os.path.abspath(__file__))
|
||||
proxy_config = ProxyConfig()
|
||||
result = proxy_config.load_config(
|
||||
result = asyncio.run(
|
||||
proxy_config.load_config(
|
||||
router=None,
|
||||
config_file_path=f"{filepath}/example_config_yaml/simple_config.yaml",
|
||||
)
|
||||
)
|
||||
print(result)
|
||||
assert len(result[1]) == 1
|
||||
|
||||
# this is a load balancing config yaml
|
||||
result = load_router_config(
|
||||
result = asyncio.run(
|
||||
proxy_config.load_config(
|
||||
router=None,
|
||||
config_file_path=f"{filepath}/example_config_yaml/azure_config.yaml",
|
||||
)
|
||||
)
|
||||
print(result)
|
||||
assert len(result[1]) == 2
|
||||
|
||||
# config with general settings - custom callbacks
|
||||
result = load_router_config(
|
||||
result = asyncio.run(
|
||||
proxy_config.load_config(
|
||||
router=None,
|
||||
config_file_path=f"{filepath}/example_config_yaml/azure_config.yaml",
|
||||
)
|
||||
)
|
||||
print(result)
|
||||
assert len(result[1]) == 2
|
||||
|
||||
# tests for litellm.cache set from config
|
||||
print("testing reading proxy config for cache")
|
||||
litellm.cache = None
|
||||
load_router_config(
|
||||
asyncio.run(
|
||||
proxy_config.load_config(
|
||||
router=None,
|
||||
config_file_path=f"{filepath}/example_config_yaml/cache_no_params.yaml",
|
||||
)
|
||||
)
|
||||
assert litellm.cache is not None
|
||||
assert "redis_client" in vars(
|
||||
litellm.cache.cache
|
||||
|
@ -330,11 +340,15 @@ def test_load_router_config():
|
|||
"aembedding",
|
||||
] # init with all call types
|
||||
|
||||
litellm.disable_cache()
|
||||
|
||||
print("testing reading proxy config for cache with params")
|
||||
load_router_config(
|
||||
asyncio.run(
|
||||
proxy_config.load_config(
|
||||
router=None,
|
||||
config_file_path=f"{filepath}/example_config_yaml/cache_with_params.yaml",
|
||||
)
|
||||
)
|
||||
assert litellm.cache is not None
|
||||
print(litellm.cache)
|
||||
print(litellm.cache.supported_call_types)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue