11 ms·
Build your front end in React, then let ChatGPT be your Redux reducer
- incrudible 4y agoI've always suspected Redux to be a pointless indirection, now I am all the more convinced.
- lelandfe 4y agoThis is hilarious. In my experience writing novels with ChatGPT, it starts to break down after a long running thread before eventually becoming almost useless. I wind up needing to remind it what it’s doing over and over. That is likely by virtue of its limit on tokens, but I think also because the weight each token has reduces as the conversation continues. I wonder if users would slowly watch the website go insane after using over X interactions.
- freeqaz 4y agoIf you look at dedicated writing AI tools like NovelAI, you can see that this is exactly how they work. They have a concept of a "lore book" with "keywords" that you can use to remind the AI about how to properly generate the content. For example, if I were writing a novel about a fantasy kingdom and there is an evil king, then I can write a description of the king ("The king is evil and wears a red crown") with the keyword to "include" it being "crown", "king", etc. As the number of tokens increases with these AIs I think this problem will decrease decrease (1k was NovelAI originally, and now GPT-3 Codex is 8k). I do wonder what the "ideal" solution is in the future though. Or do you have to create a "lore book" for ChatGPT too? (A thought I've had is that maybe we can automatically "create" the "lore book" and then re-inject that seamlessly? For example, in the fantasy kingdom example, maybe ChatGPT can generate a list of characters for each "chunk" of text and then automatically inject that into the "last" batch of text.)
- lelandfe 4y ago> maybe ChatGPT can generate a list of characters for each "chunk" of text and then automatically inject that into the "last" batch of text Funny enough, that’s the automated version of what I do! Every X prompts, I ask ChatGPT: List the cast of this story and their goals I’ve found this really helps extend the shelf life of our thread :)
- freeqaz 4y agoThat's amazing -- thank you for sharing! I'll try this out in the future :)
- dinkumthinkum 4y agoBut if we are looking at a thinking AGI that is “superior” to human abilities we should see Tolkien or Martin. If the argument is “just wait” then there needs to be sone explanation of why a Tolkien is really possible with this type of AI.
- jameshart 4y agoFunny you mention those two. They also suffer from the problem: “starts to break down after a long running thread before eventually becoming almost useless.” Tolkien kept changing his world as he went along, so the Lord of The Rings required him to make changes to the Hobbit, and his Silmarillion needed extensive edits to bring it back into synch with LoTR canon. As for Martin (assuming you mean G.R.R.)… well, he’s already mimicking that other failure mode of ChatGPT - that response times can get long when under load, and eventually the whole session might just time out.
- momojo 4y agoHumans do the same thing; which is to say we're also constrained by the amount of context we can hold in RAM. Those who write novels end up encoding and compressing that information into notes. I wonder if there's a similar way one could work with ChatGPT, instead of having to constantly remind it of the little details, like you did.
- dluan 4y agoI wonder if you could treat it as kind of stateless, or maybe a ChatGPT-RDT could work.
- freeqaz 4y agoWhat is that? "ChatGPT-RDT"? I searched it and I don't see anything online.
- polynomial 4y agoRight, though the difference (IMO) is between such long running threads, and 'X' interactions which are composed of many much shorter threads. ChatGPT is optimized for short attention spans, and those with the shortest attention spans are likely the most impressed, while those with much longer attention spans, which not coincidentally often correlate to more sophisticated -for lack of a better word- use of language in the form of much more complex (potentially prolix) linguistic constructions, to express a perspective that has more in common with Proust (both in terms of his prose style, and also his famous account of the madeleine, often understood to be about the lost time of memory, but inseparable from attention itself) than the fragmented discourses presented by modern social media, may find this robotic dog and pony show to be somewhat less interesting, albeit obviously useful as a tool in certain contexts.
- deleted 4y ago[deleted]
- mintplant 4y agoHi HN! I've been playing around with ChatGPT a bunch since it came out. This experiment has a little bit of a backstory. Some friends and I were out at a pho restaurant; one of us put the whole bill on his card, so the rest of us needed to figure out how much to Venmo him. We were talking about how many bill-splitting apps there are, and I made a joke about doing it with ChatGPT. Then I actually tried it out. I OCR'd the text with Google Lens, described who had what, and after a bit of prompt engineering (e.g., adding "Be sure to get your math correct" to make the AI's arithmetic check out, and convincing the AI to split shared items evenly), it totally worked: https://gist.github.com/spinda/967322dda1c04d9864f3efd45addca13 https://gist.github.com/spinda/967322dda1c04d9864f3efd45addc... Then I started experimenting with describing a hypothetical check-splitting app to the AI, and asking it to feed me JSON commands to update the UI in response to messages from me telling it what the user was doing. The results were promising! And then the similarity to the Redux data loop jumped out, and I built this generic plugin to wire ChatGPT up to apps for real.
- bogwog 4y agoThis is cool. I've been using it mostly to explain APIs to me when I'm too lazy to dig through docs. This works surprisingly well, even for some relatively obscure APIs like Libre/OpenOffice's "UNO" API. I think a really interesting use case for this would be to have it read through a long standards document and produce a compliant implementation, and maybe point out flaws/omissions. Maybe implement a full web browser from scratch? Or something less intense like a GLTF reader/writer? Or something ludicrous like a brainfuck implementation of Office Open XML, which has like ~7000 pages of specs.
- nonethewiser 4y agoWhat is it drawing from, so to speak? Isn't it the case that it's training included the actual API docs or else it is just guessing based off knowledge of other API's and inferring things from how things are named and whatnot? It just seems like there are bound to be lots of errors if it's the latter.
- throwayyy479087 4y agoIt’s the former - they feed these huge LLMs all the text on the internet
- marcosdumay 4y agoIt has the actual API docs and all the SO questions to draw from. The GP is only using it as a summarization engine. It's quite impressive how well it performs this task.
- vesinisa 4y agoYeah, I've been also asking it questions about API documentation (Android APIs specifically) and it is very good at it, often beating StackOverflow. Though I've noticed sometimes it gets fringier details incorrect but remains very self-assured nonetheless.
- layer8 4y agoIts memory is restricted to a couple pages of prompt, so I don’t think you’ll have any luck with the kinds of projects you’re mentioning. In addition, the way ChatGPT is generating output is linear, based on the sequence of preceding prompts and answers. It can’t really go back and forth (and sideways), navigating a graph of new things, as would be needed to develop a larger project. It’s like you’re trying working with someone who only has short-term memory, and also has a tendency to make up things and be scatterbrained.
- EMM_386 4y agoVery interesting. People keep saying ChatGPT isn't that impressive because it's just "regurgitating knowledge" and has no insight into it, or things along those lines. But I find it insanely impressive that you can specify something like: "Provide your answer in JSON form. Reply with only the answer in JSON form and include no other commentary." And it will do exactly that. Or tell it to explain you something "in the style of Shakespere". I just asked it about quantum physics as Shakespere and got this (plus a lot more): --- Oh sweet youth, listen closely as I impart The secrets of the quantum realm, a place of art Where particles and waves, both small and large Exist in states both definite and in charge --- That is really fascinating stuff.
- yashap 4y agoAgreed, both ChatGPT and DALL-E feel significantly different in their ability to at least simulate “understanding.” They aren’t perfect by any means, but they’re a big step up from anything I’ve seen before.
- spaceman_2020 4y agoTrue. ChatGPT feels human-like to the point that I feel the urge to thank it after an answer
- survirtual 4y agoThere will always be naysayers stuck in the old way of doing things. Don’t let em get in your head and keep your eyes full of wonder. Incredible things are still ahead.
- Waterluvian 4y agoI keep describing it as the Enterprise Ship’s Computer. It won’t answer “how do I solve this problem?” But it’ll help you workshop a solution if you do the “thinking.” …But I’ve also had it clearly tell me in an answer that 2 is an odd number.
- raydiatian 4y ago
- maxkrieger 4y ago> There’s no official API for ChatGPT yet, so I’m using the unofficial chatgpt NPM package to wire up the app in the demo video. OpenAI has their Cloudflare protection cranked up high; to get around that, it runs a full Chrome instance (!) in the background to shuttle messages back and forth between the little REST API server I wrote and ChatGPT’s internal API. This is quite a workaround, have you tried the official Davinci003 api? It's rather capable now and probably faster response times. Very cool experiment regardless!
- Waterluvian 4y agoTangent: (too off topic and kind of misses the point of the article, so deleted)
- mark_mart 4y agoThe blog post isn't about redux is needed or not.
- deleted 4y ago[deleted]
- jhgg 4y agoThis is by no means a practical exercise... and is to demonstrate the capabilities of a large language model, not to reduce boilerplate.
- Waterluvian 4y agoFair enough!
- barbariangrunge 4y agoI pitched a similar technique to my company a few weeks ago but didn’t get any enthusiasm back. I think these sorts of apps will be commonplace in a few years, for better or worse
- personjerry 4y agoIsn't this just programming with more steps? For example you had ChatGPT try different ways to implement the data model, as you might assign a junior code monkey, until you guided it with your experience on how it should be implemented
- throwaway2016a 4y agoWhile I hate to think how inefficient this is, it gave me a really good prompt idea I tried with GTP-3 and it works. > Here is it in Json format: ... Seems pretty effective to get GTP-3 to spit out the results in the exact format you want. This will save me so much time parsing to get out the results I need.
- thefreeman 4y agoInteresting concept. However both of these examples are apps that probably appear in millions of tutorial articles on react and redux. I would be curious to see how it performs on a more unique or complex application request, even the bill pay example you list in your concept.
- suction 4y ago[dead]
- sergiotapia 4y agoChatgpt has saved me hours helping me convert raw SQL queries into Ecto queries. I have learned a lot more about Ecto thanks to chatgpt. Easily a tool I would pay to use monthly.
- acemarke 4y agoHuh. As the current Redux maintainer, I'm not sure if I'm impressed or horrified at this :) (now I'm curious how well it would handle requests using our modern Redux Toolkit API syntax...)
- sodapopcan 4y ago[flagged]
- noisy_boy 4y ago[flagged]
- scrame 4y ago[flagged]
- zelphirkalt 4y agoDon't build your frontend in React at all, unless absolutely necessary. Look for simpler ways. Check if your website really needs to be a web app. Check if your website actually has many interactive widgets. Even if interactive widgets are present, check, whether you could go with a simpler approach of serving static web pages and serving a frontend framework only on pages, where the interactive widgets are located. This will save loads of time for pages, where simple template rendering as offered by most traditional web frameworks in proper backend languages is sufficient. Then you can add interactive widgets later on.
- nigamanth 4y agoThis is very useful, I feel like people just want to use React for all the "coolness" of using React. People should just use React when their application requires react.
- moffkalast 4y agoAnd it only requires React when it's gonna be worked on by hundreds of constantly rotating people that need to find where's what quickly. Typically a large corporate setting.
- nigamanth 4y agoYeah, I don't have a problem with people learning React and maybe creating a project with that sole purpose, but creating a project that could be enhanced by using another library or just static HTML files will save time and resources, which in my opinion are the 2 most essential things in a programmer's life.
- jillesvangurp 4y agoIt's the classic hammer & nail situation. If react is all you know, every problem looks like it's a great fit for react. Replace react with just about anything else that was once popular and you'll find some programmers are out there still trying to wack nails with that hammer. Technically, react is already a bit conservative and maybe past its glory. I don't think it's actually that cool anymore. I've lived through a few hype cycles in technology and this one is starting to feel a bit stale. The whole community seems stuck in a "maybe this will work ... nope" loop where they keep on "fixing" statefulness of their apps, untangling the unholy mess of CSS from their business logic, fixing performance issues, etc. That's been going on for nearly a decade now. Of course the notion of using chat-gpt to "fix" state handling is a bit ludicrous. Sounds to me like a "maybe this will work?" type of thing. Chatgpt is the new hammer here. And it looks like there's a wide category of nails it can wack. The right ambition level is figuring out just how big those nails are. I'd say, a more valid question to ask would be if something like chat gpt could generate a complete working UI and backend given a few prompts. I don't care if it's done in react or angular or whatever. As long as it works and the AI can iterate on it.
- sailorganymede 4y agoThis is such a cool project! I have to try this out myself
- khet 4y agoWhat's incredible is how software engineers have failed over the last decade to truly advance the creation of CRUD apps. Making a CRUD app in many ways has become much more complicated than it was when I started programming 10 years ago. Today when I want to build an application, I often find myself frustrated and bemused at the state of things. Not because I find it difficult to write TailWind, or connect my Redux state to a component, but because I would have imagined the increase in the number of engineers would have led to more abstractions that would have simplified the creation of a CRUD app, which is are just glorified web forms. I wonder if ChatGPT had even stood a chance if engineers were good at engineering. But engineers are really mostly good at boiler-plating code complex enough to ensure job security. Which ChatGPT might excel at one day. What I would have liked to have seen is a world in which we were good at creating abstraction layers to solve an entire class of problems. But alas, I might have asked for too much.
- emerongi 4y agoThere's definitely a movement towards simplicity, adjacent to the movement towards complexity. For example Phoenix LiveView, which provides a SPA-like experience to the user while keeping the logic server-side. Making a beautiful, rich web application is definitely simpler than ever, as long as you pick your tools correctly. On the other hand, working in a company with hundreds of engineers, the job is probably harder than ever, as there is a lot of over-engineering going on and you need a ton of knowledge about so many different tools. Large teams tend towards complexity and it's understandable and frustrating at the same time.
- ducharmdev 4y agoIt makes me wonder: what if the solutions you have in mind do exist out there, but simply as open source projects with zero eyeballs on them? What if there are dozens upon dozens of them, each solving a class of problems but in a slightly different way? In terms of organizing work among huge groups of people, I don't think any of the above possibilities would be feasible for an industry. We already complain about having just a handful of frameworks to choose from.
- 4y ago