fix(deepseek): accept base_url as alias for api_base (#35789)

Add `base_url` as a Pydantic alias for `ChatDeepSeek.api_base`, so users
can pass `base_url=` when constructing the model.
This commit is contained in:
Mason Daugherty
2026-03-12 10:27:34 -04:00
committed by GitHub
parent 5d9568b5f5
commit b676167707
3 changed files with 22 additions and 9 deletions

View File

@@ -104,6 +104,15 @@ class TestChatDeepSeekUnit(ChatModelUnitTests):
class TestChatDeepSeekCustomUnit:
"""Custom tests specific to DeepSeek chat model."""
def test_base_url_alias(self) -> None:
"""Test that `base_url` is accepted as an alias for `api_base`."""
chat_model = ChatDeepSeek(
model=MODEL_NAME,
api_key=SecretStr("api_key"),
base_url="http://example.test/v1",
)
assert chat_model.api_base == "http://example.test/v1"
def test_create_chat_result_with_reasoning_content(self) -> None:
"""Test that reasoning_content is properly extracted from response."""
chat_model = ChatDeepSeek(model=MODEL_NAME, api_key=SecretStr("api_key"))
@@ -329,7 +338,7 @@ class TestChatDeepSeekAzureToolChoice:
return ChatDeepSeek(
model="deepseek-chat",
api_key=SecretStr("test_key"),
api_base=endpoint,
base_url=endpoint,
)
def test_is_azure_endpoint_detection(self) -> None:
@@ -356,7 +365,7 @@ class TestChatDeepSeekAzureToolChoice:
llm = ChatDeepSeek(
model="deepseek-chat",
api_key=SecretStr("test_key"),
api_base=endpoint,
base_url=endpoint,
)
assert not llm._is_azure_endpoint, f"Expected non-Azure for {endpoint}"