Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

fix: check for tool call in message object (#1573)

Sarah Wooders4d758a307368
diff --git a/memgpt/llm_api/llm_api_tools.py b/memgpt/llm_api/llm_api_tools.py
index 7e98c54f7..7cf8b6dcc 100644
--- a/memgpt/llm_api/llm_api_tools.py
+++ b/memgpt/llm_api/llm_api_tools.py
@@ -93,7 +93,7 @@ def unpack_inner_thoughts_from_kwargs(
new_choices = []
for choice in response.choices:
msg = choice.message
- if msg.role == "assistant" and len(msg.tool_calls) >= 1:
+ if msg.role == "assistant" and msg.tool_calls and len(msg.tool_calls) >= 1:
if len(msg.tool_calls) > 1:
warnings.warn(f"Unpacking inner thoughts from more than one tool call ({len(msg.tool_calls)}) is not supported")
# TODO support multiple tool calls