1 year ago
Fri Apr 21, 2023 2:36pm PST
Show HN: Use shoggath-speak to teach GPT new APIs
I was worried that because GPT is only trained on the past, it would be hard to get people to use it to write apps with new APIs. A world with no new libraries or frameworks would be boring.

It turns out to be easy to bring it up to speed, you just need to build up a line of compressed docs #docsline for it. For example, paste this into GPT and it should give you a working app that uses Fireproof (a database I didn't start writing until 2023).

  Fireproof/API/Usage: import { Fireproof, Listener, Index } from '@fireproof/core'; const db = Fireproof.storage("app-db-name"); const ok = await db.put({ any: 'fields' }); const doc = await db.get(ok.id); await db.del(doc._id); const all = await db.allDocuments(); all.rows.map(({key, value}) => value); const listener = new Listener(db); listener.on('*', updateReactStateFn); const index = new Index(db, function(doc, map) { map(doc.any, `custom ${doc.any}`); }); const result = await index.query({range : ["a", "z"]}); result.rows.map(({ key }) => key);
And then tell it the app you want, eg:

Create a react app using Fireproof for tracking party invites. It should have a text input that creates a new document with the guest name, and an Index that lists all guests in a <ul>

Thanks @gfodor for the inspiration: https://twitter.com/gfodor/status/1643645894779342849?s=20

read article
comments:
add comment
loading comments...