Spaces:
Configuration error
Configuration error
File size: 854 Bytes
14812fd b8804a6 14812fd f5b5ebf 9c0d580 f5b5ebf 23a3cae b8804a6 f5b5ebf 23a3cae b8804a6 f5b5ebf 23a3cae b8804a6 14812fd b8804a6 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
import openai
from openai import AsyncOpenAI
import pytest
MODEL_THAT_EXISTS = "Systran/faster-whisper-tiny.en"
MODEL_THAT_DOES_NOT_EXIST = "i-do-not-exist"
MIN_EXPECTED_NUMBER_OF_MODELS = 70 # At the time of the test creation there are 89 models
@pytest.mark.asyncio
async def test_list_models(openai_client: AsyncOpenAI) -> None:
models = (await openai_client.models.list()).data
assert len(models) > MIN_EXPECTED_NUMBER_OF_MODELS
@pytest.mark.asyncio
async def test_model_exists(openai_client: AsyncOpenAI) -> None:
model = await openai_client.models.retrieve(MODEL_THAT_EXISTS)
assert model.id == MODEL_THAT_EXISTS
@pytest.mark.asyncio
async def test_model_does_not_exist(openai_client: AsyncOpenAI) -> None:
with pytest.raises(openai.NotFoundError):
await openai_client.models.retrieve(MODEL_THAT_DOES_NOT_EXIST)
|