Open notarealdeveloper opened 9 months ago
Annotated types!
e.g.
from minml import gen_type
from typing import Annotated
from pydantic import StringConstraints
type = Annotated[str, StringConstraints(pattern=r'[A-Z]\d')]
Then use gen_type
from there.
Note that
Fantastic! We'll look into it and see what we can do.
I find it somewhat concerning that you're seeing negative numbers in these contexts after adding guidance/minml to your workflow. Can you post a minimal example of a prompt that gives an erroneous negative? I would like to understand what's going on here :)
Thanks to your help with #2, the
gpts
library now has a PR that adds a typedask_for
method usingguidance
andminml
.However, when me and @rskottap added tests to that method, we found it giving outputs that were never found in the (untyped) free response outputs.
Specifically, asking the models directly, without the guidance of
guidance
, we never got a negative value for the answer to any of the questions:Here's what we get with the
minml
based methods:Any ideas on how to add a "positive" constraint to the int or float types, or more generally how to add other dependent types like "strings that match a regex"?