feat: solution for 'Агент с RAG-памятью'
CI / build (push) Has been cancelled

This commit is contained in:
2026-06-24 14:28:11 +03:00
parent 589a621340
commit 14ab96d098
22 changed files with 644 additions and 20 deletions
+14
View File
@@ -0,0 +1,14 @@
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,
};