breadboard-ai / breadboard

A library for prototyping generative AI applications.
Apache License 2.0
96 stars 19 forks source link

Migrate old boards to new syntax #1906

Open Mearman opened 1 month ago

Mearman commented 1 month ago

For exemplar style see: https://github.com/breadboard-ai/breadboard/blob/7654c4ea5ee8c74370b768f8ec30dd1ff8cb3637/packages/gemini-kit/src/boards/gemini-generator.ts

Current references to old syntax:

Typescript

Kits

Nodes

Boards to delete

Boards/projects to deprecate (no need to convert)

Tests

Javascript

Markdown

dglazkov commented 1 month ago

Amazing! Let me go over the boards real quick and split out the ones we just want to delete.

aomarks commented 1 month ago

Awesome!

A prerequisite for converting a board is to migrate all of the nodes it uses first. (Note that migrated nodes work with both the old and new syntax, so this can happen incrementally). It would be cool to audit all of our nodes, too, and even cooler if there was a count of how often they are used in boards (after deleting the boards we don't care about, of course) to help prioritize.

Mearman commented 1 month ago

@aomarks Like I've got the gemini-generator board as an exemplar style with the new syntax. Do you have one for the nodes?

Mearman commented 1 month ago

@aomarks I'll see if I can get a usable dependency graph

aomarks commented 1 month ago

@aomarks I'll see if I can get a usable dependency graph

On second thought, I wouldn't spend too much time on analyzing the node dependencies, since the other approach is just to pick off one board that we know we want to keep, try to convert all its nodes, and repeat :)

@aomarks Like I've got the gemini-generator board as an exemplar style with the new syntax. Do you have one for the nodes?

Yep! Any file that contains "defineNodeType" is an example, but some interesting ones I recommend looking at are:

fetch: https://github.com/breadboard-ai/breadboard/blob/main/packages/core-kit/src/nodes/fetch.ts

template: https://github.com/breadboard-ai/breadboard/blob/main/packages/template-kit/src/nodes/prompt-template.ts (along with its tagged-template-literal helper https://github.com/breadboard-ai/breadboard/blob/main/packages/template-kit/src/nodes/prompt-template-tag.ts)

runJavascript: https://github.com/breadboard-ai/breadboard/blob/main/packages/core-kit/src/nodes/run-javascript.ts

Mearman commented 1 month ago

On second thought, I wouldn't spend too much time on analyzing the node dependencies, since the other approach is just to pick off one board that we know we want to keep, try to convert all its nodes, and repeat :)

Yeah I just had a look to see if I could pick them out with Madge. Not worth it

TinaNikou commented 1 month ago

@dglazkov I've been removing the boards which are listed for deletion, but I found a few which are currently used by other boards:

Do you have any thoughts on deleting or updating any of those boards?

dglazkov commented 1 month ago

Thank you!!

  • The 'Ask User' board (./packages/breadboard-web/src/boards/ask-user.ts) and the 'Agent' board (./packages/breadboard-web/src/boards/agent.ts) are both used by the 'Single turn' board (./packages/breadboard-web/src/boards/single-turn.ts).

Yes. Delete them all.

  • The OpenAI Chunk Transformer board (./packages/breadboard-web/src/boards/openai-chunk-transformer.ts) is used by the 'OpenAI GTP 3.5 Turbo' board (./packages/breadboard-web/src/boards/openai-gpt-35-turbo.ts) and the 'OpenAI GTP 4 Vision' board (./packages/breadboard-web/src/boards/openai-gpt-4-vision.ts).

Let's leave those.

  • The 'Gemini Generator' board (./packages/breadboard-web/src/boards/gemini-generator.ts) is used by the 'Text Generator' board (./packages/breadboard-web/src/boards/text-generator.ts) and the 'Simplest' board (./packages/breadboard-web/src/boards/simplest.ts). Just to note, the 'Text Generator' board used two other boards which were removed (./packages/breadboard-web/src/boards/mock-text-generator.ts and ./packages/breadboard-web/src/boards/palm-text-generator.ts), so once the 'Gemini Generator' gets removed then the only generator option available will be the 'OpenAI GTP 3.5 Turbo' board.

Sounds good.

I'd love to modernize the openai boards -- just make them work really well and simplify using the new syntax. If you're up for it 🙏🏻