There seems to be an issue within the devchat's chat functionality, specifically with the chat_json decorator. When it's called multiple times, the PROMPT template variable undergoes an undesired mutation during execution. This mutation affects the outcome when the function is repeatedly invoked, leading to inconsistent behavior and potentially incorrect results.
Steps to reproduce:
Set up a PROMPT template for use with the chat_json decorator in a devchat environment.
Invoke a function decorated with chat_json multiple times that uses the PROMPT template.
Observe that the content of PROMPT is changed after initial calls, affecting subsequent function calls.
Expected behavior: The PROMPT template variable should remain constant across multiple invocations of the decorated function, ensuring consistent functionality throughout.
Actual behavior: The PROMPT variable is mutated during the process, leading to inconsistencies and possibly incorrect operation of the decorated function across calls.
This issue significantly affects the reliability and predictability of using the devchat's chat feature with the chat_json decorator, especially in scenarios where function reusability is crucial. Any insights or fixes for this problem would be greatly appreciated.
There seems to be an issue within the devchat's
chat
functionality, specifically with thechat_json
decorator. When it's called multiple times, thePROMPT
template variable undergoes an undesired mutation during execution. This mutation affects the outcome when the function is repeatedly invoked, leading to inconsistent behavior and potentially incorrect results.Steps to reproduce:
PROMPT
template for use with thechat_json
decorator in a devchat environment.chat_json
multiple times that uses thePROMPT
template.PROMPT
is changed after initial calls, affecting subsequent function calls.Expected behavior: The
PROMPT
template variable should remain constant across multiple invocations of the decorated function, ensuring consistent functionality throughout.Actual behavior: The
PROMPT
variable is mutated during the process, leading to inconsistencies and possibly incorrect operation of the decorated function across calls.This issue significantly affects the reliability and predictability of using the devchat's
chat
feature with thechat_json
decorator, especially in scenarios where function reusability is crucial. Any insights or fixes for this problem would be greatly appreciated.