Allowing users to select what model they are running
This commit is contained in:
parent
5bbbcb7c08
commit
1f948cd001
@ -14,12 +14,19 @@ var repeatPenalty = 1.3;
|
|||||||
var initPrompt = 'Below is an instruction that describes a task. Write a response that appropriately completes the request. The response must be accurate, concise and evidence-based whenever possible. A complete answer is always ended by [end of text].';
|
var initPrompt = 'Below is an instruction that describes a task. Write a response that appropriately completes the request. The response must be accurate, concise and evidence-based whenever possible. A complete answer is always ended by [end of text].';
|
||||||
var nThreads = 7;
|
var nThreads = 7;
|
||||||
|
|
||||||
|
let modelList = ["7B", "7B-native", "gpt4all"]
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "create-session",
|
name: "create-session",
|
||||||
description: "create a new session chat",
|
description: "create a new session chat",
|
||||||
private: true,
|
private: true,
|
||||||
options: [{
|
options: [{
|
||||||
|
"name": "model",
|
||||||
|
"description": "The model you want to run, choose either: gpt4all, 7B, 7B-Native - Char case matters",
|
||||||
|
"required": false,
|
||||||
|
"type": 3 // 6 is type USER
|
||||||
|
},
|
||||||
|
{
|
||||||
"name": "init-prompt",
|
"name": "init-prompt",
|
||||||
"description": "A prompt you want to init the chat with, a default is used if not provided.",
|
"description": "A prompt you want to init the chat with, a default is used if not provided.",
|
||||||
"required": false,
|
"required": false,
|
||||||
@ -28,11 +35,21 @@ module.exports = {
|
|||||||
run: async (client, interaction) => {
|
run: async (client, interaction) => {
|
||||||
const file = './cache/' + interaction.user.id
|
const file = './cache/' + interaction.user.id
|
||||||
|
|
||||||
if (!interaction.options._hoistedOptions[0]){
|
if (!interaction.options._hoistedOptions[1]) {
|
||||||
console.log("-- No init-prompt provided, using default --")
|
console.log("-- No init-prompt provided, using default --")
|
||||||
} else [
|
} else {
|
||||||
initPrompt = interaction.options._hoistedOptions[0].value
|
initPrompt = interaction.options._hoistedOptions[1].value
|
||||||
]
|
}
|
||||||
|
if (!interaction.options._hoistedOptions[0]) {
|
||||||
|
console.log("-- No model provided, using default --")
|
||||||
|
} else {
|
||||||
|
if (modelList.includes(interaction.options._hoistedOptions[0].value)) {
|
||||||
|
model = interaction.options._hoistedOptions[0].value
|
||||||
|
} else {
|
||||||
|
let modelListStr = modelList.join(", ");
|
||||||
|
return interaction.followUp(`You may only use one of the following: ${modelListStr}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var req = unirest('POST', apiUrl + '?model=' + model + '&temperature=' + temperature + '&top_k=' + topK + '&top_p=' + topP + '&max_length=' + maxLength + '&context_window=' + contextWindow + '&repeat_last_n=' + repeatLastN + '&repeat_penalty=' + repeatPenalty + '&init_prompt=' + initPrompt + '&n_threads=' + nThreads)
|
var req = unirest('POST', apiUrl + '?model=' + model + '&temperature=' + temperature + '&top_k=' + topK + '&top_p=' + topP + '&max_length=' + maxLength + '&context_window=' + contextWindow + '&repeat_last_n=' + repeatLastN + '&repeat_penalty=' + repeatPenalty + '&init_prompt=' + initPrompt + '&n_threads=' + nThreads)
|
||||||
.headers({
|
.headers({
|
||||||
|
Loading…
Reference in New Issue
Block a user