Kalpana-Plain-Models-API / tests /test_tokenize.py
MaduRox's picture
Add rich Swagger API documentation
b7a913f
Raw
History Blame Contribute Delete
524 Bytes
import os
os.environ["MOCK_INFERENCE"] = "true"
from fastapi.testclient import TestClient
from app import app
client = TestClient(app)
def test_tokenize():
payload = {
"model": "plain-llama-3-8b",
"text": "This is a test sentence."
}
response = client.post("/v1/tokenize", json=payload)
assert response.status_code == 200
json_data = response.json()
assert json_data["model"] == "plain-llama-3-8b"
assert "token_count" in json_data
assert json_data["token_count"] > 0