From e4f3b7e0bf0535e0b2908797153e8c1727f7b639 Mon Sep 17 00:00:00 2001 From: Yazhou Cao Date: Mon, 11 Mar 2024 13:13:36 +0800 Subject: [PATCH] error handling --- vision_agent/tools/tools.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/vision_agent/tools/tools.py b/vision_agent/tools/tools.py index fc5013da..4d41871e 100644 --- a/vision_agent/tools/tools.py +++ b/vision_agent/tools/tools.py @@ -1,3 +1,4 @@ +import logging from abc import ABC, abstractmethod from pathlib import Path from typing import Any, Dict, List, Union, cast @@ -7,6 +8,8 @@ from vision_agent.image_utils import convert_to_b64 +_LOGGER = logging.getLogger(__name__) + class ImageTool(ABC): @abstractmethod @@ -56,8 +59,8 @@ def __call__(self, image: Union[str, Path, ImageType]) -> List[Dict]: json=data, ) resp_json: Dict[str, Any] = res.json() - # if resp_json["statusCode"] != 200: - # _LOGGER.error(f"Request failed: {resp_json['data']}") + if resp_json["statusCode"] != 200: + _LOGGER.error(f"Request failed: {resp_json['data']}") return cast(str, resp_json["data"])