Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ovos_openai_plugin/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 11 additions & 0 deletions test/test_dropped_system_warning.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading