Skip to content

Commit 554a4bc

Browse files
committed
Explicitly set type in every LC_ToolCall
1 parent 140d162 commit 554a4bc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

splunklib/ai/engines/langchain.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ def unpack_tool_call(self, call: LC_ToolCall) -> LC_ToolCall:
485485
id=call["id"],
486486
name=call["name"],
487487
args=unpacked_args,
488+
type="tool_call",
488489
)
489490

490491
return call
@@ -1142,6 +1143,7 @@ def _convert_model_response_to_model_result(
11421143
id=call.id,
11431144
name=f"{TOOL_STRATEGY_TOOL_PREFIX}{call.name}",
11441145
args=call.args,
1146+
type="tool_call",
11451147
)
11461148
for call in resp.message.structured_output_calls
11471149
)
@@ -1646,7 +1648,7 @@ def _map_tool_call_to_langchain(call: ToolCall | SubagentCall) -> LC_ToolCall:
16461648
name = _normalize_tool_name(call.name, call.type)
16471649
args = call.args
16481650

1649-
return LC_ToolCall(id=call.id, name=name, args=args)
1651+
return LC_ToolCall(id=call.id, name=name, args=args, type="tool_call")
16501652

16511653

16521654
def _map_content_from_langchain(
@@ -1754,6 +1756,7 @@ def _map_message_to_langchain(message: BaseMessage) -> LC_AnyMessage:
17541756
id=call.id,
17551757
name=f"{TOOL_STRATEGY_TOOL_PREFIX}{call.name}",
17561758
args=call.args,
1759+
type="tool_call",
17571760
)
17581761
for call in message.structured_output_calls
17591762
)

0 commit comments

Comments
 (0)