4 ms·
Hi HN! made this this weekend to scratch an itch - felt like with long context now available with anthropic i wanted a universal page summarizer. but i hate the
by swyx 3y ago
Hi HN! made this this weekend to scratch an itch - felt like with long context now available with anthropic i wanted a universal page summarizer. but i hate the obscure dance of making chrome extensions. so of course instead of doing that i yakshaved myself into making a thing that makes chrome extensions... and every other possible smol app i might want in future.
full demo here:
https://youtu.be/UCo7YeTy-aE https://youtu.be/UCo7YeTy-aE
this is the result of say ~1 straight day of experimenting and prompting, and learning to do whole program synthesis with LLMs unburdened by any knowledge of prior art or literature.
learnings:
- *Markdown is all you need* - Markdown is the perfect way to prompt for whole program synthesis because it is easy to mix english and code (whether `variable_names` or entire code fenced code samples)
- turns out you can specify prompts in code in prompts and gpt4 obeys that to the letter
- *Copy and paste programming*
- teaching the program to understand how to code around a new API (Anthropic's API is after GPT3's knowledge cutoff) by just pasting in the `curl` input and output
- pasting error messages into the prompt and vaguely telling the program how you'd like it handled. it kind of feels like "logbook driven programming".
- *Debugging by `cat`ing* the whole codebase with your error message and getting specific fix suggestions - particularly delightful!
- *Tricks for whole program coherence* - our chosen example usecase, Chrome extensions, have a lot of indirect dependencies across files. Any hallucination of cross dependencies causes the whole program to error.
- We solved this by adding an intermediate step asking GPT to think through `shared_dependencies.md`, and then insisting on using that in generating each file. This basically means GPT is able to talk to itself...
- ... but it's not perfect, yet. `shared_dependencies.md` is sometimes not comperehensive in understanding what are hard dependencies between files. So we just solved it by specifying a specific `name` in the prompt. felt dirty at first but it works, and really it's just clear unambiguous communication at the end of the day.
- see `prompt.md` for SOTA smol-dev prompting
- *Low activation energy for unfamiliar APIs*
- we have never really learned css animations, but now can just say we want a "juicy css animated red and white candy stripe loading indicator" and it does the thing.
- ditto for Chrome Extension Manifest v3 - the docs are an abject mess, but fortunately we don't have to read them now to just get a basic thing done
- the Anthropic docs were missing guidance on what return signature they have. so just curl it and dump it in the prompt lol.
- *Modal is all you need* - we chose Modal to solve 4 things:
- solve python dependency hell in dev and prod
- parallelizable code generation
- simple upgrade path from local dev to cloud hosted endpoints (in future)
- fault tolerant openai api calls with retries/backoff, and attached storage (for future use)
enjoy!
- julianeon 3y agoVery cool, thanks for making this.