simple-openai icon indicating copy to clipboard operation
simple-openai copied to clipboard

Enable ToolFunctionDef instantiation for custom function handlers

Open widoriezebos opened this issue 9 months ago • 6 comments

When combining the Chat streaming API with functions, the incoming deltas need to be merged into a single message in order to call one or more functions. Currently the classes involved make it a bit hard to write an Accumulator that appends the deltas into a single message with one or more Tools.

Maybe I missed it; is there a way to have function calling support with the streaming API? If there is not; it would be good to at least have setters (next to getters) for all the messages involved so the accumulator can append.

Even better would be a listener mechanism that notifies some listener of incoming deltas until the entire message was received

I’m happy to write an accumulator but would appreciate setters (that currently do not exist). Alternatively a factory method for construction of messages would also be appreciated.

Looking forward to your view on this. Thanks in advance!

widoriezebos avatar May 14 '24 17:05 widoriezebos