Spaces:
Sleeping
Sleeping
Download src/utils/__init__.py from utkarsh134/FastAPI-HackathonIn2Mins: direct link, hf CLI and curl.
- Browser
- Download file 2.36 kB
-
https://huggingface.co/spaces/utkarsh134/FastAPI-HackathonIn2Mins/resolve/main/src/utils/__init__.py
- Command line
-
hf download hf://spaces/utkarsh134/FastAPI-HackathonIn2Mins/src/utils/__init__.py
-
curl -L -o __init__.py https://huggingface.co/spaces/utkarsh134/FastAPI-HackathonIn2Mins/resolve/main/src/utils/__init__.py
2.36 kB
| # Core utilities | |
| from .core import get_llm, llm | |
| # Handlers and utility classes | |
| from .date_handler import DateHandler | |
| from .database import DatabaseHandler | |
| # LLM inference utilities | |
| from .llm_utils import ( | |
| infer_purpose, | |
| infer_yes_no, | |
| infer_user_uncertainty, | |
| infer_drill_type, | |
| infer_subcategory, | |
| infer_eligibility | |
| ) | |
| # Partner-related utilities | |
| from .partner_utils import ( | |
| extract_partner_info, | |
| get_existing_partner, | |
| register_partner, | |
| validate_partner_url, | |
| find_partner_by_url | |
| ) | |
| # Content generation utilities | |
| from .content_generation import ( | |
| generate_drill_description, | |
| generate_drill_overview_description, | |
| generate_random_event_names, | |
| generate_faq_answers, | |
| create_naming_assistant | |
| ) | |
| # API and database utilities | |
| from .api_utils import ( | |
| prepare_api_payload, | |
| register_event, | |
| process_eligibility_data, | |
| create_event_overview, | |
| create_event_faqs | |
| ) | |
| from .database_utils import save_to_database | |
| # Backwards compatibility function | |
| def check_for_cancellation(user_response: str, llm=None) -> bool: | |
| """Use LLM to infer if the user wants to cancel the registration process.""" | |
| if llm is None: | |
| from .core import llm | |
| user_response = user_response.lower() | |
| cancel_keywords = ['cancel', 'stop', 'quit', 'exit', 'abort', 'terminate', 'end', | |
| 'don\'t want to proceed', 'don\'t want to continue'] | |
| return any(keyword in user_response for keyword in cancel_keywords) | |
| __all__ = [ | |
| # Core utilities | |
| "get_llm", | |
| "llm", | |
| # Handlers | |
| "DateHandler", | |
| "DatabaseHandler", | |
| "infer_subcategory", | |
| "infer_purpose", | |
| "infer_yes_no", | |
| "infer_user_uncertainty", | |
| "infer_drill_type", | |
| "infer_eligibility", | |
| "extract_partner_info", | |
| "get_existing_partner", | |
| "register_partner", | |
| "validate_partner_url", | |
| "find_partner_by_url", | |
| "generate_drill_description", | |
| "generate_drill_overview_description", | |
| "generate_random_event_names", | |
| "generate_faq_answers", | |
| "create_naming_assistant", | |
| # API utilities | |
| "prepare_api_payload", | |
| "register_event", | |
| "process_eligibility_data", | |
| "create_event_overview", | |
| "create_event_faqs", | |
| # Database utilities | |
| "save_to_database", | |
| # Backwards compatibility | |
| "check_for_cancellation" | |
| ] |