Show HN: How to use ChatGPT+ARKit to script experiences with natural language (github.com)
I created a demo involving ChatGPT, OpenAI's Whisper running on-device for speech-to-text (because why not?), and ARKit. By defining a custom JavaScript environment with JavaScriptCore and describing it to ChatGPT, I was able to get it to produce functioning scripts that instantiate and manipulate 3D objects.
Sketchfab is used to import 3D assets on the fly. Google Poly had a much better catalog of assets for this sort of thing but sadly, it's no longer available.
The README.md describes how it all works but the gist of it is that user prompts are wrapped in a larger prompt that describes the environment (i.e., which functions are available to use and how they work) and constraints. The code is then executed directly. Assets for objects are fetched as needed by searching Sketchfab.
18 comments
[ 3.2 ms ] story [ 58.0 ms ] threadHave you seen LangChain? It has a similar idea of getting GPT to output runnable code, and then using that to search the web or run Python, and giving the results back to GPT.
The autogenerated bindings from JS <-> ObjC/Swift are pretty opaque and if it doesn't handle your use case then there isn't much you can do without manually binding everything you need.
I might recommend using a custom class with getters/setters that don't use the subscript operator. I think on the JS side you can run some code to override [] and point it to the correct functions but I've never tried it out so ymmv.
entity.position = [0,0,0];
Is ok but:
entity.position[0] = 1; entity.position[1] = 1; entity.position[3] = 1;
Fails (and ChatGPT occasionally tries to do the latter).
We got pretty far with this a few years ago using more basic ML/NLP. The app was called Moatboat: https://twitter.com/moatboat/status/1082425681210859520
The area I think is most exciting (and in need of more innovation) is using natural language to create (and modify!) the actual simulation / rules / behaviors. Our approach was to map language outputs to actions that could be chained together using Goal Oriented Action Planning plus an Entity Component System. The user's verbs / prepositions / etc. would add layers of goals, each of which would enable or disable certain behavior components when triggered.
More details here for anyone interested: https://medium.com/@mikejohnstn/whatever-you-say-happens-2fa...
Directly generating source code from natural language would be a fun alternative approach to try today.
The code approach is intriguing and I'd like to explore further but controllability is a real problem and bullet-proofing it would require a lot of effort, if it's even possible at all. I do think that a hybrid environment where one speaks what they want and then sees the code and can interact with it in a friendly way would be very intriguing for a sandbox experience.
Anyone know if there's an iPhone developer boot camp with a focus on ARKit around anywhere?
To me it's like the start of the iPhone ..a land grab of innovation to be created.
Unfortunately one big problem is the quality of Apple’s documentation. It’s nowhere near as good as e.g., the Unity engine documentation or Microsoft’s API docs. At best, it’s useful for discovering what exists and then you either figure it out or look for specific examples online.
I do have ten years of Front End Design/Development experience. So, am skilled in HTML/CSS/JS, thus not a complete noob.
I think the window size of ChatGPT is quite limited so I can’t use prompts that are arbitrarily long but it’s not hard to see how increasing this window size and fine tuning on custom APIs could produce a model that would work more often than not.