outlines-dev / outlines

Structured Text Generation
https://outlines-dev.github.io/outlines/
Apache License 2.0
8.16k stars 412 forks source link

Integrate OpenAI functions with Pydantic #370

Open rlouf opened 9 months ago

rlouf commented 9 months ago

What behavior of the library made you think about the improvement?

OpenAI functions are not available via Outlines. However, we could use it for comparison purposes.

How would you like it to behave?

We would like an API that is similar to the current text.generate.json API or the same.

The main constraint with using the same function is that OpenAI’s response is not always parseable JSON. We could implement it in a separate text.generate.openai.json module.

JerryKwan commented 1 month ago

@rlouf We may need to change the implementation logic here https://github.com/outlines-dev/outlines/blob/main/outlines/generate/json.py#L71 and https://github.com/outlines-dev/outlines/blob/main/outlines/models/openai.py#L253 right?

rlouf commented 1 month ago

These are the two entry points indeed.

JerryKwan commented 1 month ago

Thanks for the feedback, I will work on it ASAP