From d8cc3e45fba5dcc3267aaf233da9843f2ba6db0a Mon Sep 17 00:00:00 2001 From: Sarah Wooders Date: Wed, 6 Nov 2024 22:29:01 -0800 Subject: [PATCH] fix: remove noisy warning from tool rule solver (#2003) --- letta/helpers/tool_rule_solver.py | 3 +-- tests/test_tool_rule_solver.py | 15 +++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/letta/helpers/tool_rule_solver.py b/letta/helpers/tool_rule_solver.py index aafaa745b4..4c50686c38 100644 --- a/letta/helpers/tool_rule_solver.py +++ b/letta/helpers/tool_rule_solver.py @@ -1,4 +1,3 @@ -import warnings from typing import Dict, List, Optional, Set from pydantic import BaseModel, Field @@ -67,7 +66,7 @@ def get_allowed_tool_names(self, error_on_empty: bool = False) -> List[str]: if error_on_empty: raise RuntimeError(message) else: - warnings.warn(message) + # warnings.warn(message) return [] def is_terminal_tool(self, tool_name: str) -> bool: diff --git a/tests/test_tool_rule_solver.py b/tests/test_tool_rule_solver.py index c570ab6d56..1347811933 100644 --- a/tests/test_tool_rule_solver.py +++ b/tests/test_tool_rule_solver.py @@ -1,5 +1,3 @@ -import warnings - import pytest from letta.helpers import ToolRulesSolver @@ -62,13 +60,14 @@ def test_get_allowed_tool_names_no_matching_rule_warning(): # Action: Set last tool to an unrecognized tool and check warnings solver.update_tool_usage(UNRECOGNIZED_TOOL) - with warnings.catch_warnings(record=True) as w: - allowed_tools = solver.get_allowed_tool_names() + # NOTE: removed for now since this warning is getting triggered on every LLM call + # with warnings.catch_warnings(record=True) as w: + # allowed_tools = solver.get_allowed_tool_names() - # Assert: Expecting a warning and an empty list of allowed tools - assert len(w) == 1, "Expected a warning for no matching rule" - assert "resolved to no more possible tool calls" in str(w[-1].message) - assert allowed_tools == [], "Should return an empty list if no matching rule" + # # Assert: Expecting a warning and an empty list of allowed tools + # assert len(w) == 1, "Expected a warning for no matching rule" + # assert "resolved to no more possible tool calls" in str(w[-1].message) + # assert allowed_tools == [], "Should return an empty list if no matching rule" def test_get_allowed_tool_names_no_matching_rule_error():