Outputs from OpenAI Api is delayed and random

题意:“OpenAI API 的输出有延迟且随机”

问题背景:

When i type less than 3-5 characters, OpenAI API replies with random output and delayed for like 5 seconds (based on how long openai output is). Tried changing model and lowering max_tokens to 500.

#main.JS

const userInput = document.querySelector('.user-input');
const inputText = userInput.value;
      const data = {
        model: 'text-davinci-003',
        prompt: inputText,
        temperature: 0.7,
        max_tokens: 2048,
        top_p: 1,
        frequency_penalty: 0,
        presence_penalty: 0
      };
  
      const options = {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${openaiApiKey}`
        },
        body: JSON.stringify(data)
      };
  
      try {
        const response = await fetch('https://api.openai.com/v1/completions', options);
        const data = await response.json();
        const choices = data.choices;
        const text = choices[0].text.trim();
        addMessage(text, 'bot');
      } catch (error) {
        console.error(error);
      }

#index.html
<textarea class="user-input" id="user-input"></textarea>

What i expecting        我所期望的

问题解决:

Use "gpt-3.5-turbo" model        使用 gpt-3.5-turbo 模型

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

营赢盈英

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值