Fix chat_json decorator PROMPT mutation in devchat#355
Merged
Conversation
- Introduced variable prompt_new to avoid mutating the original prompt - Ensured prompt_new is consistently used for message comparison and appending - Adjusted both chat and chat_json functions to utilize prompt_new effectively
- Expanded assert in CLI prompt tests to include camelCase variation - Ensures tests now cover different naming conventions effectively - Improves the reliability of function name assertions in CLI tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses the issue where the
chat_jsondecorator would inadvertently mutate thePROMPTtemplate variable during multiple invocations within the devchat application, leading to inconsistent behavior as documented in issue #354.The proposed changes introduce a new variable
prompt_newto hold the intermediary states, ensuring that the originalPROMPTtemplate remains unaffected across function calls. Bothchatandchat_jsonfunctions have been updated to make use ofprompt_new, providing a consistent and predictable outcome regardless of the number of invocations.Closes #354.