diff --git a/settings.js b/settings.js index add5297..a4681fa 100644 --- a/settings.js +++ b/settings.js @@ -35,7 +35,8 @@ export default "code_timeout_mins": 10, // minutes code is allowed to run. -1 for no timeout "max_messages": 15, // max number of messages to keep in context - "max_commands": -1, // max number of commands to use in a response. -1 for no limit + "num_examples": 2, // number of examples to give to the model + "max_commands": -1, // max number of commands that can be used in consecutive responses. -1 for no limit "verbose_commands": true, // show full command syntax "narrate_behavior": true, // chat simple automatic actions ('Picking up item!') "chat_bot_messages": true, // publicly chat messages to other bots diff --git a/src/agent/prompter.js b/src/agent/prompter.js index bc05860..310ca3e 100644 --- a/src/agent/prompter.js +++ b/src/agent/prompter.js @@ -4,6 +4,7 @@ import { getCommandDocs } from './commands/index.js'; import { getSkillDocs } from './library/index.js'; import { stringifyTurns } from '../utils/text.js'; import { getCommand } from './commands/index.js'; +import settings from '../../settings.js'; import { Gemini } from '../models/gemini.js'; import { GPT } from '../models/gpt.js'; @@ -155,8 +156,8 @@ export class Prompter { async initExamples() { try { - this.convo_examples = new Examples(this.embedding_model); - this.coding_examples = new Examples(this.embedding_model); + this.convo_examples = new Examples(this.embedding_model, settings.num_examples); + this.coding_examples = new Examples(this.embedding_model, settings.num_examples); // Wait for both examples to load before proceeding await Promise.all([ diff --git a/src/utils/examples.js b/src/utils/examples.js index 31ef3ab..ca6de79 100644 --- a/src/utils/examples.js +++ b/src/utils/examples.js @@ -33,6 +33,9 @@ export class Examples { this.examples = examples; if (!this.model) return; // Early return if no embedding model + if (this.select_num === 0) + return; + try { // Create array of promises first const embeddingPromises = examples.map(example => { @@ -52,6 +55,9 @@ export class Examples { } async getRelevant(turns) { + if (this.select_num === 0) + return []; + let turn_text = this.turnsToText(turns); if (this.model !== null) { let embedding = await this.model.embed(turn_text);