breadboard: [FR] Prevent wiring of incompatible types

Per an earlier in-person discussion, we should limit your ability to connect – say – number ports to string ports. FWIW I think we should incorporate behaviors and formats here, too.

So, for example, object to object wouldn’t work if it were object -> LLM Content -> Any to object -> [no behavior]. But things could be interesting if you did object -> LLM Content -> image-webcam to object -> LLM Content -> Any, because the latter is a superset of the former.

Same probably goes for array, where the item type, behavior(s) and formats should probably match.

If we do this at the API levels I can do a follow-up on the UI side to prevent folks from accidentally trying to wire things that are incompatible.

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 2
  • Comments: 18 (9 by maintainers)

Commits related to this issue

Most upvoted comments

Should we do automatic type coercion, like allow “number” -> “string”?

My feeling is no, at least not initially. I could see it leading to a class of bugs that are hard to debug.

Can we use JSON schema validation for all runtime type checking?

And agree, no automatic coercion. I think nodes that want to accept many types and do their own conversion can (e.g. template). We could also make a coerce node, or a library of them, to let users coerce.