(no title)
joefreeman | 2 years ago
type Item = {
name: string;
...
size?: string;
I'm not really following how this would avoid `name: "grande latte"`?But then the example response:
"size": 16
> This is pretty great!Is it? It's not even returning the type being asked for?
I'm guessing this is more of a typo in the example, because otherwise this seems cool.
DanRosenwasser|2 years ago
graypegg|2 years ago
But now why would you want that to be locked into the type syntax? You probably want something more like Zod where you can use some runtime data to build up those union types.
You also want restrictions on the types too, like quantity should be a positive, non-fractional integer. Of course you can just validate the JSON values afterwards, but now the user gets two kinds of errors. One from the LLM which is fluent and human sounding, and the other which is a weird technical “oops! You provided a value that is too large for quantity” error.
The type syntax seems like the wrong place to describe this stuff.
mynameisvlad|2 years ago
There would be no way for a system to map "grande" to 16 based on the code provided, and 16 does not seem to be used anywhere else.
hirsin|2 years ago