Files
exercises/w14_olama/basics.js
Andrea Bianchi 5c6502d9c0 updated model
2026-05-26 08:45:36 +09:00

17 lines
419 B
JavaScript

import delay from 'delay';
fetch('http://localhost:11434/api/generate', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
model: 'deepseek-r1:latest', // replace with your model name
prompt: 'Tell me a joke!',
stream: false,
think: false,
}),
})
.then((res) => res.json())
.then((data) => data.response)
.then(console.log)
.catch(console.error);