mirror of
https://github.com/kolbytn/mindcraft.git
synced 2025-07-05 08:05:18 +02:00
added strict format to o1
This commit is contained in:
parent
f3961c6086
commit
2e84595772
2 changed files with 3 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue