Add kernel.js
This commit is contained in:
30
kernel.js
Normal file
30
kernel.js
Normal file
@@ -0,0 +1,30 @@
|
||||
console.log(Package.search);
|
||||
|
||||
module.exports = {
|
||||
on_prompt: function (prompt) {
|
||||
try {
|
||||
let results = Package.get_systems();
|
||||
console.log(JSON.stringify({ ...results }));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
return "Hi! " + prompt;
|
||||
},
|
||||
generate_thought_prompt: function (prompt) {
|
||||
let data = [];
|
||||
console.log("Generating thought prompt...", prompt);
|
||||
try {
|
||||
let results = Package.search(prompt, 3, 0.4);
|
||||
data.push(...results.map((i) => ({ ...i })));
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
console.log(JSON.stringify(data));
|
||||
// return "";
|
||||
return data.length > 0
|
||||
? "<think> Here's what I know about the user's query\n" +
|
||||
data.map((e) => `${e.entry.type}: ${e.entry.content}`).join("\n") +
|
||||
"\nNow that I have this information, I can use it to generate a response. "
|
||||
: "<think> I don't know anything about that. If there's relevant information in the system prompt, I'll try to use that. If there isn't, I'll just tell the user I don't know, let me check for a system prompt.";
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user