
    MiU                       S SK Jr  S SKrS SKJrJrJr  S SKJrJ	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  SS	KJrJr  SS
K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&  \(       a@  SSK'J(r(J)r)J*r*J+r+J,r,J-r-  SSK.J/r/J0r0  SSK1J2r2J3r3  SSK4J5r5J6r6  SSK7J8r8J9r9  SSK:J;r;J<r<  SSK=J>r>J?r?  / SQr@ " S S\%5      rA " S S\&5      rB " S S5      rC " S S5      rD " S S 5      rE " S! S"5      rF\ArG\BrHg)#    )annotationsN)TYPE_CHECKINGAnyMapping)Selfoverride   )_exceptionsQuerystring)OmitTimeoutNotGiven	TransportProxiesTypesRequestOptions	not_given)is_givenget_async_library)cached_property)__version__)StreamAsyncStream)	GroqErrorAPIStatusError)DEFAULT_MAX_RETRIESSyncAPIClientAsyncAPIClient)chataudiofilesmodelsbatches
embeddings)Files
AsyncFiles)ModelsAsyncModels)BatchesAsyncBatches)Chat	AsyncChat)
EmbeddingsAsyncEmbeddings)Audio
AsyncAudio)r   r   r   r   Groq	AsyncGroqClientAsyncClientc                    ^  \ rS rSr% S\S'   SS\\SSSSS.                 SU 4S jjjr\SS j5       r	\SS	 j5       r
\SS
 j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\\S S j5       5       r\\S!S j5       5       r\\S"U 4S jj5       5       rSS\S\SSSS0 S.
                     S#S jjr\r\        S$S j5       rSrU =r$ )%r1   -   strapi_keyNFr8   base_urltimeoutmax_retriesdefault_headersdefault_queryhttp_client_strict_response_validationc                  > Uc  [         R                  R                  S5      nUc  [        S5      eXl        Uc  [         R                  R                  S5      nUc  Sn[
        T	U ]  [        UUUUUUUS9  g)zConstruct a new synchronous Groq client instance.

This automatically infers the `api_key` argument from the `GROQ_API_KEY` environment variable if it is not provided.
NGROQ_API_KEYThe api_key client option must be set either by passing api_key to the client or by setting the GROQ_API_KEY environment variableGROQ_BASE_URLhttps://api.groq.comversionr:   r<   r;   r?   custom_headerscustom_queryr@   osenvirongetr   r8   super__init__r   
selfr8   r:   r;   r<   r=   r>   r?   r@   	__class__s
            f/var/www/eduai.edurigo.com/storigo/production/storigo_env/lib/python3.13/site-packages/groq/_client.pyrO   Groq.__init__1       6 ?jjnn^4G? T  zz~~o6H-H##*&(C 	 		
    c                    SSK Jn  U" U 5      $ )Nr	   )r+   )resources.chatr+   )rQ   r+   s     rS   r   	Groq.chatd   s    (DzrV   c                    SSK Jn  U" U 5      $ )Nr	   )r-   )resources.embeddingsr-   )rQ   r-   s     rS   r$   Groq.embeddingsj   s    4$rV   c                    SSK Jn  U" U 5      $ )Nr	   )r/   )resources.audior/   )rQ   r/   s     rS   r    
