@@ -184,6 +184,7 @@ def test_map_message_from_langchain_ai_with_agent_call(self) -> None:
184184 name = f"{ lc .AGENT_PREFIX } assistant" ,
185185 args = {"args" : {"q" : "test" }, "thread_id" : None },
186186 id = "tc-2" ,
187+ type = "tool_call" ,
187188 )
188189 message = LC_AIMessage (content = "done" , tool_calls = [tool_call ])
189190 mapped = lc ._map_message_from_langchain (message )
@@ -199,11 +200,14 @@ def test_map_message_from_langchain_ai_with_agent_call(self) -> None:
199200 ]
200201
201202 def test_map_message_from_langchain_ai_with_mixed_calls (self ) -> None :
202- tool_call = LC_ToolCall (name = "lookup" , args = {"q" : "test" }, id = "tc-1" )
203+ tool_call = LC_ToolCall (
204+ name = "lookup" , args = {"q" : "test" }, id = "tc-1" , type = "tool_call"
205+ )
203206 agent_call = LC_ToolCall (
204207 name = f"{ lc .AGENT_PREFIX } assistant" ,
205208 args = {"args" : {"q" : "test" }, "thread_id" : None },
206209 id = "tc-2" ,
210+ type = "tool_call" ,
207211 )
208212 message = LC_AIMessage (content = "done" , tool_calls = [tool_call , agent_call ])
209213
@@ -280,7 +284,9 @@ def test_map_message_to_langchain_ai(self) -> None:
280284
281285 assert isinstance (mapped , LC_AIMessage )
282286 assert mapped .content == "hi"
283- assert mapped .tool_calls == [LC_ToolCall (name = "lookup" , args = {}, id = "tc-1" )]
287+ assert mapped .tool_calls == [
288+ LC_ToolCall (name = "lookup" , args = {}, id = "tc-1" , type = "tool_call" )
289+ ]
284290
285291 def test_map_message_to_langchain_ai_with_text_content_block (self ) -> None :
286292 extras = {
@@ -389,6 +395,7 @@ def test_map_message_to_langchain_ai_with_agent_call(self) -> None:
389395 name = f"{ lc .AGENT_PREFIX } assistant" ,
390396 args = {"args" : {"q" : "test" }, "thread_id" : None },
391397 id = "tc-2" ,
398+ type = "tool_call" ,
392399 )
393400 ]
394401
@@ -424,6 +431,7 @@ def test_map_message_to_langchain_ai_with_tool_call_with_thought_signature(
424431 name = f"__local-startup_time" ,
425432 args = {"q" : "test" },
426433 id = "tc-2" ,
434+ type = "tool_call" ,
427435 )
428436 ]
429437 assert mapped .additional_kwargs == extras
@@ -451,7 +459,9 @@ def test_map_message_to_langchain_tool_call_with_reserved_prefix(self) -> None:
451459 )
452460 assert isinstance (message , LC_AIMessage )
453461 assert message .tool_calls == [
454- LC_ToolCall (name = "__tool-__agent-bad-tool" , args = {}, id = "tc-1" )
462+ LC_ToolCall (
463+ name = "__tool-__agent-bad-tool" , args = {}, id = "tc-1" , type = "tool_call"
464+ )
455465 ]
456466
457467 message = lc ._map_message_to_langchain (
@@ -466,7 +476,7 @@ def test_map_message_to_langchain_tool_call_with_reserved_prefix(self) -> None:
466476 )
467477 assert isinstance (message , LC_AIMessage )
468478 assert message .tool_calls == [
469- LC_ToolCall (name = "__tool-__bad-tool" , args = {}, id = "tc-2" )
479+ LC_ToolCall (name = "__tool-__bad-tool" , args = {}, id = "tc-2" , type = "tool_call" )
470480 ]
471481
472482 message = lc ._map_message_to_langchain (
@@ -535,6 +545,7 @@ def test_map_message_to_langchain_agent_call_with_agent_prefix_raises(
535545 name = "__agent-__agent-bad-agent" ,
536546 args = {"args" : {}, "thread_id" : None },
537547 id = "tc-1" ,
548+ type = "tool_call" ,
538549 )
539550 ]
540551
0 commit comments