mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-08-11 18:17:53 +00:00

* Rework some PromptNode and PromptModel tests * Remove duplicate code in PromptNode * Fix mypy * Fix test cause of missing fixture * Revert "Fix mypy" This reverts commit e530295a06cb260d9a8bd89679534958cb3d9776. * Revert "Remove duplicate code in PromptNode" This reverts commit 4a678ae81504dcc78a737372c061d12dc8799639.
13 lines
429 B
Python
13 lines
429 B
Python
from unittest.mock import Mock
|
|
|
|
|
|
def create_mock_layer_that_supports(model_name, response=["fake_response"]):
|
|
"""
|
|
Create a mock invocation layer that supports the model_name and returns response.
|
|
"""
|
|
|
|
def mock_supports(model_name_or_path, **kwargs):
|
|
return model_name_or_path == model_name
|
|
|
|
return Mock(**{"model_name_or_path": model_name, "supports": mock_supports, "invoke.return_value": response})
|