Skip to content

Commit

Permalink
gpt more special handling for o1-mini
Browse files Browse the repository at this point in the history
  • Loading branch information
Supinic committed Nov 8, 2024
1 parent e90c7ae commit 2bf29b7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions commands/gpt/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"default": false,
"subscriberOnly": true,
"noSystemRole": true,
"usesCompletionTokens": true,
"inputLimit": 1000,
"outputLimit": {
"default": 200,
Expand Down
28 changes: 18 additions & 10 deletions commands/gpt/gpt-openai.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,31 @@ module.exports = class GptOpenAI extends Template {
}
const { temperature } = temperatureCheck;

const json = {
model: modelData.url,
messages,
temperature,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
user: super.getUserHash(context)
};

if (modelData.usesCompletionTokens === true) {
json.max_completion_tokens = 10_000;
}
else {
json.max_tokens = outputLimit;
}

const response = await sb.Got.get("GenericAPI")({
method: "POST",
throwHttpErrors: false,
url: `https://api.openai.com/v1/chat/completions`,
headers: {
Authorization: `Bearer ${process.env.API_OPENAI_KEY}`
},
json: {
model: modelData.url,
messages,
max_tokens: outputLimit,
temperature,
top_p: 1,
frequency_penalty: 0,
presence_penalty: 0,
user: super.getUserHash(context)
}
json
});

return { response };
Expand Down

0 comments on commit 2bf29b7

Please sign in to comment.