Ë
    CØïiú  ã                   ó~   — d dl Z d dlmZ d dlZd dlZd dlmZ  ej                  d¬«      d„ «       Zd
d„Zd
d„Z	d
d	„Z
y)é    N)ÚNamedTemporaryFile)ÚutilÚfunction)Úscopec               #   óÚ   K  — t         j                  } 	 t        dd¬«      5 }|j                  t         _        |–— d d d «       | t         _        y # 1 sw Y   ŒxY w# | t         _        w xY w­w)Nzopenai-api-keyÚwt)ÚprefixÚmode)ÚopenaiÚapi_key_pathr   Úname)Ú
saved_pathÚtmps     úP/var/www/html/aiagents/fe/lib/python3.12/site-packages/openai/tests/test_util.pyÚapi_key_filer   
   s]   è ø€ ä×$Ñ$€Jð)ÜÐ'7¸dÔCð 	ÀsØ"%§(¡(ŒFÔØŠI÷	ð )ŒÕ÷		ð 	ûð )ŒÕüs2   ‚A+”A ¡A»A ÁA+ÁAÁA ÁA(Á(A+c                 óp   — t        d| ¬«       | j                  «        t        j                  «       dk(  sJ ‚y )Nzsk-foo©Úfile)ÚprintÚflushr   Údefault_api_key©r   s    r   Útest_openai_api_key_pathr      s/   € Ü	ˆ(˜Õ&Ø×ÑÔÜ×ÑÓ! XÒ-Ð-Ñ-ó    c                 óÆ   — t        d| ¬«       | j                  «        t        j                  t        d¬«      5  t        j                  «        d d d «       y # 1 sw Y   y xY w)Nzmalformed-api-keyr   zMalformed API key)Úmatch)r   r   ÚpytestÚraisesÚ
ValueErrorr   r   r   s    r   Ú+test_openai_api_key_path_with_malformed_keyr       sI   € Ü	Ð
 LÕ1Ø×ÑÔÜ	�‰”zÐ)<Ô	=ñ Ü×ÑÔ÷÷ ñ ús   ¹AÁA c            	      óú   — ddddddddœd	d
dœdddœgdœ} t        j                  | «      }t        t        j                  t        |«      «      j                  «       «      t        | j                  «       «      k(  sJ ‚y )Nz&chatcmpl-7NaPEA6sgX7LnNPyKPbRlsyqLbr5Vzchat.completionid|dzgpt-3.5-turbo-0301é9   é(   éa   )Úprompt_tokensÚcompletion_tokensÚtotal_tokensÚ	assistantz´The 2020 World Series was played at Globe Life Field in Arlington, Texas. It was the first time that the World Series was played at a neutral site because of the COVID-19 pandemic.)ÚroleÚcontentÚstopr   )ÚmessageÚfinish_reasonÚindex)ÚidÚobjectÚcreatedÚmodelÚusageÚchoices)r   Úconvert_to_openai_objectÚlistÚjsonÚloadsÚstrÚkeys)Úsample_responseÚ
oai_objects     r   Ú&test_key_order_openai_object_renderingr=   "   s‹   € à6Ø#ØØ%Ø#%¸BÐPRÑSð (ð  Vñð "(Øñð	
ñ€Oô$ ×.Ñ.¨Ó?€Jä”—
‘
œ3˜z›?Ó+×0Ñ0Ó2Ó3´t¸O×<PÑ<PÓ<RÓ7SÒSÐSÑSr   )ÚreturnN)r7   Útempfiler   r   r   r   Úfixturer   r   r    r=   © r   r   ú<module>rB      sC   ðÛ Ý 'ã ã Ý ð €‡��jÔ!ñ)ó "ð)ó.óôTr   