make sure the prompt property is substituted with the value of the variable prompt as shown above
Next we need to parse the response from above HTTP output
Now we need to provide a sample document to parse the JSON schema
{ "id": "cmpl-xxxxxxxxxxx", "object": "text_completion", "created": 1640707195, "model": "davinci:2020-05-03", "choices": [ { "text": " really bright. You can see it in the sky at night.\nJupiter is the third brightest thing in the sky, after the Moon and Venus.\n", "index": 0, "logprobs": null, "finish_reason": "stop" } ] }
Sent the outsummary as response back to Power Apps
Save the flow
Do a manual test run by passing sample text
If successful then you are set with flow
Power Apps
Now lets create a Power App
This is only a simple app
i am creating a canvas app
Name the app as: OpenAITest
Note: this process can be applied to any HTTP REST enabled actions needed to be invoked by Power Apps
Now we need to create a canvas
Bring Text Input Box
Add default text as prompt
Set the default to a variable called: openaitext
openaitext
Now we are going to Test
Summarize Text
Create SQL
Classify Text
Parse Unstructed data
Classify content
Now we add a button for Summarize Text
Call the flow and assign the return value to the variable
Here is the value to set
UpdateContext({openaitext: "A neutron star is the collapsed core of a massive supergiant star, which had a total mass of between 10 and 25 solar masses, possibly more if the star was especially metal-rich.[1] Neutron stars are the smallest and densest stellar objects, excluding black holes and hypothetical white holes, quark stars, and strange stars.[2] Neutron stars have a radius on the order of 10 kilometres (6.2 mi) and a mass of about 1.4 solar masses.[3] They result from the supernova explosion of a massive star, combined with gravitational collapse, that compresses the core past white dwarf star density to that of atomic nuclei. Tl;dr"})
Now add another button to create SQL from normal lanugage text
UpdateContext({openaitext: "### Postgres SQL tables, with their properties: # # Employee(id, name, department_id) # Department(id, name, address) # Salary_Payments(id, employee_id, amount, date) # ### A query to list the names of the departments which employed more than 10 employees in the last 3 months SELECT"})
Now add another button to Classify Text
UpdateContext({openaitext:"Classify the following news article into 1 of the following categories: categories: [Business, Tech, Politics, Sport, Entertainment]
news article: Donna Steffensen Is Cooking Up a New Kind of Perfection. The Internet’s most beloved cooking guru has a buzzy new book and a fresh new perspective:Classified category:"})
Now add another button to Parse Unstructed Data
UpdateContext({openaitext:"There are many fruits that were found on the recently discovered planet Goocrux. There are neoskizzles that grow there, which are purple and taste like candy. There are also loheckles, which are a grayish blue fruit and are very tart, a little bit like a lemon. Pounits are a bright green color and are more savory than sweet. There are also plenty of loopnovas which are a neon pink flavor and taste like cotton candy. Finally, there are fruits called glowls, which have a very sour and bitter taste which is acidic and caustic, and a pale orange tinge to them.
Please make a table summarizing the fruits from Goocrux | Fruit | Color | Flavor | | Neoskizzles | Purple | Sweet | | Loheckles | Grayish blue | Tart |"})
Now add another button to classify content
UpdateContext({openaitext: "The following is a list of companies and the categories they fall into
Facebook: Social media, Technology LinkedIn: Social media, Technology, Enterprise, Careers Uber: Transportation, Technology, Marketplace Unilever: Conglomerate, Consumer Goods Mcdonalds: Food, Fast Food, Logistics, Restaurants FedEx:"})
Data Scientists must think like an artist when finding a solution when creating a piece of code. ⚪️ Artists enjoy working on interesting problems, even if there is no obvious answer ⚪️ linktr.ee/mlearning 🔵 Follow to join our 28K+ Unique DAILY Readers 🟠