test: Parameterize DeepSeek model component test correctly (#7019)
test: Parameterize DeepSeek model component test with temperature and max tokens
This commit is contained in:
parent
24facbe2a6
commit
979c4a6d70
1 changed files with 10 additions and 10 deletions
|
|
@ -40,6 +40,11 @@ def test_deepseek_template():
|
||||||
assert input_name in input_names
|
assert input_name in input_names
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def mock_chat_openai(mocker):
|
||||||
|
return mocker.patch("langchain_openai.ChatOpenAI")
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
("temperature", "max_tokens"),
|
("temperature", "max_tokens"),
|
||||||
[
|
[
|
||||||
|
|
@ -48,15 +53,10 @@ def test_deepseek_template():
|
||||||
(1.5, 1000),
|
(1.5, 1000),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@pytest.fixture
|
def test_deepseek_build_model(mock_chat_openai, temperature, max_tokens):
|
||||||
def mock_chat_openai(mocker):
|
|
||||||
return mocker.patch("langchain_openai.ChatOpenAI")
|
|
||||||
|
|
||||||
|
|
||||||
def test_deepseek_build_model(mock_chat_openai):
|
|
||||||
component = DeepSeekModelComponent()
|
component = DeepSeekModelComponent()
|
||||||
component.temperature = 0.7
|
component.temperature = temperature
|
||||||
component.max_tokens = 100
|
component.max_tokens = max_tokens
|
||||||
component.api_key = "test-key"
|
component.api_key = "test-key"
|
||||||
|
|
||||||
# Mock the ChatOpenAI instance
|
# Mock the ChatOpenAI instance
|
||||||
|
|
@ -67,12 +67,12 @@ def test_deepseek_build_model(mock_chat_openai):
|
||||||
|
|
||||||
# Verify ChatOpenAI was called with correct params
|
# Verify ChatOpenAI was called with correct params
|
||||||
mock_chat_openai.assert_called_once_with(
|
mock_chat_openai.assert_called_once_with(
|
||||||
max_tokens=100,
|
max_tokens=max_tokens,
|
||||||
model_kwargs={},
|
model_kwargs={},
|
||||||
model="deepseek-chat",
|
model="deepseek-chat",
|
||||||
base_url="https://api.deepseek.com",
|
base_url="https://api.deepseek.com",
|
||||||
api_key="test-key",
|
api_key="test-key",
|
||||||
temperature=0.7,
|
temperature=temperature,
|
||||||
seed=1,
|
seed=1,
|
||||||
streaming=False,
|
streaming=False,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue