breadboard-ai / breadboard

A library for prototyping generative AI applications.
Apache License 2.0
171 stars 22 forks source link

Streamlined Schema Editor #3266

Open dglazkov opened 4 days ago

dglazkov commented 4 days ago

After working with the schema editor and observing others use it, I am realizing that it's time for us to give it a onceover. It's by far the most obtuse bit of machinery and is something that the users face at the very beginning of their journey.

The following is a meek attempt to reimagine the JSON schema editor UI. The Windows 95 mocks are provided as inspiration 🕺🏻

The basic idea is that we draw a very clear line between the "beginner" and "advanced" use cases. It also happens that the "beginner" case is also the most common, so that's pretty cool.

For beginners, we really want just two types of inputs: text (multiline string) and conversation context (LLM Content array).

For advanced users, we give up on trying to give them a structured UI and instead provide a JSON text editor (we already have codemirror for JS)

Here's what it might look like. The first UI field is the three choices: "Conversation Context", "Text", and "Custom", with "Conversation Context" selected as initial value.

(I am not tied to "Conversation Context". If there's a better term, let's use it)

The rest of the fields are "Title", "Description", and "Default".

image

If the user selects "Text" type, the UI changes slightly to accommodate:

image

When the user selects "Custom", they see a JSON text editor:

image

Ideally, this editor has bracket highlighting (intellisense would be amazing)

Switching between the types is destructive, so we need to be careful and warn the user (maybe a caution sign or something?) when they entered values that don't translate across types.

WDYT @paullewis?

paullewis commented 3 days ago

I like this, though I wonder if we should keep the existing schema editor for the custom type rather than dropping to JSON? It feels like if we go to JSON we significantly increase the possibility of hard-to-find errors.

dglazkov commented 3 days ago

Yeah, that sounds right.

The JSON editor is mostly for truly weird cases. For instance, the schema for a parameterized input in Specialist is "LLM Content or LLM Content Array or string" -- once we get to that point, JSON seems like the only way to go without going mad.

But for now, I think we can totally get away with just moving the current editor under the "Custom" section.

dglazkov commented 1 day ago

Oh, also, I found that I need to signal "there's no schema value here" vs. "this is actually a schema with no values" difference, similar to how we have "empty array" vs. "no array".