breadboard-ai / breadboard

A library for prototyping generative AI applications.
Apache License 2.0
151 stars 21 forks source link

Input on invoke node disappears when removing an edge #1131

Open ianli opened 5 months ago

ianli commented 5 months ago

Expected Behavior

When removing an edge that connects to an invoke node, the input to the invoke node should stay, so that you can reconnect an edge to the input.

Actual Behavior

When removing an edge that connects to an invoke node, the input to the invoke node disappears.

In this board, it happens to the invoke node's inputs: stopSequences and context. This also happens to the invoke node's outputs: text and context

Steps to Reproduce the Problem

  1. Visit https://breadboard-ai.web.app/?mode=build&board=%2Fgraphs%2Fagent.json
  2. Remove the edge that connects input-1/stopSequences to invoke(generate)/stopSequences.
  3. The input stopSequences to the node invoke(generate) disappears.

Specifications

ianli commented 5 months ago

I looked into the JSON representation of the graphs and it looks like the invoke node doesn't have complete information on its inputs and outputs (configuration doesn't have information that stopSequences is an input) (code). So to be rendered in the Breadboard UI, the inputs and outputs have to inferred from the edges.

I also found that this bug happens with the jsonata node (https://breadboard-ai.web.app/?mode=build&board=%2Fgraphs%2Fagent.json). And similarly, the configuration attribute of the node is blank.

Interestingly, the invoke node in this board has information that text is an input. Thus, when the edge that connects to the text input is disconnected, the text input doesn't disappear.

configuration: {
   "text": "unused"
}

Can the input/output information be included in the configuration for the invoke and jsonata nodes?