Skip to content

Commit

Permalink
Improve update context condition checking rule (#2883)
Browse files Browse the repository at this point in the history
Co-authored-by: Chi Wang <[email protected]>
  • Loading branch information
thinkall and sonichi authored Jun 12, 2024
1 parent a0787ac commit 11b8c76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion autogen/agentchat/contrib/retrieve_user_proxy_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"""

HASH_LENGTH = int(os.environ.get("HASH_LENGTH", 8))
UPDATE_CONTEXT_IN_PROMPT = "you should reply exactly `UPDATE CONTEXT`"


class RetrieveUserProxyAgent(UserProxyAgent):
Expand Down Expand Up @@ -471,7 +472,7 @@ def _check_update_context(self, message):
message = message.get("content", "")
elif not isinstance(message, str):
message = ""
update_context_case1 = "UPDATE CONTEXT" in message[-20:].upper() or "UPDATE CONTEXT" in message[:20].upper()
update_context_case1 = "UPDATE CONTEXT" in message.upper() and UPDATE_CONTEXT_IN_PROMPT not in message
update_context_case2 = self.customized_answer_prefix and self.customized_answer_prefix not in message.upper()
return update_context_case1, update_context_case2

Expand Down

0 comments on commit 11b8c76

Please sign in to comment.