This commit is contained in:
Happy-Engineer 2024-11-15 18:08:28 +08:00 committed by GitHub
commit 8195831e70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -538,6 +538,10 @@ class AnthropicLargeLanguageModel(LargeLanguageModel):
else:
raise ValueError(f"Got unknown type {message}")
# if no user message, add a system message as the user message to avoid at least one message error
if not prompt_message_dicts:
prompt_message_dicts.append({"role": "user", "content": system})
return system, prompt_message_dicts
def _convert_one_message_to_text(self, message: PromptMessage) -> str: