DS553-Fall26 / tests /test_smoke.py
sdkrastev's picture
Sync from GitHub via hub-sync
f2b8242 verified
Raw
History Blame Contribute Delete
483 Bytes
import os
from huggingface_hub import InferenceClient
def test_huggingface_api():
token = os.environ.get("HF_TOKEN")
assert token, "HF_TOKEN not set in environment"
client = InferenceClient(
token=token,
model="openai/gpt-oss-20b",
)
response = client.chat_completion(
[{"role": "user", "content": "Reply briefly with hello."}],
max_tokens=100,
)
assert response.choices
assert response.choices[0].message.content