diff --git a/ovos_openai_plugin/chat.py b/ovos_openai_plugin/chat.py index b00bd66..bef1c25 100644 --- a/ovos_openai_plugin/chat.py +++ b/ovos_openai_plugin/chat.py @@ -80,8 +80,11 @@ def validate_messages(self, messages: List[AgentMessage]) -> List[AgentMessage]: LOG.warning( f"dropped {len(dropped)} system message(s) before the request: " f"'allow_system_prompts' is off. Context a memory plugin injects as a " - f"system message is discarded with it; set 'allow_system_prompts', or " - f"set the memory plugin's 'inject_mode' to one this engine keeps.") + f"system message is discarded with it; set 'allow_system_prompts', or, " + f"for a retrieval memory (lexical, local-rag, the passages of a " + f"composite, or ovos-openai-rag-memory-plugin), set its 'inject_mode' " + f"to 'user' and move its 'system_prompt' to this engine's " + f"'system_prompt'.") messages = [m for m in messages if m.role != MessageRole.SYSTEM] if not messages: diff --git a/test/test_dropped_system_warning.py b/test/test_dropped_system_warning.py index f0278d2..2664330 100644 --- a/test/test_dropped_system_warning.py +++ b/test/test_dropped_system_warning.py @@ -36,6 +36,17 @@ def test_warns_when_it_drops_a_system_message(): assert "allow_system_prompts" in said and "inject_mode" in said, said +def test_hint_limits_inject_mode_to_retrieval_memories(): + with patch("ovos_openai_plugin.chat.LOG") as log: + _engine().validate_messages(_messages()) + said = " ".join(str(c) for c in log.warning.call_args_list) + assert ("set 'allow_system_prompts', or, for a retrieval memory (lexical, " + "local-rag, the passages of a composite, or ovos-openai-rag-memory-plugin), " + "set its 'inject_mode' to 'user' and move its 'system_prompt' to this " + "engine's 'system_prompt'.") in said, said + assert "one this engine keeps" not in said, said + + def test_warns_once_per_engine(): engine = _engine() with patch("ovos_openai_plugin.chat.LOG") as log: