diff --git a/src/agent/prompter.js b/src/agent/prompter.js index 2bbf20b..12a139b 100644 --- a/src/agent/prompter.js +++ b/src/agent/prompter.js @@ -35,8 +35,6 @@ export class Prompter { chat.api = 'anthropic'; else if (chat.model.includes('meta/') || chat.model.includes('mistralai/') || chat.model.includes('replicate/')) chat.api = 'replicate'; - // OH GOD GROQ HAS A LOT MORE MODELS NOW WHERE DID THEY ALL COME FROM - // i literally need to use a "groq/" thing because theres so many else if (chat.model.includes("groq/") || chat.model.includes("groqcloud/")) chat.api = 'groq'; else diff --git a/src/models/gpt.js b/src/models/gpt.js index 979601a..67511d2 100644 --- a/src/models/gpt.js +++ b/src/models/gpt.js @@ -1,5 +1,6 @@ import OpenAIApi from 'openai'; import { getKey, hasKey } from '../utils/keys.js'; +import { strictFormat } from '../utils/text.js'; export class GPT { constructor(model_name, url) { @@ -18,26 +19,17 @@ export class GPT { } async sendRequest(turns, systemMessage, stop_seq='***') { - let messages = [{'role': 'system', 'content': systemMessage}].concat(turns); - const pack = { model: this.model_name || "gpt-3.5-turbo", + messages, stop: stop_seq, }; if (this.model_name.includes('o1')) { - // system role and stop_seq not supported by o1 models - messages = messages.map((msg) => { - if (msg.role == 'system') { - msg.role = 'user'; - msg.content = 'SYSTEM: ' + msg.content; - } - return msg; - }); + pack.messages = strictFormat(messages); delete pack.stop; } - pack.messages = messages; let res = null; try {