This commit is contained in:
Happy-Engineer 2024-11-14 21:36:21 +08:00 committed by GitHub
commit 47bc3fa65e
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: