import requests

def tester_gemma():
    url = "http://localhost:8003/v1/chat/completions"
    
    payload = {
        "messages": [
            {"role": "user", "content": "Donne-moi une astuce de code Python originale."}
        ],
        "temperature": 0.7
    }
    
    print("🧠 Envoi de la requête à Gemma 4...")
    try:
        response = requests.post(url, json=payload)
        response.raise_for_status()
        answer = response.json()["choices"][0]["message"]["content"]
        
        print("\n🤖 Réponse de Gemma 4 :")
        print("-" * 40)
        print(answer)
        print("-" * 40)
        
    except Exception as e:
        print(f"❌ Erreur : {e}")

if __name__ == "__main__":
    tester_gemma()