Spaces:
Running on Zero
Running on Zero
| 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 | |