I Coded Working AI in Scratch!

preview_player
Показать описание
Not just a bunch of ifs and say blocks - this is real AI.

----
----
I can't publish this extension because it requires an API key. Here are the resources you need to create it yourself. The OpenAI API, ironically, requires real money to use.
JavaScript Code (You need to provide an API key):
class AIBlock {
getInfo() {
//Metadata for block
return {
"id": "AI",
"name": "AI",
"blocks": [{
"opcode": "completePrompt",
"blockType": "reporter",
"text": "complete prompt [string]",
"arguments": {
"string": {
"type": "string",
"defaultValue": "Explain quantum computing in simple terms"
}
}
}],
//don't worry about it
"menus": {}
};
}

async completePrompt({ string }) {
//Remove trailing spaces, required for model to work properly
//Request text completion using Davinci3

const options = {
//Has to be post for some reason
method: "POST",
//Input prompt and a decent length
body: JSON.stringify({
prompt: text,
max_tokens: 300,
}),
//API key, and JSON content type
headers: {
Authorization: "Bearer " + API_KEY,
"Content-type": "application/json; charset=UTF-8"
},
};

//Fetch and await promise.
const response = await fetch(url, options);
//Get JSON data

//The ai response will be the first (and only) choices text
return output;
}

}

//Register block with Scratch
---
Some images generated by DALL-E
Licensed under Creative Commons: By Attribution 4.0 License

Subscribe!
Oh, and if you want to support me financially, consider becoming a member :)
Рекомендации по теме
Комментарии
Автор

I should've got AI to write the code!
Unfortunately, I can't publish the extension because it requires an API key that costs real money. If you have the money, the code (along with extra details) is in the description.
Anyways, thank you for watching :D

donut_ask
Автор

Donutask: "this is the super secret api key im not allowed to share with anyone"
Also Donutask: *casually shows the api key to thousands of viewers*

veniyar
Автор

“This is the super secret api key I’m not allowed to share with anyone” hmmm ok I’ll definitely keep that a secret

PossiblyAxolotl
Автор

I've actually made one in Snap! (A different programming language) it has a URL block inside and some libraries that can do posts and send headers to the internet. It's much easier than making an entire extension from blocks instead of Javascript!
Pretty impressive how you did it in Scratch though. That was awesome!

RealUnify
Автор

You actually didnt built any ai, you just made scratch talk with an api...

swiftprison
Автор

Yoo, this is the most underrated extension ever! (Btw i didnt payed for this donation but google technicaly did)

lejacobofficial
Автор

"This is the super secret api key that im not allowed to share with anyone" *proceeds to show it to 80k+ peaople*

tdgdit
Автор

As a JS programmer this was painful to watch

Jaob
Автор

The griffpatch we didn't know we needed

Speed-TV
Автор

Could you make a longer, more precise and step-by-step guide that explains every tiny thing. That would be awesome and absolutely deserve a sub.

bduwjww
Автор

1:42 no way you just did that. I was about to warn you about you not blurring it properly. 😂

Logboy
Автор

note: The AI used is not ChatGPT, it is text-davinci

draconicproductionsinactiv
Автор

1:43
It says "Never gonna give you up"
That is a creative way to deter some people looking for your personal info...

LambdaMapping
Автор

ive been watching you since 1K subs! Good to see you finally get the attention you deserve.

hazeandclash
Автор

6:08 “Good thing I have this time-altering thing!”
**pulls out ADHD toy**

ROCKERNAN
Автор

Bro worked hard on this, he deserves a like guys.

TworutoSoFlo
Автор

Scratch “programmer” trying javascript for the first time be like

sunnyMK
Автор

4:37 Ah yes, my favorite programming language: Srachahahaccci

LukeCompositor
Автор

This is just using an extension that goes into ChatGPT AI. That means this isn't working AI in Scratch, especially since you had to go to a totally different website to do so with an extension. I was expecting for a neural network to be coded literally with scratch blocks.

Prazimania
Автор

Yesterday I just got my AI to work in Scratch from scratch, it uses neural networks and you can talk to it.
So I guess I am quite talented. But nice video!

Tommy_said_hq_videos