-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Improve robustness of get_task HF pipeline invocations (#5284)
* replace get_task method and change invocation layer order * add test for invocation layer order * add test documentation * make invocation layer test more robust * fix type annotation * change hf timeout * simplify timeout mock and add get_task exception cause --------- Co-authored-by: Stefano Fiorucci <44616784+anakin87@users.noreply.github.com>
- Loading branch information
1 parent
ac41219
commit 08f1865
Showing
4 changed files
with
29 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import pytest | ||
|
||
from haystack.nodes.prompt.prompt_model import PromptModelInvocationLayer | ||
from haystack.nodes.prompt.invocation_layer import HFLocalInvocationLayer, HFInferenceEndpointInvocationLayer | ||
|
||
|
||
@pytest.mark.unit | ||
def test_invocation_layer_order(): | ||
""" | ||
Checks that the huggingface invocation layer is checked late because it can timeout/be slow to respond. | ||
""" | ||
last_invocation_layers = set(PromptModelInvocationLayer.invocation_layer_providers[-5:]) | ||
assert HFLocalInvocationLayer in last_invocation_layers | ||
assert HFInferenceEndpointInvocationLayer in last_invocation_layers |