mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-13 05:25:07 +00:00
core[patch]: fix ToolCall "type" when streaming (#24218)
This commit is contained in:
@@ -48,6 +48,7 @@ from langchain_core.messages import (
|
||||
ToolMessage,
|
||||
)
|
||||
from langchain_core.messages.tool import ToolCall
|
||||
from langchain_core.messages.tool import tool_call as create_tool_call
|
||||
from langchain_core.outputs import (
|
||||
ChatGeneration,
|
||||
ChatGenerationChunk,
|
||||
@@ -96,7 +97,7 @@ def _parse_tool_calling(tool_call: dict) -> ToolCall:
|
||||
name = tool_call["function"].get("name", "")
|
||||
args = json.loads(tool_call["function"]["arguments"])
|
||||
id = tool_call.get("id")
|
||||
return ToolCall(name=name, args=args, id=id)
|
||||
return create_tool_call(name=name, args=args, id=id)
|
||||
|
||||
|
||||
def _convert_to_tool_calling(tool_call: ToolCall) -> Dict[str, Any]:
|
||||
|
Reference in New Issue
Block a user