const { getChatCompletion } = require('./utils'); const retriever = require('./retriever'); async function ask(question) { const passages = await retriever.getRelevantPassages(question, 3); const context = passages.join('\n---\n'); const prompt = `You are an assistant. Use the following context to answer the question.\n\nContext:\n${context}\n\nQuestion: ${question}\nAnswer:`; const answer = await getChatCompletion(prompt); return answer; } module.exports = { ask, };