#Swapping from text-davinci-003 to new turbo model. JS issues

2 messages · Page 1 of 1 (latest)

plucky crypt
#
        const prompt = document.getElementById('prompt').value;
        const data = {
          model: 'text-davinci-003',
          prompt: prompt,
          max_tokens: 2096,
          temperature: 0.5,
          n: 1,
          stop: null,
        };
        
  
        fetch(API_ENDPOINT, {
          method: 'POST',
          headers: {
            'Content-Type': 'application/json',
            'Authorization': `Bearer ${API_KEY}`,
          },
          body: JSON.stringify(data),
        }).then(response => response.json()).then(response => {
          const text = response.choices[0].text;
          document.getElementById('response').value = text;```
          


So to switch over to the new model, do I basically just need to update the "model" parameter to the new one, and add a "message" property? (Aside from changing the endpoint). I can't seem to crack it although I know it should be easy.
wraith phoenix