Skip to content

Commit

Permalink
fix: remove noisy warning from tool rule solver (#2003)
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahwooders authored Nov 7, 2024
1 parent b7b7b51 commit d8cc3e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
3 changes: 1 addition & 2 deletions letta/helpers/tool_rule_solver.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import warnings
from typing import Dict, List, Optional, Set

from pydantic import BaseModel, Field
Expand Down Expand Up @@ -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:
Expand Down
15 changes: 7 additions & 8 deletions tests/test_tool_rule_solver.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

import pytest

from letta.helpers import ToolRulesSolver
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit d8cc3e4

Please sign in to comment.