From 28c1a4f700bf8a702643cfe4debbdbab43e78326 Mon Sep 17 00:00:00 2001 From: Braelyn Boynton Date: Fri, 29 Nov 2024 22:30:15 -0800 Subject: [PATCH] fixed parsing issue and better test error message --- agentstack/tools/neon.json | 2 +- agentstack/tools/tools.json | 0 tests/test_tool_config.py | 7 ++++++- 3 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 agentstack/tools/tools.json diff --git a/agentstack/tools/neon.json b/agentstack/tools/neon.json index b2b5f64..8fd13f6 100644 --- a/agentstack/tools/neon.json +++ b/agentstack/tools/neon.json @@ -8,4 +8,4 @@ }, "tools": ["create_database", "execute_sql_ddl", "run_sql_query"], "cta": "Create an API key at https://www.neon.tech" - } \ No newline at end of file +} \ No newline at end of file diff --git a/agentstack/tools/tools.json b/agentstack/tools/tools.json deleted file mode 100644 index e69de29..0000000 diff --git a/tests/test_tool_config.py b/tests/test_tool_config.py index 5371de4..90931c7 100644 --- a/tests/test_tool_config.py +++ b/tests/test_tool_config.py @@ -1,3 +1,4 @@ +import json import os, sys import unittest import importlib.resources @@ -41,6 +42,10 @@ def test_all_json_configs_from_tool_name(self): def test_all_json_configs_from_tool_path(self): for path in get_all_tool_paths(): - config = ToolConfig.from_json(path) + try: + config = ToolConfig.from_json(path) + except json.decoder.JSONDecodeError as e: + raise Exception(f"Failed to decode tool json at {path}. Does your tool config fit the required formatting? https://github.com/AgentOps-AI/AgentStack/blob/main/agentstack/tools/~README.md") + assert config.name == path.stem # We can assume that pydantic validation caught any other issues