Skip to content

Fix chat_json decorator PROMPT mutation in devchat#355

Merged
yangbobo2021 merged 2 commits into
mainfrom
bugfix/chat_json-prompt-mutation-#354
Apr 22, 2024
Merged

Fix chat_json decorator PROMPT mutation in devchat#355
yangbobo2021 merged 2 commits into
mainfrom
bugfix/chat_json-prompt-mutation-#354

Conversation

@yangbobo2021

Copy link
Copy Markdown
Contributor

This PR addresses the issue where the chat_json decorator would inadvertently mutate the PROMPT template 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_new to hold the intermediary states, ensuring that the original PROMPT template remains unaffected across function calls. Both chat and chat_json functions have been updated to make use of prompt_new, providing a consistent and predictable outcome regardless of the number of invocations.

Closes #354.

- 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
@yangbobo2021 yangbobo2021 merged commit 6402c9a into main Apr 22, 2024
@yangbobo2021 yangbobo2021 deleted the bugfix/chat_json-prompt-mutation-#354 branch April 22, 2024 01:43
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.

Issue with chat_json decorator in devchat causing PROMPT template variable mutation

1 participant