Skip to content

The agent engineering platform.

accept openai terms (#9826)

Harrison Chase610f46d83aae
diff --git a/libs/langchain/langchain/prompts/chat.py b/libs/langchain/langchain/prompts/chat.py
index 7e7e5809f3..59fcb30c86 100644
--- a/libs/langchain/langchain/prompts/chat.py
+++ b/libs/langchain/langchain/prompts/chat.py
@@ -674,18 +674,18 @@ def _create_template_from_message_type(
Returns:
a message prompt template of the appropriate type.
"""
- if message_type == "human":
+ if message_type in ("human", "user"):
message: BaseMessagePromptTemplate = HumanMessagePromptTemplate.from_template(
template
)
- elif message_type == "ai":
+ elif message_type in ("ai", "assistant"):
message = AIMessagePromptTemplate.from_template(template)
elif message_type == "system":
message = SystemMessagePromptTemplate.from_template(template)
else:
raise ValueError(
- f"Unexpected message type: {message_type}. Use one of 'human', 'ai', "
- f"or 'system'."
+ f"Unexpected message type: {message_type}. Use one of 'human',"
+ f" 'user', 'ai', 'assistant', or 'system'."
)
return message