breadboard-ai / breadboard

A library for prototyping generative AI applications.
Apache License 2.0
183 stars 25 forks source link

New board grammar doesn't allow creation of empty board #638

Open Mearman opened 8 months ago

Mearman commented 8 months ago

in updating my tests for https://github.com/breadboard-ai/breadboard/pull/587/#discussion_r1476743274 I discovered this, which is preventing me from creating an empty board.

 const emptyBoard = await board().serialize();

https://github.com/breadboard-ai/breadboard/blob/b5577943bdd0956bed3874244b34ea80f1589eaa/packages/breadboard/src/new/grammar/board.ts#L87-L88

dglazkov commented 8 months ago

Nice!

Mearman commented 8 months ago

@seefeldb Do you know a way around this currently?

seefeldb commented 8 months ago

My minimal board for tests is board((inputs) => inputs). That's not quite the same as empty, it creates an input and an output node and a * wire between them.

But then I think a lot of other stuff would break if boards don't have at least one input and one output node.

@dglazkov : board(() => ({})) doesn't work either right now, because I treat returning a constant as likely an error. I think (board((_, base) => base.output()) might work and might produce a board with just an output node, but I think we shouldn't allow that case. The true no-op case would be board((_, base) => base.input().as({}).to(base.output()), i.e. an input and output node pair with an empty wire between them. WDYT?

Mearman commented 8 months ago

Hmmm I think I had my OOP hat on too tight and just wanted to effectively construct someone with an empty constructor. though for the tests those examples will certainly point me in the right direction. thank you!

TinaNikou commented 1 month ago

We will look at whether this still applies to the newer Build API.