8000 Parallel func calling cleanup work by nerdai · Pull Request #8808 · run-llama/llama_index · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 17 commits into from
Nov 10, 2023
Merged

Conversation

nerdai
Copy link
Contributor
@nerdai nerdai commented Nov 9, 2023

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:

  • improve impl of _stream_chat and _astream_chat thru cleaner logic and with helper function
  • use openai's typed objects instead of dicts when dealing with tool_call
  • deprecated to_openai_function now invokes to_openai_tool
    • so user's can use deprecated to_openai_function to prepare their tools

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.

  • Bug fix (non-breaking change which fixes an issue). Not really bug fix, but more improvements to current impls

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

  • Checked a few notebooks still run as they should
  • I stared at the code and made sure it makes sense

@nerdai nerdai requested review from jerryjliu and Disiok November 9, 2023 15:39
@nerdai nerdai changed the title Nerdai/parallel func calling cleanup Parallel func calling cleanup work Nov 9, 2023
@nerdai nerdai force-pushed the nerdai/parallel_func_calling_cleanup branch from bd701c7 to 8f1184b Compare November 9, 2023 15:57

# 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
Copy link
Contributor Author
@nerdai nerdai Nov 9, 2023

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()
Copy link
Contributor Author

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?

@Disiok Disiok merged commit afa6ef8 into main Nov 10, 2023
@Disiok Disiok deleted the nerdai/parallel_func_calling_cleanup branch November 10, 2023 09:15
@ryanpeach ryanpeach mentioned this pull request Feb 7, 2024
15 tasks
ryanpeach pushed a commit to OnScale/llama_index that referenced this pull request Feb 7, 2024
* 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
@ryanpeach ryanpeach mentioned this pull request Feb 7, 2024
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0