From a18aeaa2fbeae51e463fa69ebe06813b8a78d9cc Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Mon, 25 Nov 2024 15:39:42 -0800 Subject: [PATCH] add test_regex_pattern_matching_e2e_test --- proxy_server_config.yaml | 5 +++++ tests/test_openai_endpoints.py | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/proxy_server_config.yaml b/proxy_server_config.yaml index b1d6b3dc6..4b1c21a7b 100644 --- a/proxy_server_config.yaml +++ b/proxy_server_config.yaml @@ -96,6 +96,11 @@ model_list: litellm_params: model: "groq/*" api_key: os.environ/GROQ_API_KEY + - model_name: "custom-llm-engine/*" + litellm_params: + model: "openai/my-fake-model" + api_base: https://exampleopenaiendpoint-production.up.railway.app/ + api_key: fake-key - model_name: mistral-embed litellm_params: model: mistral/mistral-embed diff --git a/tests/test_openai_endpoints.py b/tests/test_openai_endpoints.py index 4dbeda188..3d1296b96 100644 --- a/tests/test_openai_endpoints.py +++ b/tests/test_openai_endpoints.py @@ -473,6 +473,24 @@ async def test_openai_wildcard_chat_completion(): await chat_completion(session=session, key=key, model="gpt-3.5-turbo-0125") +@pytest.mark.asyncio +async def test_regex_pattern_matching_e2e_test(): + """ + - Create key for model = "custom-llm-engine/*" -> this has access to all models matching pattern = "custom-llm-engine/*" + - proxy_server_config.yaml has model = "custom-llm-engine/*" + - Make chat completion call + + """ + async with aiohttp.ClientSession() as session: + key_gen = await generate_key(session=session, models=["custom-llm-engine/*"]) + key = key_gen["key"] + + # call chat/completions with a model that the key was not created for + the model is not on the config.yaml + await chat_completion( + session=session, key=key, model="custom-llm-engine/very-new-model" + ) + + @pytest.mark.asyncio async def test_proxy_all_models(): """