mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-07 08:26:10 +00:00
refactor(anthropic): single-source the converted system note
The /v1/messages pass-through and the chat completions path must prefix a converted system turn with the same operator note.
This commit is contained in:
parent
986a505131
commit
c79f3ac195
1 changed files with 2 additions and 3 deletions
|
|
@ -31,6 +31,7 @@ from ...common_utils import (
|
|||
optionally_handle_anthropic_oauth,
|
||||
strip_advisor_blocks_from_messages,
|
||||
)
|
||||
from ...mid_conversation_system import CONVERTED_SYSTEM_NOTE
|
||||
|
||||
DEFAULT_ANTHROPIC_API_VERSION: Final = "2023-06-01"
|
||||
|
||||
|
|
@ -160,9 +161,7 @@ class AnthropicMessagesConfig(BaseAnthropicMessagesConfig):
|
|||
def _is_system_role_message(message: Any) -> bool:
|
||||
return isinstance(message, dict) and message.get("role") == "system"
|
||||
|
||||
_CONVERTED_SYSTEM_NOTE: Final = (
|
||||
"Operator note (not from the user): the following was originally a mid-conversation system-role reminder."
|
||||
)
|
||||
_CONVERTED_SYSTEM_NOTE: Final = CONVERTED_SYSTEM_NOTE
|
||||
|
||||
def _system_role_message_as_user(self, message: Mapping) -> Mapping:
|
||||
return {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue