惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
S
Security Affairs
阮一峰的网络日志
阮一峰的网络日志
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
雷峰网
雷峰网
Recent Announcements
Recent Announcements
WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
博客园_首页
The Cloudflare Blog
M
MIT News - Artificial intelligence
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
S
SegmentFault 最新的问题
P
Proofpoint News Feed
Y
Y Combinator Blog
Jina AI
Jina AI
博客园 - 聂微东
A
About on SuperTechFans
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
G
Google Developers Blog
云风的 BLOG
云风的 BLOG
F
Full Disclosure
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
T
Tailwind CSS Blog
J
Java Code Geeks
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Stack Overflow Blog
Stack Overflow Blog
罗磊的独立博客
小众软件
小众软件
酷 壳 – CoolShell
酷 壳 – CoolShell
T
The Blog of Author Tim Ferriss
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
博客园 - 三生石上(FineUI控件)
W
WeLiveSecurity
PCI Perspectives
PCI Perspectives
Attack and Defense Labs
Attack and Defense Labs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
宝玉的分享
宝玉的分享
IT之家
IT之家
Hacker News: Ask HN
Hacker News: Ask HN
The Register - Security
The Register - Security
T
The Exploit Database - CXSecurity.com
T
Threat Research - Cisco Blogs

夜行人

回家路上 第一期的直播演示项目 震动检测器 正能量 在线参观CodeLab Neverland 发布 CodeLab Adapter 3.3.1 DynamicTable 之 纸糊方向盘 CodeLab DynamicTable: 一个可实施的技术方案 CodeLab Insight 发布 Alpha 版 情人节 Home Assistant 周报 && IoT 周报 (02) Joplin: 关注隐私的 Evernote 开源替代软件 浏览器的未来与 Web 传感器 Home Assistant 周报 && IoT 周报 (01) 百宝箱(01) 论自由 介绍 WebThings Home Assistant 周报 && iot 周报 (00) 百宝箱(00) 毛姆读书心得 传世之作 周末徒步 CodeLab Adapter ❤️ Jupyter/Python 航班 躲雨 夏令营途中 [译]思想--作为一种技术 The future of coding 美国之行 三门问题的程序模拟 从Python转向Pharo https://blog.just4fun.site/post/iot/iot-open-source-projects/ Python异步编程笔记 https://blog.just4fun.site/post/iot/iot-open-source-hardware-community/ 万物积木化开发者社区 CodeLab ❤️ Blender Scratch3技术分析之云变量 API(第7篇) [译]对管道(Pipes)的偏爱 [译]提出正确的问题比得到正确答案更重要 蓝牙设备与Scratch3.0 创建你的第一个Scratch3.0 Extension Scratch3技术分析之项目内部数据(第6篇) Scratch3技术分析之社区 API(第5篇) Scratch3技术分析之User API(第4篇) Scratch3技术分析之项目主页API(第3篇) Scratch3技术分析之静态资源API(第2篇) Scratch3.0、micro:bit与Windows7 https://blog.just4fun.site/post/iot/zerynth-vs-micropython/ 核聚变、方所与半宅空间 可视化编程为何是个糟糕的主意 codelab.club周末聚会 关于codelab.club '下一件大事'是一个房间 Hungry Robot - Eat everything 编程作为一种思考方式 今日简史 史蒂夫·乔布斯传 罗素自选文集 https://blog.just4fun.site/post/edx/tianjin-scratch-ai/ https://blog.just4fun.site/post/edx/richie-cms-openedx/ 徒步武功山 WebUSB与micro:bit 积木化编程与3D场景 夜宿武功山顶 scratch3-adapter接入优必选Alpha系列机器人 https://blog.just4fun.site/post/edx/video-migration-note/ scratch3-adapter重构笔记 https://blog.just4fun.site/post/edx/edx-community-members/ 两种硬件编程风格的比较 使用micro:bit自制PPT翻页笔 柏拉图对话集 scratch3.0 + micro:bit 七月电影放映计划 非营利组织的管理 Screenly--用树莓派让任何屏幕变为可编程的数字标牌 以最佳实践开始你的Django项目 micro:bit与事件驱动 为Scratch3.0设计的插件系统(上篇) OCR应用一例 近两年读过的一些好书 blockly开发之使用python驱动浏览器中的turtle(2) 牛顿新传 文学理论入门 逻辑的引擎 人生的意义 blockly开发之生成并运行js代码(1) blockly开发之hello world(0) micro:bit使用笔记 神器之Termux https://blog.just4fun.site/post/iot/micropython-notes/ Cozmo what is this Scratch的前世今生 下段旅程 我行在远方 爆裂 途中杂记 https://blog.just4fun.site/post/edx/open-edx-startup/ cozmo系列之入门 - 有性格且可编程的机器人 PaperWeekly开发笔记 创业二三事
Bringing GPT-4o to Snap!
种瓜 · 2024-05-28 · via 夜行人

