first commit

This commit is contained in:
Luca Sacchi Ricciardi
2026-03-27 13:05:47 +00:00
commit 549f70b97a
4 changed files with 82 additions and 0 deletions

25
test_api.py Normal file
View File

@@ -0,0 +1,25 @@
import urllib.request
import json
url = "http://localhost:8000/v1/chat/completions"
headers = {"Content-Type": "application/json"}
data = {
"model": "/app/models/Qwen3.5-0.8B-UD-Q8_K_XL.gguf",
"messages": [
{"role": "system", "content": "Sei un assistente utile e conciso."},
{"role": "user", "content": "Quali sono i vantaggi principali del sistema operativo Linux?"}
],
"max_tokens": 100,
"temperature": 0.2
}
req = urllib.request.Request(url, data=json.dumps(data).encode('utf-8'), headers=headers)
print("Inviando richiesta a vLLM...")
try:
with urllib.request.urlopen(req) as response:
result = json.loads(response.read().decode('utf-8'))
print("\n✅ TEST SUPERATO. Risposta dal modello:\n")
print(result['choices'][0]['message']['content'])
except Exception as e:
print(f"\n❌ ERRORE DURANTE IL TEST: {e}")