
    _j.                    r   % S SK Jr  S SKrS SKrS SKJr  SSKJ	r	  SSK
JrJrJrJrJrJrJrJr  SSKJr  SSKJrJrJrJrJrJrJrJrJr  SS	KJr  SS
K J!r!J"r"  SSK#J$r$J%r%  SSK&J'r'J(r(J)r)  SSK*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6J7r7J8r8J9r9J:r:J;r;J<r<J=r=J>r>  SSK?J@r@JArAJBrB  SSKCJDrE  SSKFJGrG  SSKHJIrIJJrJ  / SQrK\R                  (       d  SSKMJNrN  SSKOJPrQJRrR  SSKSJTrT  SSKUJVrVJWrW  SSKX7  SSKYJZrZJ[r[  \E" 5         \\" 5       r]\K H&  r^\^R                  S5      (       a  M   S\]\^   l`        M(     S SKrS SKrcS SKdreSSK?J'r'J(r(  SqfS\gS'   SqhS\gS'   SqiS\gS'   SqjS\gS '   SqkS\gS!'   SrlS"\gS#'   \'qmS$\gS%'   \(qnS&\gS''   SqoS(\gS)'   SqpS*\gS+'   SqqS,\gS-'   \cR                  S.   rs\R                  " \s\R                  R                  S/5      5      qwS0\gS1'   \R                  R                  S25      qxS\gS3'   \R                  R                  S45      qyS\gS5'   \R                  R                  S65      qzS\gS7'   Sr{S8\gS9'    " S: S;\5      r| " S< S=\|\V5      r} " S> S?\-5      r~SHS@ jrSHSA jrSHSB jrSqSC\gSD'   SISE jrSJSF jrSSGKJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJrJr  g! \a\b4 a     GM  f = f)K    )annotationsN)override   )types)	NOT_GIVENOmitNoneTypeNotGiven	TransportProxiesTypesomit	not_given)file_from_path)	ClientOpenAIStreamTimeoutr   AsyncClientAsyncOpenAIAsyncStreamRequestOptions)	BaseModel)	__title____version__)APIResponseAsyncAPIResponse)DEFAULT_TIMEOUTDEFAULT_MAX_RETRIESDEFAULT_CONNECTION_LIMITS)APIError
OAuthErrorOpenAIErrorConflictErrorNotFoundErrorAPIStatusErrorRateLimitErrorAPITimeoutErrorBadRequestErrorAPIConnectionErrorAuthenticationErrorInternalServerErrorPermissionDeniedErrorLengthFinishReasonErrorWebSocketQueueFullErrorUnprocessableEntityErrorAPIResponseValidationErrorInvalidWebhookSignatureErrorContentFilterFinishReasonErrorWebSocketConnectionClosedError)DefaultHttpxClientDefaultAioHttpClientDefaultAsyncHttpxClient)setup_logging)HttpxBinaryResponseContent)ReconnectingEventReconnectingOverrides)1r   r   r   r	   r   r   r
   r   r   r   r   r"   r    r%   r'   r)   r0   r(   r*   r!   r,   r$   r#   r/   r&   r+   r-   r2   r1   r   r   r   r   r   r   r   r   r   r   r   r   r   r4   r6   r5   r9   r:   r.   r3   )	resources)azurepydantic_function_tool)VERSION)AzureOpenAIAsyncAzureOpenAI)*)AssistantEventHandlerAsyncAssistantEventHandler__openai)r   r   
