20
Views
1
Comments
[OpenAIAPI] Are there any examples?
openaiapi
Service icon
Forge asset by João Pais
Application Type
Mobile
Service Studio Version
11.54.7 (Build 62326)

I have added the library, but I cannot find how get any result. I'm trying to get the answer after I did click on a button. I will pass some text as a variable. However, I cannot see any event that gives me some light in the Run Server Actions. The PostCompletions expects a Request expression, but I'm not sure what it's. Previously, I created an app using a similar code to this one with JS:

let configuration = new Configuration({    apiKey: 'MY_KEY'  });

let openai = new OpenAIApi(configuration);

const response = await openai.createChatCompletion({

        model: 'gpt-3.5-turbo-0301',

        messages: 'MY_REQUEST', 

       max_tokens: 256     

}); 

let response  = response.data.choices[0].message?.content;

Also, is it only for the model 'text-davinci-003'. This one is a little bit easier:

const response = await openai.createCompletion({ 

        model: 'text-davinci-003' ,

         prompt: 'MY_REQUEST',

         max_tokens: 256 

 });

let response = response.data.choices[0].text;

Thanks for any support.

2019-02-27 17-48-20
Caldeira81

hi,  did you play the demo? check the documentation.

@Joao Pais can also add a "try" to the forge asset?

regards,

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.