-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
JsonOutputFunctionParser: Fix mutation in place bug #8758
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -25,8 +25,8 @@ def parse_result(self, result: List[Generation]) -> Any: | |||
) | |||
message = generation.message | |||
try: | |||
func_call = message.additional_kwargs["function_call"] | |||
except ValueError as exc: | |||
func_call = message.additional_kwargs["function_call"].copy() |
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.
should this be deep copied to be safe?
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.
Either works i favor shallow copies to keep things light weight though I think it hardly matters in this case as it's a tiny dict so deep copy works
Fixes mutation in place in the JsonOutputFunctionParser. This causes issues
when trying to re-use the original AI message.