File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
nemoguardrails/integrations/langchain Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change 1818from typing import Any , List , Optional
1919
2020from langchain_core .language_models import BaseLanguageModel
21- from langchain_core .messages import AIMessage , HumanMessage
21+ from langchain_core .messages import AIMessage , HumanMessage , SystemMessage
2222from langchain_core .prompt_values import ChatPromptValue , StringPromptValue
2323from langchain_core .runnables import Runnable
2424from langchain_core .runnables .config import RunnableConfig
@@ -139,6 +139,8 @@ def _transform_input_to_rails_format(self, _input):
139139 messages .append ({"role" : "assistant" , "content" : msg .content })
140140 elif isinstance (msg , HumanMessage ):
141141 messages .append ({"role" : "user" , "content" : msg .content })
142+ elif isinstance (msg , SystemMessage ):
143+ messages .append ({"role" : "system" , "content" : msg .content })
142144 elif isinstance (_input , StringPromptValue ):
143145 messages .append ({"role" : "user" , "content" : _input .text })
144146 elif isinstance (_input , dict ):
You can’t perform that action at this time.
0 commit comments