_ask = async (model, prompt) => {
try {
const response = await fetch("http://localhost:11434/api/generate", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({ model, prompt, stream: false })
});
return await response.json();
} catch (err) {
console.error('error:', err);
}
};
No comments:
Post a Comment