Skip to content

Use Bun macros to generate typed interfaces for models at bundle time #289

@mattt

Description

@mattt

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" })

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions