mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
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:
@@ -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}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user