[F/OS] 🧠 Artificial Intelligence and OpenAI!

i tried the new program - here are my results:

let me start with image generation (from screen2 of demo):
my prompt was
robot wearing grass skirt, green hills in background, in style of stained glass

not bad! it may have missed the grass skirt but the rendition is close enough to the prompt!

now here's my test for text generation:
my prompt was
tell me, in a poem, why I should learn Python

as you can see, it CAN do poems! that's because i picked Davinci for language model - it is more capable of conversational style than the Ada model - plus i set Informative to false (meaning "be a little creattive in your response"). the only problem is it dropped all the newlines (\n)! so the response came back with all text strung together and no breaks. i had to cut n paste the contents and hand edited it to split the lines at the right places - here's the resulting poem:

You: tell me, in a poem, why I should learn Python

AI: *A powerful language, Python you should learn
To unlock a world of programming to yearn  
No need to worry, no need to stress
For Python is simple, easy, and best  
It is all around, coding jobs galore
From web to data, it can explore  
Whether starts fresh or already know
Python can take you far, for sure  
Be it beginners or advanced coders
Python is ideal for all to ponder  
The language of choice, to any age
A chance to code and will engage

also i had to change the design and replaced the original destination of the conversation from Label1 to TextBox2 because the label won't let me do cut-n-paste but textbox will.

overall, the demo reveals how easy it is to connect to OpenAI (GPT-3) but something needs to be done about those disappearing newlines!

get yourself an API key and start playing - in all the time i've been playing with demo here since it was released, i've only spent 10 cents!

thanks for the demo @Gordon_Lu !

here's my version (with output set to a textbox instead of label)
myOpenAI.aia (118.3 KB)


For some reason, sometimes OpenAI returns data with line-breakers placed in weird places, such as in the middle of a sentence. I'll try to figure out a way to make the line-breakers organized, as in the previous versions, I removed all line-breakers in the output.

1 Like

Thank you for this excellent update.


Thank you so much for your efforts :heart: I have detected a bug in the extension ...When network is not connected,and you try to Prompt. the app crushes with runtime error please fix it

1 Like

This of course does not work; OpenAI connects with the Internet...

1 Like

The app exit automatically with a crush Can you add a fix so as to show Error occurred instead of Exit the app suddenly

1 Like

@Abbas_Gasri Why not just check for an Internet connection prior to calling OpenAI? You might use Sajal's recommendation Check Internet Connection In App Inventor | Imagnity or use an extension to check for an Internet connection. :astonished:


Currently, AppInventor has removed the access network state permission from the Companion manifest. If you want such feature, the OpenAI extension has to include this permission, and as a result, you must compile your app. This negatively impacts users that do not need this, so it is best for you to check it yourself before you call this extension.


The Text Generation is not working for me...nothing is generated. My internet is turned on and I checked the API Key and everything is right but it generates nothing.
Can you pls tell me a solution ASAP as I am doing it as my final project.

Send your AIA in PM.

Yes. I sent it. Please check.
Thanks and Regards,

This issue is resolved in PM. The user tried to input instructions with line-breakers (\n), which is currently not supported. This may be fixed in the next release, but I have schoolwork and I'm working on a contact extension.

1 Like

@Gordon_Lu Thank you sooooooo much for this!! Is there any way to download the pictures generated?

Try this extension to download the image to the ASD after the URL is returned?

1 Like

I've seen videos on YT of ChatGPT programming an iOS app with Swift in 10 minutes - really mind-blowing. I will definitely give it a try...

However, you will need some basic knowledge (Xcode / Swift).


Can i use VPN and use this aia in Hong Kong? Thank you!


很抱歉,我自己也是香港人。我發現如果要用 OpenAI 的服務,就要用外國的電話號碼和VPN(OpenAI並沒有允許內地和香港用 OpenAI 的服務),是一位好心人讓我借用 API 密碼。 你可以找人幫你註冊,但我相信成功率不大。


Hi, Gordon, actually, I used VPN app and sms activiate to creat the account successfully, I have the API key, but when i insert this aia file into app inventor, it says" Error, the server had an error while processing your request. Sorry about that !." May i ask how to I solve this problem. (I have tried the web chatgpt via VPN in HK successfully)

You can try refreshing the website, particularly hard-reload it using Ctrl + Shift + R?