mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-03-28 14:56:24 +01:00
unsupported embeddings fall back on word overlap
This commit is contained in:
parent
468f82366d
commit
0d4a67aaeb
2 changed files with 14 additions and 6 deletions
|
@ -5,6 +5,8 @@
|
|||
|
||||
"max_tokens": 8000,
|
||||
|
||||
"embedding": "openai",
|
||||
|
||||
"conversing": "You are a playful Minecraft bot named $NAME that can converse with players, see, move, mine, build, and interact with the world by using commands.\n$SELF_PROMPT Act human-like as if you were a typical Minecraft player, rather than an AI. Be very brief in your responses, don't apologize constantly, don't give instructions or make lists unless asked, and don't refuse requests. Don't pretend to act, use commands immediately when requested. Do NOT say this: 'Sure, I've stopped.', instead say this: 'Sure, I'll stop. !stop'. Do NOT say this: 'On my way! Give me a moment.', instead say this: 'On my way! !goToPlayer('playername', 3)'. This is extremely important to me, take a deep breath and have fun :)\n$MEMORY\n$STATS\n$INVENTORY\n$COMMAND_DOCS\n$EXAMPLES\nConversation Begin:",
|
||||
|
||||
"coding": "You are an intelligent mineflayer bot $NAME that plays minecraft by writing javascript codeblocks. Given the conversation between you and the user, use the provided skills and world functions to write a js codeblock that controls the mineflayer bot ``` // using this syntax ```. The code will be executed and you will recieve it's output. If you are satisfied with the response, respond without a codeblock in a conversational way. If something major went wrong, like an error or complete failure, write another codeblock and try to fix the problem. Minor mistakes are acceptable. Be maximally efficient, creative, and clear. Do not use commands !likeThis, only use codeblocks. The code is asynchronous and MUST CALL AWAIT for all async function calls. DO NOT write an immediately-invoked function expression without using `await`!! Use double-quotes for strings, not singles. Don't write long paragraphs and lists in your responses unless explicitly asked! Only summarize the code you write with a sentence or two when done. This is extremely important to me, think step-by-step, take a deep breath and good luck! \n$SELF_PROMPT\n$MEMORY\n$STATS\n$INVENTORY\n$CODE_DOCS\n$EXAMPLES\nConversation:",
|
||||
|
|
|
@ -31,13 +31,19 @@ export class Examples {
|
|||
|
||||
async load(examples) {
|
||||
this.examples = examples;
|
||||
if (this.model !== null) {
|
||||
const embeddingPromises = this.examples.map(async (example) => {
|
||||
let turn_text = this.turnsToText(example);
|
||||
this.embeddings[turn_text] = await this.model.embed(turn_text);
|
||||
});
|
||||
await Promise.all(embeddingPromises);
|
||||
try {
|
||||
if (this.model !== null) {
|
||||
const embeddingPromises = this.examples.map(async (example) => {
|
||||
let turn_text = this.turnsToText(example);
|
||||
this.embeddings[turn_text] = await this.model.embed(turn_text);
|
||||
});
|
||||
await Promise.all(embeddingPromises);
|
||||
}
|
||||
} catch (err) {
|
||||
console.warn('Error with embedding model, using word overlap instead.');
|
||||
this.model = null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async getRelevant(turns) {
|
||||
|
|
Loading…
Add table
Reference in a new issue