-
Notifications
You must be signed in to change notification settings - Fork 6.2k
Parallel func calling cleanup work #8808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bd701c7
to
8f1184b
Compare
|
||
# update using deltas | ||
role = delta.role or MessageRole.ASSISTANT | ||
content_delta = delta.content or "" | ||
content += content_delta | ||
|
||
# TODO: REFACTOR WITH FUNCTIONS | ||
# openai provides the delta on one tool-at-a-time |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jerryjliu's 1st comment from yesterdays PR:
high-level this is a lot of nested code, can we abstract out into helper functions above?
jerryjliu's 2nd comment
same with the async version
@@ -42,7 +42,10 @@ def to_openai_function(self) -> Dict[str, Any]: | |||
The name and arguments of a function that should be called, as generated by the | |||
model. | |||
""" | |||
# TODO fix this and make sure nothing breaks | |||
return self.to_openai_tool() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jerryjliu Comment on this from original PR
is this just duplicate code with to_openai_function? Can we just have to_openai_function call to_openai_tool while still marking it as deprecated?
* have to_openai_function just call to_openai_tool * wip * wip * wip * delegate check if tool_calls_delta is None to helper * refactor _astream_chat * wip * use typed objects over dicts, chat and achat * get streaming to work * add type checking of tool_call * remove Any * fix missing self * update openai_program * resolving mypy issues in python3.9 * resolving mypy issues in python3.9 * wip * update doc string for _update_tool_calls helper
Description
This PR completes the hangover work from the original parallel function PR #8738. In particular, the items that were marked as TODO which came from @jerryjliu's and @Disiok have been completed:
_stream_chat
and_astream_chat
thru cleaner logic and with helper functiondict
s when dealing withtool_call
to_openai_function
now invokesto_openai_tool
to_openai_function
to prepare theirtools
For convenience, I have added comments in the places where @jerryjliu and @Disiok raised comments in the original PR (#8738)
Type of Change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration