Build and run agents you can see, understand and trust.
Python agentchatbotlarge-language-modelsllmllm-agentmcpmulti-agentmulti-modalreact-agentrealtime-agentvoice-agentvoice-assistant
fix(tool): respect empty model input types (#2857)
WuWenbo92d4837ec512
diff --git a/src/agentscope/tool/_builtin/_read.py b/src/agentscope/tool/_builtin/_read.pyindex f6167ad73..72f023430 100644--- a/src/agentscope/tool/_builtin/_read.py+++ b/src/agentscope/tool/_builtin/_read.py@@ -166,7 +166,9 @@ Usage:super().__init__(middlewares=middlewares)self._max_line_characters = max_line_charactersself.model_input_types = (- model_input_types or _DEFAULT_MODEL_INPUT_TYPES+ _DEFAULT_MODEL_INPUT_TYPES+ if model_input_types is None+ else model_input_types)"""The media types the model accepts as input, see ``__init__``."""self._backend = backend or LocalBackend()diff --git a/tests/builtin_read_test.py b/tests/builtin_read_test.pyindex c729aa610..617d84ba9 100644--- a/tests/builtin_read_test.py+++ b/tests/builtin_read_test.py@@ -324,6 +324,18 @@ class ReadToolTest(IsolatedAsyncioTestCase):},)+ # An explicit empty list means the model accepts no native media.+ tool = Read(model_input_types=[])+ self.assertListEqual(tool.model_input_types, [])+ self.assertNotIn("read images", tool.description)+ chunk = await tool(file_path=f.name)+ self.assertEqual(chunk.state, "error")+ self.assertEqual(+ chunk.content[0].text,+ "Error: Unsupported image type image/bmp, only none are "+ "supported.",+ )+# Model card style input types (non-image entries ignored) and glob# patterns are accepted.for model_input_types in [["text/plain", "image/bmp"], ["image/*"]]: