Zack Saadioui
8/27/2024
1 2
# For Linux users, you can run this command: curl -fsSL https://ollama.com/install.sh | sh
1 2
ollama pull llama3.1 ollama run llama3.1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
const { Ollama } = require('ollama-node'); const { Client } = require('@notionhq/client'); const notion = new Client({ auth: process.env.NOTION_KEY }); const ollama = new Ollama(); async function chatWithNotion(notes){ const response = await ollama.generate(notes); return response; } // Example of retrieving a note async function retrieveNote(databaseId) { const response = await notion.databases.query({ database_id: databaseId }); const noteContent = response.results[0].properties.Name.title[0].text.content; const ollamaResponse = await chatWithNotion(noteContent); console.log(ollamaResponse); } retrieveNote('<your_database_id>');
1 2 3 4
const systemPrompt = `Use the following note to answer the prompt: ${noteContent}`; ollama.setSystemPrompt(systemPrompt); const answer = await ollama.generate(userQuestion); console.log(answer);
Copyright © Arsturn 2024