mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-15 07:36:08 +00:00
add type hints to messages
This commit is contained in:
parent
5c9ce7fd2b
commit
c7c47f81c4
@ -323,8 +323,8 @@ class AIMessageChunk(AIMessage):
|
|||||||
"""Get the tool calls made by the AI."""
|
"""Get the tool calls made by the AI."""
|
||||||
if not self._tool_calls:
|
if not self._tool_calls:
|
||||||
parsed_content = _init_tool_calls(self.content)
|
parsed_content = _init_tool_calls(self.content)
|
||||||
tool_calls = []
|
tool_calls: list[types.ToolCall] = []
|
||||||
invalid_tool_calls = []
|
invalid_tool_calls: list[types.InvalidToolCall] = []
|
||||||
for block in parsed_content:
|
for block in parsed_content:
|
||||||
if types.is_tool_call_block(block):
|
if types.is_tool_call_block(block):
|
||||||
tool_calls.append(block)
|
tool_calls.append(block)
|
||||||
@ -344,8 +344,8 @@ class AIMessageChunk(AIMessage):
|
|||||||
"""Get the invalid tool calls made by the AI."""
|
"""Get the invalid tool calls made by the AI."""
|
||||||
if not self._invalid_tool_calls:
|
if not self._invalid_tool_calls:
|
||||||
parsed_content = _init_tool_calls(self.content)
|
parsed_content = _init_tool_calls(self.content)
|
||||||
tool_calls = []
|
tool_calls: list[types.ToolCall] = []
|
||||||
invalid_tool_calls = []
|
invalid_tool_calls: list[types.InvalidToolCall] = []
|
||||||
for block in parsed_content:
|
for block in parsed_content:
|
||||||
if types.is_tool_call_block(block):
|
if types.is_tool_call_block(block):
|
||||||
tool_calls.append(block)
|
tool_calls.append(block)
|
||||||
|
Loading…
Reference in New Issue
Block a user