Skip to content

Commit

Permalink
fix: 修复混元大模型使用system角色报错
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Sep 20, 2024
1 parent 6d39cd8 commit f834f51
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
ChatMessage,
ChatMessageChunk,
HumanMessage,
HumanMessageChunk,
HumanMessageChunk, SystemMessage,
)
from langchain_core.outputs import ChatGeneration, ChatGenerationChunk, ChatResult
from langchain_core.pydantic_v1 import Field, SecretStr, root_validator
Expand All @@ -37,6 +37,8 @@ def _convert_message_to_dict(message: BaseMessage) -> dict:
message_dict = {"Role": "user", "Content": message.content}
elif isinstance(message, AIMessage):
message_dict = {"Role": "assistant", "Content": message.content}
elif isinstance(message, SystemMessage):
message_dict = {"Role": "system", "Content": message.content}
else:
raise TypeError(f"Got unknown type {message}")

Expand Down

0 comments on commit f834f51

Please sign in to comment.