o
    ưi                     @   s   d Z ddlmZmZ ddlmZ ddlZddlmZ dZ	de	 Z
de	 Zd	Zd
ZG dd deZG dd deZG dd deZG dd deZG dd deZG dd deZdedefddZdS )z#
Constants for Copilot integration
    )OptionalUnion)uuid4N)BaseLLMExceptionz0.26.7zcopilot-chat/zGitHubCopilotChat/z
2025-04-01zhttps://api.githubcopilot.comc                
       sV   e Zd Z				ddeej deej deeeje	f  dee	 f fddZ
  ZS )	GithubCopilotErrorNrequestresponseheadersbodyc                    s   t  j||||||d d S )N)status_codemessager   r   r	   r
   )super__init__)selfr   r   r   r   r	   r
   	__class__ _/home/app/Keep/.python/lib/python3.10/site-packages/litellm/llms/github_copilot/common_utils.pyr      s   	
zGithubCopilotError.__init__)NNNN)__name__
__module____qualname__r   httpxRequestResponser   ZHeadersdictr   __classcell__r   r   r   r   r      s    r   c                   @      e Zd ZdS )GetDeviceCodeErrorNr   r   r   r   r   r   r   r   &       r   c                   @   r   )GetAccessTokenErrorNr   r   r   r   r   r    *   r   r    c                   @   r   )APIKeyExpiredErrorNr   r   r   r   r   r!   .   r   r!   c                   @   r   )RefreshAPIKeyErrorNr   r   r   r   r   r"   2   r   r"   c                   @   r   )GetAPIKeyErrorNr   r   r   r   r   r#   6   r   r#   api_keyreturnc                 C   s&   d|  dddt tdttt dd
S )zq
    Get default headers for GitHub Copilot Responses API.

    Based on copilot-api's header configuration.
    zBearer zapplication/jsonzvscode-chatzvscode/1.95.0zconversation-panelzelectron-fetch)
Authorizationzcontent-typezcopilot-integration-idzeditor-versionzeditor-plugin-versionz
user-agentzopenai-intentzx-github-api-versionzx-request-idz#x-vscode-user-agent-library-version)EDITOR_PLUGIN_VERSION
USER_AGENTAPI_VERSIONstrr   )r$   r   r   r   get_copilot_default_headers:   s   r+   )__doc__typingr   r   uuidr   r   Z)litellm.llms.base_llm.chat.transformationr   ZCOPILOT_VERSIONr'   r(   r)   ZGITHUB_COPILOT_API_BASEr   r   r    r!   r"   r#   r*   r   r+   r   r   r   r   <module>   s"    

