File size: 1,968 Bytes
31f0e50 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | """
Utils Layer - Helper functions and utilities.
This module provides:
- Text preprocessing utilities
- Input validation helpers
- Metrics and monitoring
- Logging configuration
- Groq API client with rate limiting
- GUVI hackathon integration callbacks
"""
from app.utils.preprocessing import (
clean_text,
normalize_text,
convert_devanagari_digits,
)
from app.utils.validation import (
validate_message,
validate_session_id,
validate_language,
)
from app.utils.metrics import (
track_detection,
track_extraction,
track_response_time,
)
from app.utils.logger import get_logger, setup_logging
from app.utils.groq_client import (
RateLimiter,
RateLimitError,
GroqAPIError,
GroqClient,
call_groq_with_retry,
get_groq_client,
reset_groq_client,
reset_rate_limiter,
get_rate_limit_status,
exponential_backoff,
is_retryable_error,
retry_with_backoff,
)
from app.utils.guvi_callback import (
send_final_result_to_guvi,
should_send_callback,
extract_suspicious_keywords,
generate_agent_notes,
)
__all__ = [
# Preprocessing
"clean_text",
"normalize_text",
"convert_devanagari_digits",
# Validation
"validate_message",
"validate_session_id",
"validate_language",
# Metrics
"track_detection",
"track_extraction",
"track_response_time",
# Logging
"get_logger",
"setup_logging",
# Groq Client
"RateLimiter",
"RateLimitError",
"GroqAPIError",
"GroqClient",
"call_groq_with_retry",
"get_groq_client",
"reset_groq_client",
"reset_rate_limiter",
"get_rate_limit_status",
"exponential_backoff",
"is_retryable_error",
"retry_with_backoff",
# GUVI Callback
"send_final_result_to_guvi",
"should_send_callback",
"extract_suspicious_keywords",
"generate_agent_notes",
]
|