Zack Saadioui
8/27/2024
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
const axios = require('axios'); module.exports = async function (context, req) { const prompt = req.body.prompt; try { const response = await axios.post('http://localhost:11434/v1/chat/completions', { model: 'llama2', messages: [{ role: 'user', content: prompt }] }); context.res = { status: 200, body: response.data, }; } catch (error) { context.res = { status: 500, body: error.message, }; } };
1
ollama serve
1
curl -X POST -H "Content-Type: application/json" -d '{"prompt": "Why's the sky blue?"}' https://<your-function-app-name>.azurewebsites.net/api/<your-function-name>
Copyright © Arsturn 2025