mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-27 11:43:54 +00:00
feat(proxy_server.py): return api base in response headers
Closes https://github.com/BerriAI/litellm/issues/2631
This commit is contained in:
parent
446ec93088
commit
aca36d8b79
4 changed files with 67 additions and 11 deletions
|
@ -15,6 +15,7 @@ import litellm
|
|||
import pytest
|
||||
import asyncio
|
||||
from unittest.mock import patch, MagicMock
|
||||
from litellm.utils import get_api_base
|
||||
from litellm.caching import DualCache
|
||||
from litellm.integrations.slack_alerting import SlackAlerting
|
||||
from litellm.proxy._types import UserAPIKeyAuth
|
||||
|
@ -74,6 +75,19 @@ async def test_slack_alerting_llm_exceptions(exception_type, monkeypatch):
|
|||
await asyncio.sleep(2)
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
"model, optional_params, expected_api_base",
|
||||
[
|
||||
("openai/my-fake-model", {"api_base": "my-fake-api-base"}, "my-fake-api-base"),
|
||||
("gpt-3.5-turbo", {}, "https://api.openai.com"),
|
||||
],
|
||||
)
|
||||
def test_get_api_base_unit_test(model, optional_params, expected_api_base):
|
||||
api_base = get_api_base(model=model, optional_params=optional_params)
|
||||
|
||||
assert api_base == expected_api_base
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_get_api_base():
|
||||
_pl = ProxyLogging(user_api_key_cache=DualCache())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue