hotg-ai / rune

Rune provides containers to encapsulate and deploy edgeML pipelines and applications
Apache License 2.0
133 stars 15 forks source link

Make it easier to pass inputs through the builder API #372

Closed Michael-F-Bryan closed 2 years ago

Michael-F-Bryan commented 2 years ago

The current withCapability() method takes a function that constructs a Capability object who's properties are incrementally updated... This is a massive pain for frameworks like React that hate mutation.

Something like this might be easier to work with:


type InputDescription = {
  type: "raw" | "image" | ... | "sound",
  args: Record<string, number>,
};

type GetInputs = (InputDescription[]) => Tensor[];

class Builder {
  ...

  // Set the function Rune will call when it wants inputs.
  withInputs(getInputs: GetInputs): this { ... }
}