toolOutput schema vs widgetState not having a schema

Hey folks!

I’m struggling a bit with toolOutput vs widgetState and hoping someone has built more out than me and has some wisdom to share!

In the docs, it seems widgetState is used to inform the model about updates to the ui:

Widget state can be used for persisting data across user sessions, and exposing data to ChatGPT. Anything you pass to setWidgetState will be shown to the model, and hydrated into window.openai.widgetState

(from Build your ChatGPT UI )

In the pizzaz examples, the tool will return right away, and the UI will then load the data, and set it into widget state so the model can be asked about it.

The issue i’m struggling with, is how do you describe the shape of the setWidgetState to the model so that it can reason about it more effectively than just interpretting json.

The thing i love about “outputSchema” is you have an opportunity to describe the parameters, types, etc. with a zod schema, but i don’t think setWidgetState allows this.

Has anyone encountered this and have suggestions, or is it just up to well named props? :sweat_smile: Or hopefully i’m just missing a mechanism to do this (bake it into the tool prompt??).

TIA!