2023-07-06 16:33:44 +02:00
|
|
|
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():
|
|
|
|
"""
|
2023-07-26 15:26:39 +02:00
|
|
|
Checks that the huggingface invocation layer is positioned further down the list of providers
|
|
|
|
as they can time out or be slow to respond.
|
2023-07-06 16:33:44 +02:00
|
|
|
"""
|
2023-07-26 15:26:39 +02:00
|
|
|
invocation_layers = PromptModelInvocationLayer.invocation_layer_providers
|
|
|
|
assert HFLocalInvocationLayer in invocation_layers
|
|
|
|
assert HFInferenceEndpointInvocationLayer in invocation_layers
|
|
|
|
index_hf = invocation_layers.index(HFLocalInvocationLayer) + 1
|
|
|
|
index_hf_inference = invocation_layers.index(HFInferenceEndpointInvocationLayer) + 1
|
|
|
|
assert index_hf > len(invocation_layers) / 2
|
|
|
|
assert index_hf_inference > len(invocation_layers) / 2
|