mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-07-06 08:30:31 +00:00

* init * Change question * Add TODO comment * Addressing feedback * Add local folder option. Move additional functions inside haystack.utils for easier imports * Apply Daria's review suggestions Co-authored-by: Daria Fokina <daria.fokina@deepset.ai> * Add integration test * change string formatting Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com> * Add outputparser to HF * Exclude anthropic test --------- Co-authored-by: Daria Fokina <daria.fokina@deepset.ai> Co-authored-by: Silvano Cerza <3314350+silvanocerza@users.noreply.github.com>
26 lines
938 B
Python
26 lines
938 B
Python
import os
|
|
|
|
import pytest
|
|
|
|
from examples.getting_started import getting_started
|
|
from haystack.schema import Answer, Document
|
|
|
|
|
|
@pytest.mark.integration
|
|
@pytest.mark.parametrize("provider", ["cohere", "huggingface", "openai"])
|
|
def test_getting_started(provider):
|
|
if provider == "anthropic":
|
|
api_key = os.environ.get("ANTHROPIC_API_KEY", "")
|
|
elif provider == "cohere":
|
|
api_key = os.environ.get("COHERE_API_KEY", "")
|
|
elif provider == "huggingface":
|
|
api_key = os.environ.get("HUGGINGFACE_API_KEY", "")
|
|
elif provider == "openai":
|
|
api_key = os.environ.get("OPENAI_API_KEY", "")
|
|
result = getting_started(provider=provider, API_KEY=api_key)
|
|
|
|
# Testing only for functionality. Since model predictions from APIs might change, we cannot test those directly.
|
|
assert isinstance(result, dict)
|
|
assert type(result["answers"][0]) == Answer
|
|
assert type(result["documents"][0]) == Document
|