Ë
    uPêjú  ã                   ón   — U d dl mZ d dlmZmZmZ d dlmZ d dlm	Z	 d dl
mZ dZeed<    G d„ d	e	«      Zy
)é    )ÚFinal)Úparse_qsÚurlparseÚ
urlunparse)ÚBaseAzureLLM)ÚOpenAIContainerConfig)ÚGenericLiteLLMParams)z/openai/responsesÚ_AZURE_ENDPOINT_PATHSc                   ó”   — e Zd ZdZ	 ddededz  defd„Zededz  dedz  fd„«       Zededz  dedz  fd	„«       Z	dedz  d
edefd„Z
y)ÚAzureContainerConfigaŸ  
    Configuration class for Azure OpenAI container API.

    Inherits request/response transformations from OpenAIContainerConfig since
    Azure's container API is wire-compatible with OpenAI's. Only overrides
    authentication (api-key header) and URL construction (openai/v1/containers path).

    Azure container API reference:
    https://learn.microsoft.com/en-us/azure/foundry/openai/latest#containers
    NÚheadersÚapi_keyÚreturnc                 óD   — t        j                  |t        |¬«      ¬«      S )N)r   )r   Úlitellm_params)r   Ú _base_validate_azure_environmentr	   )Úselfr   r   s      úq/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/llms/azure/containers/transformation.pyÚvalidate_environmentz)AzureContainerConfig.validate_environment   s"   € ô
 ×<Ñ<ØÜ/¸Ô@ô
ð 	
ó    Úapi_basec           
      óú   — | s| S t        | «      }|j                  j                  d«      }t        D ]G  }|j	                  |«      sŒt        |j                  |j                  |dt        |«        dddf«      c S  | S )zMStrip endpoint-specific path suffixes from api_base to get the resource root.ú/NÚ )	r   ÚpathÚrstripr
   Úendswithr   ÚschemeÚnetlocÚlen)r   Úparsedr   Úeps       r   Ú_normalize_api_basez(AzureContainerConfig._normalize_api_base%   s~   € ñ ØˆOÜ  Ó*ˆØ—k‘k×(Ñ(¨Ó-ˆÜ'ò 	`ˆBØ�}‰}˜RÕ Ü! 6§=¡=°&·-±-ÀÀjÌÈRËÈÐAQÐSUÐWYÐ[]Ð"^Ó_Ò_ð	`ð ˆr   c                 ól   — | syt        t        | «      j                  «      j                  ddg«      d   S )z<Return the api-version query param from api_base if present.Nzapi-versionr   )r   r   ÚqueryÚget)r   s    r   Ú_extract_api_versionz)AzureContainerConfig._extract_api_version1   s4   € ñ ØÜœ Ó*×0Ñ0Ó1×5Ñ5°mÀdÀVÓLÈQÑOÐOr   r   c                 ó˜   — t        |«      }| j                  |«      }|r||d<   t        j                  | j	                  |«      |dd¬«      S )a  
        Build the Azure container endpoint URL.

        Azure container API uses the path:
          {endpoint}/openai/v1/containers
        when api_version is 'v1', 'latest', or 'preview'; otherwise:
          {endpoint}/openai/containers

        The deployment's api_base may be the responses endpoint URL
        (e.g. .../openai/responses?api-version=2025-04-01-preview). We
        prefer the api-version embedded there over the deployment's
        api_version field, which may point to an older chat API version.
        Úapi_versionz/openai/containersÚv1)r   r   ÚrouteÚdefault_api_version)Údictr'   r   Ú_get_base_azure_urlr#   )r   r   r   Úeffective_paramsÚapi_version_from_bases        r   Úget_complete_urlz%AzureContainerConfig.get_complete_url8   sX   € ô$ #' ~Ó"6ÐØ'+×'@Ñ'@ÀÓ'JÐÙ Ø.CÐ˜]Ñ+Ü×/Ñ/Ø×-Ñ-¨hÓ7Ø+Ø&Ø $ô	
ð 	
r   )N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r-   Ústrr   Ústaticmethodr#   r'   r1   © r   r   r   r      s®   „ ñ	ð #ñ
àð
ð �t‘ð
ð 
ó	
ð ð	 c¨D¡jð 	°S¸4±Zò 	ó ð	ð ðP s¨T¡zð P°c¸D±jò Pó ðPð
à˜‘*ð
ð ð
ð 
ô	
r   r   N)Útypingr   Úurllib.parser   r   r   Úlitellm.llms.azure.common_utilsr   Ú-litellm.llms.openai.containers.transformationr   Úlitellm.types.routerr	   r
   Ú__annotations__r   r8   r   r   ú<module>r?      s3   ðÞ ß 7Ñ 7å 8Ý OÝ 5ð  6Ð �uÓ 5ôD
Ð0õ D
r   