# /*---------------------------------------------------------------------------------------------
# * Copyright (c) IRETBL Corporation. All rights reserved.
# * Licensed under the Apache-2.0. See License.txt in the project root for license information.
# *--------------------------------------------------------------------------------------------*/
"""
Constants, Enums, and Exception Classes for Search Tool
This module contains all the shared constants, enumeration types, and
custom exception classes used across the search tool package.
"""
from enum import Enum
# ============================================================================
# Enums
# ============================================================================
[docs]
class SearchType(str, Enum):
"""Supported search types"""
WEB = "web"
IMAGE = "image"
NEWS = "news"
VIDEO = "video"
[docs]
class SafeSearch(str, Enum):
"""Safe search levels"""
OFF = "off"
MEDIUM = "medium"
HIGH = "high"
[docs]
class ImageSize(str, Enum):
"""Image size filters"""
ICON = "icon"
SMALL = "small"
MEDIUM = "medium"
LARGE = "large"
XLARGE = "xlarge"
XXLARGE = "xxlarge"
HUGE = "huge"
[docs]
class ImageType(str, Enum):
"""Image type filters"""
CLIPART = "clipart"
FACE = "face"
LINEART = "lineart"
STOCK = "stock"
PHOTO = "photo"
ANIMATED = "animated"
[docs]
class ImageColorType(str, Enum):
"""Image color type filters"""
COLOR = "color"
GRAY = "gray"
MONO = "mono"
TRANS = "trans"
[docs]
class CircuitState(str, Enum):
"""Circuit breaker states"""
CLOSED = "closed"
OPEN = "open"
HALF_OPEN = "half_open"
[docs]
class QueryIntentType(str, Enum):
"""Query intent types"""
DEFINITION = "definition"
HOW_TO = "how_to"
COMPARISON = "comparison"
FACTUAL = "factual"
RECENT_NEWS = "recent_news"
ACADEMIC = "academic"
PRODUCT = "product"
GENERAL = "general"
[docs]
class CredibilityLevel(str, Enum):
"""Result credibility levels"""
HIGH = "high"
MEDIUM = "medium"
LOW = "low"
# ============================================================================
# Exception Hierarchy
# ============================================================================
[docs]
class AuthenticationError(SearchToolError):
"""Authentication-related errors"""
[docs]
class QuotaExceededError(SearchToolError):
"""API quota exceeded"""
[docs]
class RateLimitError(SearchToolError):
"""Rate limit exceeded"""
[docs]
class CircuitBreakerOpenError(SearchToolError):
"""Circuit breaker is open"""
[docs]
class SearchAPIError(SearchToolError):
"""Search API errors"""
[docs]
class ValidationError(SearchToolError):
"""Input validation errors"""
[docs]
class CacheError(SearchToolError):
"""Cache-related errors"""