Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Add autoSystemMessage option to OpenChat model
Browse files Browse the repository at this point in the history
  • Loading branch information
MrlolDev committed Nov 4, 2023
1 parent bddf64d commit 257f51b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/models/text/openchat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,12 @@ export default {
default: randomUUID(),
description: "ID of the conversation (used for data saving)",
},
autoSystemMessage: {
type: "boolean",
required: false,
default: true,
description: "Send system messages automatically",
}
},
response: {
result: {
Expand Down Expand Up @@ -80,6 +86,24 @@ export default {
if (!max_tokens) max_tokens = 512;
if (!temperature) temperature = 0.9;
result.cost += (getChatMessageLength(messages) / 1000) * 0.0001;
let newMessages = [];
let autoSystemMessage = data.autoSystemMessage;
if (autoSystemMessage == null) autoSystemMessage = true;
if (autoSystemMessage) {
newMessages = [
{
role: "user",
content: "Hello, I want you to explain to me who are you",
},
{
role: "assistant",
content: "I am OpenChat 3.5, a large AI language model developed by OpenChat. I am designed to answer questions, provide information, and engage in conversation with users. I am based on Llama 2 model, you can find more information about it here: https://huggingface.co/openchat/openchat_3.5 ",
},
...messages
]
} else {

}
openchat(messages, max_tokens, model, result, event, temperature)
.then(async (x) => {
result = x;
Expand Down

0 comments on commit 257f51b

Please sign in to comment.