@@ -553,7 +553,7 @@ def get_session_history(
553
553
return store [(user_id , conversation_id )]
554
554
555
555
with_message_history = RunnableWithMessageHistory (
556
- runnable , # type: ignore[arg-type]
556
+ runnable ,
557
557
get_session_history = get_session_history ,
558
558
input_messages_key = "messages" ,
559
559
history_messages_key = "history" ,
@@ -666,7 +666,7 @@ def get_session_history(
666
666
return store [(user_id , conversation_id )]
667
667
668
668
with_message_history = RunnableWithMessageHistory (
669
- runnable , # type: ignore[arg-type]
669
+ runnable ,
670
670
get_session_history = get_session_history ,
671
671
input_messages_key = "messages" ,
672
672
history_messages_key = "history" ,
@@ -769,13 +769,13 @@ def _fake_llm(messages: list[BaseMessage]) -> list[BaseMessage]:
769
769
770
770
runnable = RunnableLambda (_fake_llm )
771
771
history = InMemoryChatMessageHistory ()
772
- with_message_history = RunnableWithMessageHistory (runnable , lambda : history ) # type: ignore[arg-type]
772
+ with_message_history = RunnableWithMessageHistory (runnable , lambda : history )
773
773
_ = with_message_history .invoke ("hello" )
774
774
_ = with_message_history .invoke ("hello again" )
775
775
assert len (history .messages ) == 4
776
776
777
777
778
- class _RunnableLambdaWithRaiseError (RunnableLambda ):
778
+ class _RunnableLambdaWithRaiseError (RunnableLambda [ Input , Output ] ):
779
779
from langchain_core .tracers .root_listeners import AsyncListener
780
780
781
781
def with_listeners (
@@ -861,7 +861,7 @@ def test_get_output_messages_with_value_error() -> None:
861
861
runnable = _RunnableLambdaWithRaiseError (lambda _ : illegal_bool_message )
862
862
store : dict = {}
863
863
get_session_history = _get_get_session_history (store = store )
864
- with_history = RunnableWithMessageHistory (runnable , get_session_history )
864
+ with_history = RunnableWithMessageHistory (runnable , get_session_history ) # type: ignore[arg-type]
865
865
config : RunnableConfig = {
866
866
"configurable" : {"session_id" : "1" , "message_history" : get_session_history ("1" )}
867
867
}
@@ -876,8 +876,8 @@ def test_get_output_messages_with_value_error() -> None:
876
876
with_history .bound .invoke ([HumanMessage (content = "hello" )], config )
877
877
878
878
illegal_int_message = 123
879
- runnable = _RunnableLambdaWithRaiseError (lambda _ : illegal_int_message )
880
- with_history = RunnableWithMessageHistory (runnable , get_session_history )
879
+ runnable2 = _RunnableLambdaWithRaiseError (lambda _ : illegal_int_message )
880
+ with_history = RunnableWithMessageHistory (runnable2 , get_session_history ) # type: ignore[arg-type]
881
881
882
882
with pytest .raises (
883
883
ValueError ,
0 commit comments