Groq.audiop       *T{rV   c                    SSK Jn  U" U 5      $ )Nr	   )r'   )resources.modelsr'   )rQ   r'   s     rS   r"   Groq.modelsv   s    ,d|rV   c                    SSK Jn  U" U 5      $ )Nr	   )r)   )resources.batchesr)   )rQ   r)   s     rS   r#   Groq.batches|   s    .t}rV   c                    SSK Jn  U" U 5      $ )Nr	   )r%   )resources.filesr%   )rQ   r%   s     rS   r!   
Groq.files   r`   rV   c                    [        U 5      $ N)GroqWithRawResponserQ   s    rS   with_raw_responseGroq.with_raw_response   s    "4((rV   c                    [        U 5      $ rk   )GroqWithStreamedResponserm   s    rS   with_streaming_responseGroq.with_streaming_response       '--rV   c                    [        SS9$ Ncomma)array_formatr   rm   s    rS   qsGroq.qs        00rV   c                (    U R                   nSSU 30$ NAuthorizationzBearer r8   rQ   r8   s     rS   auth_headersGroq.auth_headers        ,,77)!455rV   c                <   > 0 [         TU ]  ESS0EU R                  E$ )NX-Stainless-Asyncfalse)rN   r=   _custom_headersrQ   rR   s    rS   r=   Groq.default_headers   s4    
g%

 ""
 	
rV   
r8   r:   r;   r?   r<   r=   set_default_headersr>   set_default_query_extra_kwargsc       
           Ub  Ub  [        S5      eUb  U	b  [        S5      eU R                  nUb  0 UEUEnOUb  UnU R                  nUb  0 UEUEnOU	b  U	nU=(       d    U R                  nU R                  " SU=(       d    U R
                  U=(       d    U R                  [        U[        5      (       a  U R                  OUU[        U5      (       a  UOU R                  UUS.U
D6$ zn
Create a new client instance re-using the same options given to the current client with optional overriding.
zPThe `default_headers` and `set_default_headers` arguments are mutually exclusivezLThe `default_query` and `set_default_query` arguments are mutually exclusive)r8   r:   r;   r?   r<   r=   r>    
ValueErrorr   _custom_query_clientrR   r8   r:   
isinstancer   r;   r   r<   rQ   r8   r:   r;   r?   r<   r=   r   r>   r   r   headersparamss                rS   copy	Groq.copy      " &+>+Jopp$):)Fkll&&&44O4G ,)G##$00-0F*&F!1T\\~~ 	
+t||.$.w$A$ADLLw#'/'<'<$BRBR# 	
 	
 		
rV   c               f   UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R
                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S	:  a  [        R                  " XUS9$ [        XUS9$ 
Ni  )responsebodyi  i  i  i  i  i  i  status_coder
   BadRequestErrorAuthenticationErrorPermissionDeniedErrorNotFoundErrorConflictErrorUnprocessableEntityErrorRateLimitErrorInternalServerErrorr   rQ   err_msgr   r   s       rS   _make_status_errorGroq._make_status_error       3&..wPTUU3&227TXYY3&44WVZ[[3&,,WdSS3&,,WdSS3&77Y]^^3&--gtTT3&227TXYYgtDDrV   r   )r8   
str | Noner:   str | httpx.URL | Noner;   !float | Timeout | None | NotGivenr<   intr=   Mapping[str, str] | Noner>   Mapping[str, object] | Noner?   httpx.Client | Noner@   boolreturnNone)r   r+   )r   r-   )r   r/   )r   r'   )r   r)   )r   r%   )r   rl   )r   rq   r   r   r   zdict[str, str]r   zdict[str, str | Omit])r8   r   r:   r   r;   r   r?   r   r<   int | NotGivenr=   r   r   r   r>   r   r   r   r   Mapping[str, Any]r   r   r   r7   r   objectr   zhttpx.Responser   r   __name__
__module____qualname____firstlineno____annotations__r   r   rO   r   r   r$   r    r"   r#   r!   rn   rr   propertyr   ry   r   r=   r   with_optionsr   __static_attributes____classcell__rR   s   @rS   r1   r1   -   sX   L
 #+/5>.4859 ,0 -2+1
 1
 )	1

 31
 1
 21
 31
 )1
* &*+1
, 
-1
 1
f  
    
  
  
  
  
 ) ) . . 1  1 6  6 
  
 #+/5>+/&/488<599=+--
 -
 )	-

 3-
 )-
 $-
 2-
 6-
 3-
 7-
 )-
 
-
b LEE 	E
 !E 
E ErV   r1   c                    ^  \ rS rSr% S\S'   SS\\SSSSS.                 SU 4S jjjr\SS j5       r	\SS	 j5       r
\SS
 j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\SS j5       r\\S S j5       5       r\\S!S j5       5       r\\S"U 4S jj5       5       rSS\S\SSSS0 S.
                     S#S jjr\r\        S$S j5       rSrU =r$ )%r2      r7   r8   NFr9   c                  > Uc  [         R                  R                  S5      nUc  [        S5      eXl        Uc  [         R                  R                  S5      nUc  Sn[
        T	U ]  [        UUUUUUUS9  g)zConstruct a new async AsyncGroq client instance.

This automatically infers the `api_key` argument from the `GROQ_API_KEY` environment variable if it is not provided.
NrB   rC   rD   rE   rF   rJ   rP   s
            rS   rO   AsyncGroq.__init__   rU   rV   c                    SSK Jn  U" U 5      $ )Nr	   )r,   )rX   r,   )rQ   r,   s     rS   r   AsyncGroq.chat0  s    -rV   c                    SSK Jn  U" U 5      $ )Nr	   )r.   )r[   r.   )rQ   r.   s     rS   r$   AsyncGroq.embeddings6  s    9t$$rV   c                    SSK Jn  U" U 5      $ )Nr	   )r0   )r^   r0   )rQ   r0   s     rS   r    AsyncGroq.audio<      /$rV   c                    SSK Jn  U" U 5      $ )Nr	   )r(   )rb   r(   )rQ   r(   s     rS   r"   AsyncGroq.modelsB  s    14  rV   c                    SSK Jn  U" U 5      $ )Nr	   )r*   )re   r*   )rQ   r*   s     rS   r#   AsyncGroq.batchesH  s    3D!!rV   c                    SSK Jn  U" U 5      $ )Nr	   )r&   )rh   r&   )rQ   r&   s     rS   r!   AsyncGroq.filesN  r   rV   c                    [        U 5      $ rk   )AsyncGroqWithRawResponserm   s    rS   rn   AsyncGroq.with_raw_responseT  rt   rV   c                    [        U 5      $ rk   )AsyncGroqWithStreamedResponserm   s    rS   rr   !AsyncGroq.with_streaming_responseX  s    ,T22rV   c                    [        SS9$ rv   r   rm   s    rS   ry   AsyncGroq.qs\  r{   rV   c                (    U R                   nSSU 30$ r}   r   r   s     rS   r   AsyncGroq.auth_headersa  r   rV   c                R   > 0 [         TU ]  ESS[        5        30EU R                  E$ )Nr   zasync:)rN   r=   r   r   r   s    rS   r=   AsyncGroq.default_headersg  s@    
g%
6*;*=)>!?
 ""
 	
rV   r   c       
           Ub  Ub  [        S5      eUb  U	b  [        S5      eU R                  nUb  0 UEUEnOUb  UnU R                  nUb  0 UEUEnOU	b  U	nU=(       d    U R                  nU R                  " SU=(       d    U R
                  U=(       d    U R                  [        U[        5      (       a  U R                  OUU[        U5      (       a  UOU R                  UUS.U
D6$ r   r   r   s                rS   r   AsyncGroq.copyp  r   rV   c               f   UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R
                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S:X  a  [        R                  " XUS9$ UR                   S	:  a  [        R                  " XUS9$ [        XUS9$ r   r   r   s       rS   r   AsyncGroq._make_status_error  r   rV   r   )r8   r   r:   r   r;   r   r<   r   r=   r   r>   r   r?   httpx.AsyncClient | Noner@   r   r   r   )r   r,   )r   r.   )r   r0   )r   r(   )r   r*   )r   r&   )r   r   )r   r   r   r   r   )r8   r   r:   r   r;   r   r?   r   r<   r   r=   r   r   r   r>   r   r   r   r   r   r   r   r   r   r   s   @rS   r2   r2      sX   L
 #+/5>.4859 15 -2+1
 1
 )	1

 31
 1
 21
 31
 .1
* &*+1
, 
-1
 1
f  
 % %
    
 ! !
 " "
    
 . . 3 3 1  1 6  6 
  
 #+/5>04&/488<599=+--
 -
 )	-

 3-
 .-
 $-
 2-
 6-
 3-
 7-
 )-
 
-
b LEE 	E
 !E 
E ErV   r2   c                      \ rS rSr% S\S'   SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS	 j5       r\SS
 j5       rSrg)rl   i  r1   r   c                    Xl         g rk   r   rQ   clients     rS   rO   GroqWithRawResponse.__init__      rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )ChatWithRawResponse)rX   r   r   r   )rQ   r   s     rS   r   GroqWithRawResponse.chat  s    7"4<<#4#455rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )EmbeddingsWithRawResponse)r[   r   r   r$   )rQ   r   s     rS   r$   GroqWithRawResponse.embeddings  s    C()@)@AArV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AudioWithRawResponse)r^   r   r   r    )rQ   r   s     rS   r    GroqWithRawResponse.audio      9#DLL$6$677rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )ModelsWithRawResponse)rb   r   r   r"   )rQ   r   s     rS   r"   GroqWithRawResponse.models  s    ;$T\\%8%899rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )BatchesWithRawResponse)re   r  r   r#   )rQ   r  s     rS   r#   GroqWithRawResponse.batches  s    =%dll&:&:;;rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )FilesWithRawResponse)rh   r  r   r!   )rQ   r  s     rS   r!   GroqWithRawResponse.files  r   rV   r   Nr   r1   r   r   )r   zchat.ChatWithRawResponse)r   z$embeddings.EmbeddingsWithRawResponse)r   zaudio.AudioWithRawResponse)r   zmodels.ModelsWithRawResponse)r   zbatches.BatchesWithRawResponse)r   zfiles.FilesWithRawResponser   r   r   r   r   rO   r   r   r$   r    r"   r#   r!   r   r   rV   rS   rl   rl     s    M 6 6
 B B
 8 8
 : :
 < <
 8 8rV   rl   c                      \ rS rSr% S\S'   SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS	 j5       r\SS
 j5       rSrg)r   i  r2   r   c                    Xl         g rk   r   r   s     rS   rO   !AsyncGroqWithRawResponse.__init__  r   rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncChatWithRawResponse)rX   r  r   r   )rQ   r  s     rS   r   AsyncGroqWithRawResponse.chat  s    <'(9(9::rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncEmbeddingsWithRawResponse)r[   r  r   r$   )rQ   r  s     rS   r$   #AsyncGroqWithRawResponse.embeddings  s    H-dll.E.EFFrV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncAudioWithRawResponse)r^   r  r   r    )rQ   r  s     rS   r    AsyncGroqWithRawResponse.audio      >(););<<rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncModelsWithRawResponse)rb   r  r   r"   )rQ   r  s     rS   r"   AsyncGroqWithRawResponse.models  s    @)$,,*=*=>>rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncBatchesWithRawResponse)re   r  r   r#   )rQ   r  s     rS   r#    AsyncGroqWithRawResponse.batches  s    B*4<<+?+?@@rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncFilesWithRawResponse)rh   r  r   r!   )rQ   r  s     rS   r!   AsyncGroqWithRawResponse.files  r  rV   r   Nr   r2   r   r   )r   zchat.AsyncChatWithRawResponse)r   z)embeddings.AsyncEmbeddingsWithRawResponse)r   zaudio.AsyncAudioWithRawResponse)r   z!models.AsyncModelsWithRawResponse)r   z#batches.AsyncBatchesWithRawResponse)r   zfiles.AsyncFilesWithRawResponser  r   rV   rS   r   r     s     ; ;
 G G
 = =
 ? ?
 A A
 = =rV   r   c                      \ rS rSr% S\S'   SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS	 j5       r\SS
 j5       rSrg)rq   i  r1   r   c                    Xl         g rk   r   r   s     rS   rO   !GroqWithStreamedResponse.__init__  r   rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )ChatWithStreamingResponse)rX   r$  r   r   )rQ   r$  s     rS   r   GroqWithStreamedResponse.chat!  s    =():):;;rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )EmbeddingsWithStreamingResponse)r[   r'  r   r$   )rQ   r'  s     rS   r$   #GroqWithStreamedResponse.embeddings'  s    I.t||/F/FGGrV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AudioWithStreamingResponse)r^   r*  r   r    )rQ   r*  s     rS   r    GroqWithStreamedResponse.audio-      ?)$,,*<*<==rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )ModelsWithStreamingResponse)rb   r.  r   r"   )rQ   r.  s     rS   r"   GroqWithStreamedResponse.models3  s    A*4<<+>+>??rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )BatchesWithStreamingResponse)re   r1  r   r#   )rQ   r1  s     rS   r#    GroqWithStreamedResponse.batches9  s    C+DLL,@,@AArV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )FilesWithStreamingResponse)rh   r4  r   r!   )rQ   r4  s     rS   r!   GroqWithStreamedResponse.files?  r,  rV   r   Nr  )r   zchat.ChatWithStreamingResponse)r   z*embeddings.EmbeddingsWithStreamingResponse)r   z audio.AudioWithStreamingResponse)r   z"models.ModelsWithStreamingResponse)r   z$batches.BatchesWithStreamingResponse)r   z files.FilesWithStreamingResponser  r   rV   rS   rq   rq     s    M < <
 H H
 > >
 @ @
 B B
 > >rV   rq   c                      \ rS rSr% S\S'   SS jr\SS j5       r\SS j5       r\SS j5       r	\SS j5       r
\SS	 j5       r\SS
 j5       rSrg)r   iF  r2   r   c                    Xl         g rk   r   r   s     rS   rO   &AsyncGroqWithStreamedResponse.__init__I  r   rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncChatWithStreamingResponse)rX   r:  r   r   )rQ   r:  s     rS   r   "AsyncGroqWithStreamedResponse.chatL  s    B-dll.?.?@@rV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )$AsyncEmbeddingsWithStreamingResponse)r[   r=  r   r$   )rQ   r=  s     rS   r$   (AsyncGroqWithStreamedResponse.embeddingsR  s    N3DLL4K4KLLrV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncAudioWithStreamingResponse)r^   r@  r   r    )rQ   r@  s     rS   r    #AsyncGroqWithStreamedResponse.audioX      D.t||/A/ABBrV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   ) AsyncModelsWithStreamingResponse)rb   rD  r   r"   )rQ   rD  s     rS   r"   $AsyncGroqWithStreamedResponse.models^  s    F/0C0CDDrV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )!AsyncBatchesWithStreamingResponse)re   rG  r   r#   )rQ   rG  s     rS   r#   %AsyncGroqWithStreamedResponse.batchesd  s    H01E1EFFrV   c                F    SSK Jn  U" U R                  R                  5      $ )Nr	   )AsyncFilesWithStreamingResponse)rh   rJ  r   r!   )rQ   rJ  s     rS   r!   #AsyncGroqWithStreamedResponse.filesj  rB  rV   r   Nr  )r   z#chat.AsyncChatWithStreamingResponse)r   z/embeddings.AsyncEmbeddingsWithStreamingResponse)r   z%audio.AsyncAudioWithStreamingResponse)r   z'models.AsyncModelsWithStreamingResponse)r   z)batches.AsyncBatchesWithStreamingResponse)r   z%files.AsyncFilesWithStreamingResponser  r   rV   rS   r   r   F  s     A A
 M M
 C C
 E E
 G G
 C CrV   r   )I
__future__r   rK   typingr   r   r   typing_extensionsr   r   httpx r
   _qsr   _typesr   r   r   r   r   r   r   _utilsr   r   _compatr   _versionr   
_streamingr   r   r   r   _base_clientr   r   r   	resourcesr   r    r!   r"   r#   r$   rh   r%   r&   rb   r'   r(   re   r)   r*   resources.chat.chatr+   r,   r[   r-   r.   resources.audio.audior/   r0   __all__r1   r2   rl   r   rq   r   r3   r4   r   rV   rS   <module>r\     s    # 	 . . ,      0 $ ! D 2  JJ2584A8
rIE= IEXIE IEX(8 (8V(= (=V(> (>V(C (CV 
rV   