Open lapp0 opened 9 months ago
Hi @lapp0, definitely interested in this feature! Curious if this is something that's planned for the near term?
I'm a bit busy the coming weeks, but I'd be happy to provide guidance if you, or anyone else is interested in implementing!
Having this implemented first would help a lot:
Happy to contribute! Before I commit, though, I'd like to get a sense of the scope of work and estimated time involved. I don't want to make promises I can't keep :)
Great to hear @jeffreyftang
I think we should focus on https://github.com/outlines-dev/outlines/issues/667 for now. If you're interested in implementing that component, could you please ping remi in that issue?
Once that part is implemented, interleaved function calling really just involves using #667 to implement the loop described in this issue and enable function
interegular.FSM
, then modify to "Allow generation of (anything other than <function_name>) (
What behavior of the library made you think about the improvement?
Generation cannot be interleaved with function calls and return values.
How would you like it to behave?
We should allow users to augment LLMs with OpenAI-style function calls.
This would be a great integration for Outlines for the following reasons:
Proposed Structure
We should remain flexible in implementation, as some models may be finetuned for a different format. However we should set a default standard which is easily capturable by regex:
Allow generation of (anything other than
```<function_name>
) (```<function_name>
followed by function kwarg confirming JSON) repeatingAfter function call, we update the generation with the functions return value.
Structure Example:
At this point,
calculate
is called, and the response is injected:Then generation proceeds:
Code Example
Implementation
To resolve this issue we need to implement the following
List[Callable]
to function calling regex pattern, enabling free generation of text until the function call begins (```<function_name>
)SequenceGenerator
which can intercept function calls and perform themReferences
Prior art:
Useful tool:
Models: