Open rlouf opened 1 month ago
Hey @rlouf I'm pretty new on the repo, would like to start contributing and found this issue interesting Based on the open functions section of the readme and to my current understanding, changes would be made in:
outlines/generate/json.py
, in the json
function, add a way to handle Enum
soutlines/fsm/json_schema.py
so that in to_regex
the "enum"
sub-case can handle callable
Regarding the first item, it seems correlated to this issue as the handling of Enum
s would be similar (and call to_regex
if we encounter an Enum
in the choice
function)
You understood well!
Thanks 🙏 Gonna work on it!
Presentation of the new feature
Outlines can already do simple function calling either by passing a Pydantic model that models the function's signature, or by passing a function. We would like a simple interface to do function calling with multiple functions.
We could for instance pass an
Enum
to the generating function:Where does it fit in Outlines?
Outlines' main appeal is the definition of output types. I think this is a very important use case. We've had to implement it manually several times internally.
Are you willing to open a PR?
Sure.