[X] I added a very descriptive title to this issue.
[X] I searched the LangChain documentation with the integrated search.
[X] I used the GitHub search to find a similar question and didn't find it.
[X] I am sure that this is a bug in LangChain rather than my code.
[X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
from langchain_community.chat_models import ChatCoze
from langchain_core.messages import SystemMessage, HumanMessage
import os
from config.config_llm import *
messages1 = [
HumanMessage(content="Who are you?")
]
response1 = chat(messages1)
print("Test 1 - Only HumanMessage:", response1)
test2:使用 SystemMessage + HumanMessage
messages2 = [
SystemMessage(content="You are a helpful math tutor who speaks like Shakespeare."),
HumanMessage(content="What is 2+2?")
]
response2 = chat(messages2)
print("Test 2 - With SystemMessage:", response2)
Error Message and Stack Trace (if applicable)
(i:\Diting\diting_backend.conda) PS I:\Diting\diting_backend> python .\test.py
I:\Diting\diting_backend\test.py:17: LangChainDeprecationWarning: The method BaseChatModel.__call__ was deprecated in langchain-core 0.1.7 and will be removed in 1.0. Use :meth:~invoke instead.
response1 = chat(messages1)
Test 1 - Only HumanMessage: content="I'm Claude_DITING. How can I assist you today?" additional_kwargs={} response_metadata={} id='run-996ef539-8e93-4318-ad80-6e9917ef3b99-0'
Test 2 - With SystemMessage: content='Verily, the sum of 2 and 2 is 4.' additional_kwargs={} response_metadata={} id='run-97b81d24-8c14-4aca-9739-62721a2ebbdf-0'
Checked other resources
Example Code
from langchain_community.chat_models import ChatCoze from langchain_core.messages import SystemMessage, HumanMessage import os from config.config_llm import *
chat = ChatCoze( coze_api_key= coze_apikey, bot_id="", user="", streaming=True )
test1:仅使用 HumanMessage
messages1 = [ HumanMessage(content="Who are you?") ] response1 = chat(messages1) print("Test 1 - Only HumanMessage:", response1)
test2:使用 SystemMessage + HumanMessage
messages2 = [ SystemMessage(content="You are a helpful math tutor who speaks like Shakespeare."), HumanMessage(content="What is 2+2?") ] response2 = chat(messages2) print("Test 2 - With SystemMessage:", response2)
Error Message and Stack Trace (if applicable)
(i:\Diting\diting_backend.conda) PS I:\Diting\diting_backend> python .\test.py I:\Diting\diting_backend\test.py:17: LangChainDeprecationWarning: The method
BaseChatModel.__call__
was deprecated in langchain-core 0.1.7 and will be removed in 1.0. Use :meth:~invoke
instead. response1 = chat(messages1) Test 1 - Only HumanMessage: content="I'm Claude_DITING. How can I assist you today?" additional_kwargs={} response_metadata={} id='run-996ef539-8e93-4318-ad80-6e9917ef3b99-0' Test 2 - With SystemMessage: content='Verily, the sum of 2 and 2 is 4.' additional_kwargs={} response_metadata={} id='run-97b81d24-8c14-4aca-9739-62721a2ebbdf-0'Description
The system message in ChatCoze is not working
System Info
python 3.11
langchain 0.3.7 langchain-anthropic 0.3.0 langchain-chroma 0.1.4 langchain-cohere 0.3.2 langchain-community 0.3.7 langchain-core 0.3.19 langchain-experimental 0.3.3 langchain-ollama 0.2.0 langchain-openai 0.2.9 langchain-text-splitters 0.3.2 langchainhub 0.1.21 langsmith 0.1.144 lxml 5.3.0