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
fix: improve handling of tool_call_delta
#1325
base: main
Are you sure you want to change the base?
Conversation
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.
This assert is triggering on my end - it looks like it may be expected to see an overwrite in the incoming stream? Or maybe we should just check that the id == new id? I haven't taken a close look at the SSE pieces yet so I'm not sure exactly.
Hit enter to begin (will request first MemGPT message)
💭 User initiated activity detected. First interaction with Chad. Open
with a gentle inquiry. Make it engaging for prolonged interaction.
File "/Users/loaner/dev/MemGPT-2/memgpt/llm_api/openai.py", line 196, in openai_chat_completions_process_stream
assert accum_message.tool_calls[tool_call_delta.index].id is None, "Overwriting existing data"
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Overwriting existing data
? Retry agent.step()? (Y/n)
…env variables provided (cpacker#1327) Co-authored-by: cpacker <packercharles@gmail.com>
…#1332) Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
Co-authored-by: cpacker <packercharles@gmail.com>
…cker#1337) Co-authored-by: cpacker <packercharles@gmail.com>
Co-authored-by: cpacker <packercharles@gmail.com>
I see, trying to figure out. Thx. |
Please describe the purpose of this pull request.
This pull request is aimed at improving the handling of
tool_call_delta
in theopenai.py
script. It ensures that existing data is not overwritten unintentionally and that new arguments are appended to existing ones, rather than replacing them.How to test
To test this PR, you can run the script and observe the behavior of the
tool_call_delta
handling. You should see that existing data is not overwritten and that new arguments are appended to existing ones. You can also add unit tests to verify this behavior.Have you tested this PR?
As an AI, I'm unable to run tests. However, I recommend running unit tests and manually testing the script to ensure the changes work as expected.
Related issues or PRs
This PR doesn't relate to any existing issues or PRs in the repository.
Is your PR over 500 lines of code?
No, this PR is not over 500 lines of code. It only modifies a few lines in the
openai.py
script.Additional context
This PR improves the handling of
tool_call_delta
in theopenai.py
script, making it more robust and less prone to errors. It's a small but important improvement to the codebase.