Spaces:
Sleeping
Sleeping
| """ | |
| Application constants and enums | |
| """ | |
| from enum import Enum | |
| class ProductCategory(str, Enum): | |
| """Product categories""" | |
| ELECTRONICS = "electronics" | |
| FOOD = "food" | |
| SPORTS = "sports" | |
| FASHION = "fashion" | |
| HOME = "home" | |
| GENERAL = "general" | |
| class ListingStyle(str, Enum): | |
| """Product listing styles""" | |
| LUXURY = "luxury" | |
| BUDGET = "budget" | |
| PROFESSIONAL = "professional" | |
| CASUAL = "casual" | |
| class SearchType(str, Enum): | |
| """Search types""" | |
| ALL = "all" | |
| PRODUCTS = "products" | |
| DOCUMENTATION = "documentation" | |
| class ResponseStatus(str, Enum): | |
| """Response status codes""" | |
| SUCCESS = "success" | |
| ERROR = "error" | |
| PARTIAL = "partial" | |
| class ErrorCode(str, Enum): | |
| """Error codes""" | |
| INVALID_INPUT = "INVALID_INPUT" | |
| VALIDATION_ERROR = "VALIDATION_ERROR" | |
| API_ERROR = "API_ERROR" | |
| NOT_FOUND = "NOT_FOUND" | |
| SERVER_ERROR = "SERVER_ERROR" | |
| TIMEOUT = "TIMEOUT" | |
| UNKNOWN_ERROR = "UNKNOWN_ERROR" | |
| # Tool names | |
| TOOL_ANALYZE_PRODUCT = "analyze_product" | |
| TOOL_ANALYZE_REVIEWS = "analyze_reviews" | |
| TOOL_GENERATE_LISTING = "generate_listing" | |
| TOOL_PRICE_RECOMMENDATION = "price_recommendation" | |
| TOOL_COMPETITOR_ANALYSIS = "competitor_analysis" | |
| TOOL_KNOWLEDGE_SEARCH = "knowledge_search" | |
| TOOL_PRODUCT_QUERY = "product_query" | |
| AVAILABLE_TOOLS = { | |
| TOOL_ANALYZE_PRODUCT, | |
| TOOL_ANALYZE_REVIEWS, | |
| TOOL_GENERATE_LISTING, | |
| TOOL_PRICE_RECOMMENDATION, | |
| TOOL_COMPETITOR_ANALYSIS, | |
| TOOL_KNOWLEDGE_SEARCH, | |
| TOOL_PRODUCT_QUERY, | |
| } | |
| # MCP Protocol | |
| MCP_VERSION = "2024-11-05" | |
| MCP_METHOD_INITIALIZE = "initialize" | |
| MCP_METHOD_LIST_TOOLS = "tools/list" | |
| MCP_METHOD_CALL_TOOL = "tools/call" | |
| # Default values | |
| DEFAULT_TOP_K = 5 | |
| DEFAULT_CHUNK_SIZE = 1024 | |
| DEFAULT_TEMPERATURE = 0.7 | |
| DEFAULT_PRODUCT_CATEGORY = "general" | |
| # Validation constraints | |
| MIN_QUERY_LENGTH = 1 | |
| MAX_QUERY_LENGTH = 500 | |
| MIN_REVIEW_LENGTH = 5 | |
| MAX_REVIEW_LENGTH = 5000 | |
| MIN_PRODUCT_NAME_LENGTH = 1 | |
| MAX_PRODUCT_NAME_LENGTH = 200 | |
| MIN_COST = 0.01 | |
| MAX_MARGIN = 500 | |
| # HTTP settings | |
| HTTP_TIMEOUT = 60.0 | |
| HTTP_RETRIES = 3 | |
| # Logging | |
| LOG_FORMAT = "%(asctime)s - %(name)s - %(levelname)s - %(message)s" | |