fix: zhipu tool calling, this PR fixes the bug described in issue #5496 (#5469)

Co-authored-by: vccler <vccler@163.com>
Co-authored-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
vccler 2024-06-22 12:41:24 +08:00 committed by GitHub
parent e8ad0339a3
commit 48757e581e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,7 @@ from core.model_runtime.entities.message_entities import (
PromptMessageRole,
PromptMessageTool,
SystemPromptMessage,
ToolPromptMessage,
UserPromptMessage,
)
from core.model_runtime.errors.validate import CredentialsValidateFailedError
@ -463,6 +464,8 @@ class ZhipuAILargeLanguageModel(_CommonZhipuaiAI, LargeLanguageModel):
message_text = f"{ai_prompt} {content}"
elif isinstance(message, SystemPromptMessage):
message_text = content
elif isinstance(message, ToolPromptMessage):
message_text = content
else:
raise ValueError(f"Got unknown type {message}")