breadboard-ai / breadboard

A library for prototyping generative AI applications.
Apache License 2.0
172 stars 23 forks source link

Templated Inputs #3260

Open dglazkov opened 1 week ago

dglazkov commented 1 week ago

Writing this idea down for later:

Imagine a component that has a "input template" config port.

You type into this port:

Hello! Welcome to zombo.com. 

Let's start by getting a few details about your business:

Name: {{business}}
Location: {{location}}
A picture of your business:
{{picture | image}}

When invoked, this component will show the LLM Input field of the following structure:

So now, it looks like we presented the user with a form. The user fills out the fields they can edit and hit "Continue".

There's another optional config port named "output template" that allows you to format the output:

Name: {{business}}
Location: {{location}}
Picture: {{picture}}

The output port is "Context Out", and for our case, it will contain two parts:

If the output template is not specified, the input template is used.

dglazkov commented 1 week ago

@paullewis

paullewis commented 1 week ago

I think we could make this out of the existing LLM Content type. The only bits of metadata we'd need to add in are a) the type of each segment so that only offer the right input controls, and b) which ones are read-only versus editable. Besides that, though, I think we're already pretty near.

dglazkov commented 1 week ago

Yeah! I was thinking it will just react to the LLM content it's given. If a part has a readonly property, then it's frozen. Re: the right input controls. Maybe specify schema on a non-read-only part? Similar to my hacks with $metadata, but on each part?