mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 21:53:07 -04:00
privileged model override feature for gpt
This commit is contained in:
parent
9b1e76ebc3
commit
60a8158bff
2 changed files with 17 additions and 12 deletions
|
@ -18,10 +18,11 @@ module.exports = {
|
|||
description_short: 'Chat with GPT-4o.',
|
||||
examples: ['gpt How many otter species are there?'],
|
||||
category: 'limited',
|
||||
usage: 'gpt <input> [-prompt <prompt override>]'
|
||||
usage: 'gpt <input> [-prompt <prompt override>] [-model <model identifier>]'
|
||||
},
|
||||
args: [
|
||||
{ name: 'prompt', default: '', required: false, help: "The starting system prompt." },
|
||||
{ name: 'model', default: 'gpt-4o', required: false, help: "The model." },
|
||||
// { name: 'temperature', default: 0.25, required: false, help: "Model temperature." },
|
||||
],
|
||||
permissionsClient: [...PERMISSION_GROUPS.baseline, ...PERMISSION_GROUPS.attachments],
|
||||
|
@ -29,6 +30,9 @@ module.exports = {
|
|||
if(!await hasFeature(context, "ai/gpt")) return;
|
||||
await acknowledge(context);
|
||||
|
||||
let model = "gpt-4o"
|
||||
if(args.model && await hasFeature(context, "ai/gpt/prompt")) model = args.model;
|
||||
|
||||
if(!args.text) return editOrReply(context, createEmbed("warning", context, `Missing Parameter (text).`))
|
||||
|
||||
let input = args.text;
|
||||
|
@ -58,13 +62,13 @@ module.exports = {
|
|||
}
|
||||
}))
|
||||
|
||||
let res = await gpt(context, prompt, input)
|
||||
let res = await gpt(context, prompt, input, model)
|
||||
res = res.response;
|
||||
|
||||
let description = []
|
||||
let files = [];
|
||||
|
||||
if(!res.body.response) return editOrReply(context, createEmbed("error", context, `GPT-4o returned an error. Try again later.`))
|
||||
if(!res.body.response) return editOrReply(context, createEmbed("error", context, `OpenAI returned an error. Try again later.`))
|
||||
|
||||
if(res.body.response.length <= 4000) description.push(res.body.response)
|
||||
else {
|
||||
|
@ -82,7 +86,7 @@ module.exports = {
|
|||
},
|
||||
description: description.join('\n'),
|
||||
footer: {
|
||||
text: `GPT-4o • Response may be factually wrong or completely made up.`
|
||||
text: `OpenAI${res.body.model.startsWith("gpt-4o") ? "" : ` (${res.body.model})`} • Response may be factually wrong or completely made up.`
|
||||
}
|
||||
})],
|
||||
files
|
||||
|
|
|
@ -381,10 +381,11 @@ module.exports.garfield = async function(context,){
|
|||
return await request(Api.UTILS_GARFIELD, "GET", {}, {})
|
||||
}
|
||||
|
||||
module.exports.gpt = async function(context, prompt, input){
|
||||
module.exports.gpt = async function(context, prompt, input, model = "gpt-4o"){
|
||||
return await request(Api.UTILS_GPT, "GET", {}, {
|
||||
prompt,
|
||||
input
|
||||
input,
|
||||
model
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue