scrimba
Mistral AI
Running Mistral locally
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

Running Mistral locally
AboutCommentsNotes
Running Mistral locally
Expand for more info
index.js
run
preview
console
import ollama from "ollama";
import express from "express";

const app = express();
const port = 3000;

app.get('/', async (req, res) => {
const question = req.query.question;
if (!question) {
res.status(200).send("Ask something via the `?question=` parameter");
} else {
const response = await ollama.chat({
model: 'mistral',
messages: [{ role: 'user', content: question }],
});
res.status(200).send(response.message.content);
}
});

app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});

Console
/index.html
-3:56