tests: simple test for server module

This commit is contained in:
Lucas Doyle
2023-04-28 23:26:07 -07:00
parent 468377b0e2
commit 6d8db9d017
4 changed files with 117 additions and 2 deletions

View File

@@ -128,3 +128,24 @@ def test_utf8(monkeypatch):
n = 0 # reset
completion = llama.create_completion("", max_tokens=1)
assert completion["choices"][0]["text"] == ""
def test_llama_server():
from fastapi.testclient import TestClient
import os
os.environ["MODEL"] = MODEL
os.environ["VOCAB_ONLY"] = "true"
from llama_cpp.server.app import app
client = TestClient(app)
response = client.get("/v1/models")
assert response.json() == {
"object": "list",
"data": [
{
"id": MODEL,
"object": "model",
"owned_by": "me",
"permissions": [],
}
],
}