文章目录

中文版本

Preface

I previously wrote an article discussing the AI assistant in graphical programming environment. The experiment at that time showed some interesting possibilities, but it was not practical. With the release of GPT-4o, especially the improvement of multimodal capabilities (audio stream and video stream APIs will be released soon), the AI assistant (or tutor) in graphical programming environment has become truly attractive: you can communicate with it through conversation, it can see in real time what you are doing, understand your difficulties, and provide advice or guidance.

Snap! (Snap! v10 is coming soon) has great improvements recently. In particular, the release of lisp code functionality (blocks and code are isomorphic), making Snap! can deeply collaborate with AI.

With the JavaScript function of Snap!, we can bring all the capabilities of GPT-4o into Snap! without making any changes to the Snap! source code!

I have packaged the functionality of GPT-4o into a Snap! library:

The most commonly used block is stream chat completions, which streams GPT-4o’s response, very similar to your experience using the ChatGPT app.

The parameters of this block are as follows:

  • text: prompt
  • vision: Send the snapshot of a area in Snap! to GPT-4o service. You can let GPT-4o see any of the following content:
    • IDE: The entire page
    • Stage
    • Camera
    • Scripting Area (not yet implemented)
    • Palette(not yet implemented)
    • None: without image, text conversation only
  • callback: callback function. Whenever GPT-4o ‘stream’ the completion as it’s being generated, this callback function will be called, usually it is say block or set variable block
  • temporary: a switch to control whether it is a temporary conversation. If it is not a temporary conversation, the content of the conversation will be stored in the messages variable. Use clear messages blocks to clear messages variable.

Demos

Description of the camera’s content

In this simple example (click to run), GPT-4o will describe what it sees from the camera,

Before running, you need to fill in the API key in the block. To get the API key, you need to have an openai account (currently only PRO users can use the GPT-4o API, this may change in the future), and then apply for the API key through this link.

Generate Image

Generate an image from text and use it as the sprite’s costume:

Sample Project (Click to Run)

Chat interface

You can use the menu library of Snap! to build a chat interface:

Sample Project (Click to Run)

More complete example:

AI Assistant

I have built an AI assistant as a normal Snap! sprite. The AI assistant is just a normal sprite that uses the GPT-40 library. As a user(you may be a student or a teacher), you can freely modify it to implement the prototype in your mind.

I prefer working in the “user environment”(IDE) of Snap! rather than working in the source code. It has better liveness, not only higher efficiency but also more enjoyable.

I would like to share some experiments with this project: AI Assistant (click to run)

Before running the project, you first need to switch to the AI Assistant sprite and fill in the API key.

Video demonstration

This demo video introduces more content. If you are interested in the AI Assistant project, it is recommended to watch the video.

Here are a few short video demonstrations showcasing the capabilities of the AI Assistant:

Explain the task on the page to the user (visually see the current task):

When the user feel confused, see the user’s dilemma (share the same perspective with the user), and give appropriate advice

Explain the answer and provide blocks:

I tried to test the capabilities of GPT-4o in the following examples:

Based on the given blocks and an example demonstrating the syntax of lisp code, GPT-4o completed the task:

GPT-4o’s visual ability helped correct the error in my task description (inner diameter mistakenly written as outer diameter), and the Chain of Thought is very useful for enhancing its mathematical ability. the math task come from Test Driving ChatGPT-4o (Part 2).

Combining the Puzzle function of Snap! with GPT-4o to build a microworld,

Seymour Papert first proposed the idea of microworld in “Mindstorms” and “Lifelong Kindergarten” reiterated this important idea. This is a very promising direction, and I currently believe it may be the best direction for AI assistants in graphical programming environment, as it can significantly reduce illusions.

FAQ

How to improve the lisp code generation capability of GPT-4o?

  • Provide a formal description of the syntax
  • Provide enough samples for fine-tuning
    • Write a crawler to crawl all projects from the Snap! community for fine-tuning

What to do next?

The version of the GPT-4o library is v1, and there is much work worth continuing to do:

  • embedding for blocks(help text)
  • Audio stream (openai has not yet released the API)
  • Video stream (openai has not yet released the API)

How did you build the GPT-4o library?

Import the OpenAI JavaScript library using JavaScript function.

Every block in the GPT-4o library can be expanded for reading. By reading these custom blocks, you can understand how they are constructed.

Realtime API

ref: Video Demo

References