Use Bun macros to generate typed interfaces for models at bundle time
mattt opened this issue · 0 comments
mattt commented
From https://bun.sh/docs/bundler/macros:
Macros are a mechanism for running JavaScript functions at bundle-time. The value returned from these functions are directly inlined into your bundle.
We could use this to download model schemas and provide typed interfaces for their inputs and outputs.
import 'replicate'
import { load } from 'replicate' with { type: 'macro' }
const sd3 = load("stability-ai/stable-diffusion-3")
const image = replicate.run(sd3, { input: { "prompt": "an astronaut riding a rainbow unicorn" })