mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 11:14:04 +00:00
test(test_router.py): add more testing for dynamically passing params to router
This commit is contained in:
parent
6c1f8378c1
commit
05754ef238
1 changed files with 18 additions and 24 deletions
|
@ -942,27 +942,21 @@ def test_reading_openai_keys_os_environ():
|
||||||
|
|
||||||
|
|
||||||
# test_reading_openai_keys_os_environ()
|
# test_reading_openai_keys_os_environ()
|
||||||
# def test_router_timeout():
|
|
||||||
# model_list = [
|
|
||||||
# {
|
def test_router_anthropic_key_dynamic():
|
||||||
# "model_name": "gpt-3.5-turbo",
|
anthropic_api_key = os.environ.pop("ANTHROPIC_API_KEY")
|
||||||
# "litellm_params": {
|
model_list = [
|
||||||
# "model": "gpt-3.5-turbo",
|
{
|
||||||
# "api_key": "os.environ/OPENAI_API_KEY",
|
"model_name": "anthropic-claude",
|
||||||
# "timeout": "os.environ/AZURE_TIMEOUT",
|
"litellm_params": {
|
||||||
# "stream_timeout": "os.environ/AZURE_STREAM_TIMEOUT",
|
"model": "claude-instant-1",
|
||||||
# "max_retries": "os.environ/AZURE_MAX_RETRIES",
|
"api_key": anthropic_api_key,
|
||||||
# },
|
},
|
||||||
# }
|
}
|
||||||
# ]
|
]
|
||||||
# router = Router(model_list=model_list)
|
|
||||||
# messages = [{"role": "user", "content": "Hey, how's it going?"}]
|
router = Router(model_list=model_list)
|
||||||
# start_time = time.time()
|
messages = [{"role": "user", "content": "Hey, how's it going?"}]
|
||||||
# try:
|
router.completion(model="anthropic-claude", messages=messages)
|
||||||
# router.completion(
|
os.environ["ANTHROPIC_API_KEY"] = anthropic_api_key
|
||||||
# model="gpt-3.5-turbo", messages=messages, max_tokens=500, timeout=1
|
|
||||||
# )
|
|
||||||
# except litellm.exceptions.Timeout as e:
|
|
||||||
# pass
|
|
||||||
# end_time = time.time()
|
|
||||||
# assert end_time - start_time < 1.1
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue