Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
AsiaCao committed Mar 11, 2024
1 parent 0c9d74b commit e4f3b7e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions vision_agent/tools/tools.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import logging
from abc import ABC, abstractmethod
from pathlib import Path
from typing import Any, Dict, List, Union, cast
Expand All @@ -7,6 +8,8 @@

from vision_agent.image_utils import convert_to_b64

_LOGGER = logging.getLogger(__name__)


class ImageTool(ABC):
@abstractmethod
Expand Down Expand Up @@ -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"])


Expand Down

0 comments on commit e4f3b7e

Please sign in to comment.