
    )`i                     n    d dl mZ d dlmZ ddlmZmZ ddlmZ ddl	m
Z
 ded	ee         fd
Zd	efdZdS )    )Optional)	APIRouter   )RouteConfigcreate_router)logger   )get_lora_route_confighandler_typereturnc                     | dk    rt          ddddgd          S | dk    rt          d	d
ddgd          S t          |           S )aL  Get route configuration for SageMaker handler types.

    This resolver handles both core SageMaker routes (/ping, /invocations) and
    LoRA-specific routes (/adapters, etc.). It serves as a unified entry point
    for all SageMaker routing configuration.

    Args:
        handler_type: The handler type identifier (e.g., 'ping', 'invoke',
                     'register_adapter', 'unregister_adapter')

    Returns:
        RouteConfig: The route configuration if the handler type has a route
        None: If the handler type doesn't have a route (e.g., transform-only handlers)
    pingz/pingGEThealth	sagemakerzHealth check endpoint)pathmethodtagssummaryinvokez/invocationsPOST	inferencezModel inference endpoint)r   r
   )r   s    /home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/model_hosting_container_standards/sagemaker/sagemaker_router.pyget_sagemaker_route_configr      s|      vK(+	
 
 
 	
 
	!	!{+.	
 
 
 	
 !...    c                      t          j        d           t          t          dg          } t          j        dt	          | j                   d           | S )a  Create a FastAPI router with all registered SageMaker handlers mounted.

    This convenience function creates an APIRouter and automatically mounts all
    registered SageMaker handlers using the unified route resolver. It provides
    a complete SageMaker-compatible routing solution out of the box.

    Supported Routes:
        - Core SageMaker endpoints: /ping (health check), /invocations (inference)
        - LoRA adapter management: /adapters (list/register), /adapters/{name} (unregister)
        - Any additional SageMaker-specific routes registered via decorators

    The router uses a unified route resolver that handles both core SageMaker
    routes and LoRA-specific routes, providing a single entry point for all
    SageMaker routing configuration.

    Alternative Usage:
        For more control over router configuration or to mount handlers to an
        existing router, use the generic mount_handlers function:

        ```python
        from model_hosting_container_standards.common.fastapi.routing import mount_handlers
        from model_hosting_container_standards.sagemaker.sagemaker_router import get_sagemaker_route_config

        # Mount to existing router
        mount_handlers(my_router, route_resolver=get_sagemaker_route_config)
        ```

    Returns:
        APIRouter: Configured router with SageMaker handlers mounted and tagged
                  with ["sagemaker"] for OpenAPI documentation

    Example:
        ```python
        from fastapi import FastAPI
        from model_hosting_container_standards.sagemaker import create_sagemaker_router

        app = FastAPI()
        sagemaker_router = create_sagemaker_router()
        app.include_router(sagemaker_router)
        ```
    z5Creating SageMaker router with unified route resolverr   )route_resolverr   z+SageMaker router created successfully with z routes)r   infor   r   lenroutes)routers    r   create_sagemaker_routerr"   1   si    T KGHHH 1]  F
 KQc&-6H6HQQQ   Mr   N)typingr   fastapir   common.fastapi.routingr   r   logging_configr   lora.routesr
   strr   r"    r   r   <module>r*      s                @ ? ? ? ? ? ? ? # # # # # # / . . . . . /S  /Xk5J  /  /  /  /H5 5 5 5 5 5 5r   