str | Noneapi_keyadmin_api_keyorganizationprojectwebhook_secretzstr | _httpx.URL | Nonebase_urlfloat | Timeout | Nonetimeoutintmax_retries_t.Mapping[str, str] | Nonedefault_headers_t.Mapping[str, object] | Nonedefault_queryz_httpx.Client | Nonehttp_client)rE   r<   OPENAI_API_TYPEz_ApiType | Noneapi_typeOPENAI_API_VERSIONapi_versionAZURE_OPENAI_ENDPOINTazure_endpointAZURE_OPENAI_AD_TOKENazure_ad_tokenz"_azure.AzureADTokenProvider | Noneazure_ad_token_providerc                  0  ^  \ rS rSr\\SS j5       5       r\R                  SS j5       r\\SS j5       5       r\R                  SS j5       r\\SS j5       5       r	\	R                  SS j5       r	\\SS j5       5       r
\
R                  SS	 j5       r
\\SS
 j5       5       r\R                  SS j5       r\\SU 4S jj5       5       r\R                  SU 4S jj5       r\\SS j5       5       r\R                  SS j5       r\\SS j5       5       r\R                  S S j5       r\\S!S j5       5       r\R                  S"S j5       r\\S#S j5       5       r\R                  S$S j5       r\\S%U 4S jj5       5       r\R                  S&S j5       rSrU =r$ )'_ModuleClient   c                    [         $ NrG   selfs    D/home/rurouni/.local/lib/python3.13/site-packages/openai/__init__.pyrG   _ModuleClient.api_key   	         c                    Uq g rc   rd   rf   values     rg   rG   rh      	     rj   c                    [         $ rc   rH   re   s    rg   rH   _ModuleClient.admin_api_key   
     rj   c                    Uq g rc   rp   rl   s     rg   rH   rq      	     rj   c                    [         $ rc   rI   re   s    rg   rI   _ModuleClient.organization   s
     rj   c                    Uq g rc   rv   rl   s     rg   rI   rw      s	     rj   c                    [         $ rc   rJ   re   s    rg   rJ   _ModuleClient.project   ri   rj   c                    Uq g rc   rz   rl   s     rg   rJ   r{      rn   rj   c                    [         $ rc   rK   re   s    rg   rK   _ModuleClient.webhook_secret   s
     rj   c                    Uq g rc   r~   rl   s     rg   rK   r      s	     rj   c                Z   > [         b  [        R                  " [         5      $ [        TU ]   $ rc   )rL   _httpxURLsuperrf   	__class__s    rg   rL   _ModuleClient.base_url   s%     ::h''wrj   c                $   > U[        5       l        g rc   )r   rL   )rf   urlr   s     rg   rL   r      s    rj   c                    [         $ rc   rN   re   s    rg   rN   _ModuleClient.timeout   ri   rj   c                    Uq g rc   r   rl   s     rg   rN   r      rn   rj   c                    [         $ rc   rP   re   s    rg   rP   _ModuleClient.max_retries   s
     rj   c                    Uq g rc   r   rl   s     rg   rP   r      	     rj   c                    [         $ rc   rR   re   s    rg   _custom_headers_ModuleClient._custom_headers  s
     rj   c                    Uq g rc   r   rl   s     rg   r   r     s	      rj   c                    [         $ rc   rT   re   s    rg   _custom_query_ModuleClient._custom_query  rr   rj   c                    Uq g rc   r   rl   s     rg   r   r     rt   rj   c                2   > [         =(       d
    [        TU ]  $ rc   )rU   r   _clientr   s    rg   r   _ModuleClient._client  s     -ego-rj   c                    Uq g rc   )rU   rl   s     rg   r   r     r   rj    )returnrF   )rm   rF   r   None)r   z
_httpx.URL)r   z_httpx.URL | strr   r   )r   rM   )rm   rM   r   r   )r   rO   )rm   rO   r   r   )r   rQ   )rm   rQ   r   r   )r   rS   )rm   rS   r   r   )r   _httpx.Client)rm   r   r   r   )__name__
__module____qualname____firstlineno__propertyr   rG   setterrH   rI   rJ   rK   rL   rN   rP   r   r   r   __static_attributes____classcell__r   s   @rg   r`   r`      sK       ^^ 
     
     
    ^^ 
     
      __     ^^ 
     
       
     
 .  . ^^ rj   r`   c                      \ rS rSrSrg)_AzureModuleClienti%  r   N)r   r   r   r   r   r   rj   rg   r   r   %  s    rj   r   c                  ,   ^  \ rS rSrSU 4S jjrSrU =r$ ) _AmbiguousModuleClientUsageErrori)  c                $   > [         TU ]  S5        g )NzAmbiguous use of module client; please set `openai.api_type` or the `OPENAI_API_TYPE` environment variable to `openai` or `azure`)r   __init__r   s    rg   r   )_AmbiguousModuleClientUsageError.__init__*  s     P	
rj   r   r   r   )r   r   r   r   r   r   r   r   s   @rg   r   r   )  s    
 
rj   r   c                 D    [         R                  R                  S5      S L$ )NOPENAI_API_KEY)_osenvirongetr   rj   rg   _has_openai_credentialsr   0  s    ;;??+,D88rj   c                 b    [         S L=(       d!    [        R                  R                  S5      S L$ )NAZURE_OPENAI_API_KEY)r[   r   r   r   r   rj   rg   _has_azure_credentialsr   4  s&    %\9O)PX\)\\rj   c                     [         R                  R                  S5      S L=(       d    [        S L=(       d    [        S L$ )Nr\   )r   r   r   r]   r^   r   rj   rg   _has_azure_ad_credentialsr   8  s7    /0< 	/%	/"$.rj   zOpenAI | Noner   c                 V   [         Gc  [        c  [        R                  R	                  S5      q[
        c  [        R                  R	                  S5      q[        c  [        R                  R	                  S5      q[        c  [        5       n [        5       n[        5       nU (       a  U(       d  U(       a
  [        5       e[
        c  [        b+  [        R                  R	                  S5       b
  [        5       eU(       d  U(       a  SqOSq[        S:X  aJ  [        [        [        [        [
        [        [        [         ["        [$        [&        [(        [*        S9q [         $ [-        [        [.        [        [0        [2        [         ["        [$        [&        [(        [*        SS	9q [         $ [         $ )
NrZ   r\   rX   r   r<   rE   )rY   r[   rG   r]   r^   rI   rL   rN   rP   rR   rT   rU   F)rG   rH   rI   rJ   rK   rL   rN   rP   rR   rT   rU   _enforce_credentials)r   r[   r   r   r   r]   rY   rW   r   r   r   r   r^   r   rG   rI   rL   rN   rP   rR   rT   rU   r`   rH   rJ   rK   )
has_openai	has_azurehas_azure_ads      rg   _load_clientr   C  sB     ! [[__-DEN! [[__-DEN++//*>?K02J.0I46LyL688*.E.QWZWbWbWfWf&XX 788L"#w('--(?)!' /+'G N'%)#+'#!&
 Nrj   c                     S q g rc   )r   r   rj   rg   _reset_clientr     s	     Grj   )betachatadminaudioevalsfilesimagesmodelsskillsvideosbatchesuploadsrealtimewebhooks	responses
containers
embeddingscompletionsfine_tuningmoderationsconversationsvector_stores)r   bool)r   r   r   )
__future__r   osr   typing_ttyping_extensionsr    r   _typesr   r   r	   r
   r   r   r   r   _utilsr   r   r   r   r   r   r   r   r   r   _modelsr   _versionr   r   	_responser   r   
_constantsr   r   r   _exceptionsr    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   _base_clientr4   r5   r6   _utils._logsr7   _setup_logging_legacy_responser8   types.websocket_reconnectionr9   r:   __all__TYPE_CHECKING_utils._resources_proxyr;   libr<   _azurer=   versionr>   	lib.azurer?   r@   lib._old_apilib.streamingrB   rC   locals__locals__name
startswithr   	TypeErrorAttributeError_tehttpxr   rG   __annotations__rH   rI   rJ   rK   rL   rN   rP   rR   rT   rU   Literal_ApiTypecastr   r   rW   rY   r[   r]   r^   r`   r   r   r   r   r   r   r   _module_clientr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rj   rg   <module>r     sd   #   &  a a a " v v v  , W W W     , \ [ 9 V R2h 
? R ' W 
   8FT""	*2HV'     >  z  j  !
 !$(
! ("1	 1&S &/3, 304- 4$(! (;;()GGHckkoo>O.PQ/ Q++//*>?Z ? [[__-DE
 E [[__-DE
 E>B ; B|F |~ 
{ 
9]  BJ      o >* 		s    
J))J65J6