Improve warning message wording and formatting

This commit is contained in:
Paul Kompfner
2026-03-20 17:25:43 -04:00
parent d779a5b4ea
commit 27fabfc1b3

View File

@@ -178,10 +178,10 @@ class BaseLLMAdapter(ABC, Generic[TLLMInvocationParams]):
if not self._warned_system_instruction: if not self._warned_system_instruction:
self._warned_system_instruction = True self._warned_system_instruction = True
logger.warning( logger.warning(
"Both system_instruction and a system message in context are set." "Both system_instruction and an initial system message in"
" Using system_instruction. The system message in context is being" " context are set. Using system_instruction. The context"
" converted to a user message to avoid sending an empty conversation" " system message is being converted to a user message to"
" history." " avoid sending an empty conversation history."
) )
messages[0]["role"] = "user" messages[0]["role"] = "user"
return None return None
@@ -223,13 +223,16 @@ class BaseLLMAdapter(ABC, Generic[TLLMInvocationParams]):
self._warned_system_instruction = True self._warned_system_instruction = True
if discard_context_system: if discard_context_system:
logger.warning( logger.warning(
"Both system_instruction and a system message in context are set." "Both system_instruction and an initial system message"
" Using system_instruction." " in context are set. Using system_instruction."
) )
else: else:
logger.warning( logger.warning(
"Both system_instruction and an initial system message in context" "Both system_instruction and an initial system message"
" are set, which may be unintended. Prefer system_instruction." " in context are set, which may be unintended. Keeping"
" both, but consider using system_instruction for"
" system-level instructions and developer messages in"
" context for supplementary guidance."
) )
if system_instruction: if system_instruction: