#Open AI nodejs package spitting out random stuff

17 messages · Page 1 of 1 (latest)

nimble minnow
#

I'm using the OpenAI NPM package (https://npmjs.com/package/openai), with the configurations that I'll attach as images.
I'm currently having it connected to a discord bot, however, when I try to request any messages, its spitting out random text, and the text that it does spit out gets truncated.

#

(It's not the filter.clean method doing that, its the raw data)

dusky mauve
#

hello!

why don´t you complete the completion object?

maybe something as follows...

$curlbody = [
"prompt" => $this->sourceoftruth . $this->prompt . $history_string . $this->message . "\n" . $this->assistantname . ':',
"temperature" => (float) $temperature,
"max_tokens" => (int) $maxlength,
"top_p" => (float) $topp,
"frequency_penalty" => (float) $frequency,
"presence_penalty" => (float) $presence,
"stop" => $this->username . ":"
];

and I think it is better to use one of these engines:

'gpt-3.5-turbo-0301' => 'chat'
'gpt-3.5-turbo' => 'chat'

I hope it helps.

Regards!

nimble minnow
#

I tried selefting gpt-3.5-turbo but it said that “this is a chat completion”

dusky mauve
#

ok ok... try something like this:

const promptText = ${sourceOfTruth}${prompt}${historyString}${message}\n${assistantName}:;

const completion = await openai.createCompletion({
model: 'gpt-3.5-turbo',
prompt: promptText,
temperature: parseFloat(temperature),
max_tokens: parseInt(maxlength, 10),
top_p: parseFloat(topp),
frequency_penalty: parseFloat(frequency),
presence_penalty: parseFloat(presence),
stop: [${username}:]
});

#

sourceOfTruth is not really needed

#

but I think you should give more context creating $prompt and $historyString

nimble minnow
#

Hm

#

Okay, yeah the only parameters I provided are the prompt and the model

dusky mauve
#

and try:
temperature = 1;
max_tokens=500;
topp=1;
frequency: 1;
presence: 1;

#

you can adjust parameters later in order to get better answers

nimble minnow
#

Alright

#

Thanks