ollama

05/12/2023

En direct sur le serveur

curl -fsSL https://ollama.com/install.sh | sh

systemctl enable ollama
systemctl start ollama
systemctl edit ollama.service
  [Service]
  Environment="OLLAMA_HOST=0.0.0.0"

systemctl daemon-reexec
systemctl restart ollama.service

ollama pull gpt-oss:20b    # Télécharge le modèle 20B (~13–14 Go)
ollama pull gpt-oss:120b   # Télécharge le modèle 120B (~65 Go)
ollama list

ollama run gpt-oss:20b

Via docker

docker run -d -v /root/ollama:/root/.ollama --name ollama ollama/ollama

curl http://localhost:11434/api/pull -d '{ "model": "gpt-oss:20b" }'

curl http://localhost:11435/api/generate -d '{
  "model": "gpt-oss:20b",
  "prompt": "compte de 1 à 10",
  "stream": false
}'

curl http://localhost:11434/api/chat -d '{
  "model": "gpt-oss:20b",
  "messages": [
    { "role": "system", "content": "Tu es un assistant utile." },
    { "role": "user", "content": "Peux-tu me donner l heure ?" },
    { "role": "assistant", "content": "{tool: internet, question: quelle heure ?}" },
    { "role": "tool", "content": "il est 09:54" }
  ],
  "stream": false
}'

tester

curl http://localhost:11434/api/generate -d '{
  "model": "gpt-oss:20b",
  "prompt": "Why is the sky blue?", "stream": false
}'

curl http://127.0.0.1:11434/api/tags

# vérifier si le port est ouvert
ss -tulpn | grep 11434