Ë
    ,Œ:j¢U  ã                  ó,  — d dl mZ d dlmZmZmZ d dlmZ d dlZddl	m
Z
mZmZmZmZ ddlmZ ddlmZmZ dd	lmZmZ dd
lmZmZ ddlmZmZ ddlmZmZm Z m!Z!m"Z" erddl#m$Z$m%Z% ddgZ& G d„ de«      Z' G d„ de«      Z( G d„ d«      Z) G d„ d«      Z*y)é    )Úannotations)ÚTYPE_CHECKINGÚUnionÚOptional)ÚLiteralNé   )Ú	NOT_GIVENÚBodyÚQueryÚHeadersÚNotGiven)Úmaybe_transform)ÚSyncAPIResourceÚAsyncAPIResource)Úto_raw_response_wrapperÚasync_to_raw_response_wrapper)ÚSyncCursorPageÚAsyncCursorPage)ÚAsyncPaginatorÚmake_request_options)ÚFineTuningJobÚFineTuningJobEventÚjob_list_paramsÚjob_create_paramsÚjob_list_events_params)ÚOpenAIÚAsyncOpenAIÚJobsÚ	AsyncJobsc                  ó(  ‡ — e Zd ZU ded<   dˆ fd„Zeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zeeddded	œ	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Z	eeddded	œ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z
ˆ xZS )r   ÚJobsWithRawResponseÚwith_raw_responsec                óD   •— t         ‰| �  |«       t        | «      | _        y ©N)ÚsuperÚ__init__r!   r"   ©ÚselfÚclientÚ	__class__s     €úc/var/www/html/tokenscope/api/venv/lib/python3.12/site-packages/openai/resources/fine_tuning/jobs.pyr&   zJobs.__init__!   s   ø€ Ü‰Ñ˜Ô Ü!4°TÓ!:ˆÕó    N©ÚhyperparametersÚsuffixÚvalidation_fileÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc       	        óŠ   — | j                  dt        |||||dœt        j                  «      t	        ||||	¬«      t
        ¬«      S )áö  
        Creates a job that fine-tunes a specified model from a given dataset.

        Response includes details of the enqueued job including job status and the name
        of the fine-tuned models once complete.

        [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)

        Args:
          model: The name of the model to fine-tune. You can select one of the
              [supported models](https://platform.openai.com/docs/guides/fine-tuning/what-models-can-be-fine-tuned).

          training_file: The ID of an uploaded file that contains training data.

              See [upload file](https://platform.openai.com/docs/api-reference/files/upload)
              for how to upload a file.

              Your dataset must be formatted as a JSONL file. Additionally, you must upload
              your file with the purpose `fine-tune`.

              See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
              for more details.

          hyperparameters: The hyperparameters used for the fine-tuning job.

          suffix: A string of up to 18 characters that will be added to your fine-tuned model
              name.

              For example, a `suffix` of "custom-model-name" would produce a model name like
              `ft:gpt-3.5-turbo:openai:custom-model-name:7p4lURel`.

          validation_file: The ID of an uploaded file that contains validation data.

              If you provide this file, the data is used to generate validation metrics
              periodically during fine-tuning. These metrics can be viewed in the fine-tuning
              results file. The same data should not be present in both train and validation
              files.

              Your dataset must be formatted as a JSONL file. You must upload your file with
              the purpose `fine-tune`.

              See the [fine-tuning guide](https://platform.openai.com/docs/guides/fine-tuning)
              for more details.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ú/fine_tuning/jobs©ÚmodelÚtraining_filer.   r/   r0   ©r1   r2   r3   r4   ©ÚbodyÚoptionsÚcast_to©Ú_postr   r   ÚJobCreateParamsr   r   ©
r(   r9   r:   r.   r/   r0   r1   r2   r3   r4   s
             r+   ÚcreatezJobs.create%   s_   € ðF �z‰zØÜ à"Ø%2Ø'6Ø$Ø'6ñô "×1Ñ1ó	ô )Ø+¸ÐQ[Ðelôô "ð ó 
ð 	
r,   r;   c          	     óR   — | j                  d|› �t        ||||¬«      t        ¬«      S )á²  
        Get info about a fine-tuning job.

        [Learn more about fine-tuning](https://platform.openai.com/docs/guides/fine-tuning)

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ú/fine_tuning/jobs/r;   ©r>   r?   ©Ú_getr   r   ©r(   Úfine_tuning_job_idr1   r2   r3   r4   s         r+   ÚretrievezJobs.retrievez   s>   € ð2 �y‰yØ Ð!3Ð 4Ð5Ü(Ø+¸ÐQ[Ðelôô "ð ó 
ð 	
r,   ©ÚafterÚlimitr1   r2   r3   r4   c               óœ   — | j                  dt        t           t        ||||t	        ||dœt
        j                  «      ¬«      t        ¬«      S ©aë  
        List your organization's fine-tuning jobs

        Args:
          after: Identifier for the last job from the previous pagination request.

          limit: Number of fine-tuning jobs to retrieve.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r7   ©rO   rP   ©r1   r2   r3   r4   Úquery©Úpager>   r9   )Ú_get_api_listr   r   r   r   r   ÚJobListParams©r(   rO   rP   r1   r2   r3   r4   s          r+   Úlistz	Jobs.list›   s^   € ð8 ×!Ñ!ØÜ¤Ñ.Ü(Ø+Ø'Ø%ØÜ%à!&Ø!&ñô $×1Ñ1óôô  ð! "ó 
ð 	
r,   c          	     óT   — | j                  d|› d�t        ||||¬«      t        ¬«      S )áW  
        Immediately cancel a fine-tune job.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rG   ú/cancelr;   rH   ©rA   r   r   rK   s         r+   ÚcancelzJobs.cancelÊ   s@   € ð. �z‰zØ Ð!3Ð 4°GÐ<Ü(Ø+¸ÐQ[Ðelôô "ð ó 
ð 	
r,   c               ó¤   — | j                  d|› d�t        t           t        ||||t	        ||dœt
        j                  «      ¬«      t        ¬«      S ©aã  
        Get status updates for a fine-tuning job.

        Args:
          after: Identifier for the last event from the previous pagination request.

          limit: Number of events to retrieve.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        rG   z/eventsrS   rT   rV   )rX   r   r   r   r   r   ÚJobListEventsParams©r(   rL   rO   rP   r1   r2   r3   r4   s           r+   Úlist_eventszJobs.list_eventsé   sj   € ð: ×!Ñ!Ø Ð!3Ð 4°GÐ<ÜÔ 2Ñ3Ü(Ø+Ø'Ø%ØÜ%à!&Ø!&ñô +×>Ñ>óôô %ð! "ó 
ð 	
r,   )r)   r   ÚreturnÚNone©r9   zBUnion[str, Literal['babbage-002', 'davinci-002', 'gpt-3.5-turbo']]r:   Ústrr.   z,job_create_params.Hyperparameters | NotGivenr/   úOptional[str] | NotGivenr0   rj   r1   úHeaders | Noner2   úQuery | Noner3   úBody | Noner4   ú'float | httpx.Timeout | None | NotGivenrf   r   ©rL   ri   r1   rk   r2   rl   r3   rm   r4   rn   rf   r   )rO   ústr | NotGivenrP   úint | NotGivenr1   rk   r2   rl   r3   rm   r4   rn   rf   zSyncCursorPage[FineTuningJob])rL   ri   rO   rp   rP   rq   r1   rk   r2   rl   r3   rm   r4   rn   rf   z"SyncCursorPage[FineTuningJobEvent]©Ú__name__Ú
__module__Ú__qualname__Ú__annotations__r&   r	   rD   rM   r[   r`   re   Ú__classcell__©r*   s   @r+   r   r      s  ø… Ø*Ó*õ;ð IRØ+4Ø4=ð )-Ø$(Ø"&Ø;DñS
ð RðS
ð ð	S
ð
 FðS
ð )ðS
ð 2ðS
ð &ðS
ð "ðS
ð  ðS
ð 9ðS
ð 
óS
ðv )-Ø$(Ø"&Ø;Dñ
àð
ð &ð
ð "ð
ð  ð
ð 9ð
ð 
ó
ðH !*Ø )ð )-Ø$(Ø"&Ø;Dñ-
ð ð-
ð ð	-
ð &ð-
ð "ð-
ð  ð-
ð 9ð-
ð 
'ó-
ðj )-Ø$(Ø"&Ø;Dñ
àð
ð &ð
ð "ð
ð  ð
ð 9ð
ð 
ó
ðF !*Ø )ð )-Ø$(Ø"&Ø;Dñ.
àð.
ð ð	.
ð
 ð.
ð &ð.
ð "ð.
ð  ð.
ð 9ð.
ð 
,÷.
r,   c                  ó(  ‡ — e Zd ZU ded<   dˆ fd„Zeeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Zeeddded	œ	 	 	 	 	 	 	 	 	 	 	 	 	 dd
„Zdddedœ	 	 	 	 	 	 	 	 	 	 	 dd„Z	eeddded	œ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Z
ˆ xZS )r   ÚAsyncJobsWithRawResponser"   c                óD   •— t         ‰| �  |«       t        | «      | _        y r$   )r%   r&   rz   r"   r'   s     €r+   r&   zAsyncJobs.__init__  s   ø€ Ü‰Ñ˜Ô Ü!9¸$Ó!?ˆÕr,   Nr-   c       	      ƒ  ó¦   K  — | j                  dt        |||||dœt        j                  «      t	        ||||	¬«      t
        ¬«      ƒ d{  –—† S 7 Œ­w)r6   r7   r8   r;   r<   Nr@   rC   s
             r+   rD   zAsyncJobs.create!  sm   è ø€ ðF —Z‘ZØÜ à"Ø%2Ø'6Ø$Ø'6ñô "×1Ñ1ó	ô )Ø+¸ÐQ[Ðelôô "ð  ó 
÷ 
ð 	
ð 
ús   ‚AAÁ
AÁAr;   c          	   ƒ  ón   K  — | j                  d|› �t        ||||¬«      t        ¬«      ƒ d{  –—† S 7 Œ­w)rF   rG   r;   rH   NrI   rK   s         r+   rM   zAsyncJobs.retrievev  sL   è ø€ ð2 —Y‘YØ Ð!3Ð 4Ð5Ü(Ø+¸ÐQ[Ðelôô "ð ó 
÷ 
ð 	
ð 
ús   ‚,5®3¯5rN   c               óœ   — | j                  dt        t           t        ||||t	        ||dœt
        j                  «      ¬«      t        ¬«      S rR   )rX   r   r   r   r   r   rY   rZ   s          r+   r[   zAsyncJobs.list—  s^   € ð8 ×!Ñ!ØÜ ¤Ñ/Ü(Ø+Ø'Ø%ØÜ%à!&Ø!&ñô $×1Ñ1óôô  ð! "ó 
ð 	
r,   c          	   ƒ  óp   K  — | j                  d|› d�t        ||||¬«      t        ¬«      ƒ d{  –—† S 7 Œ­w)r]   rG   r^   r;   rH   Nr_   rK   s         r+   r`   zAsyncJobs.cancelÆ  sN   è ø€ ð. —Z‘ZØ Ð!3Ð 4°GÐ<Ü(Ø+¸ÐQ[Ðelôô "ð  ó 
÷ 
ð 	
ð 
ús   ‚-6¯4°6c               ó¤   — | j                  d|› d�t        t           t        ||||t	        ||dœt
        j                  «      ¬«      t        ¬«      S rb   )rX   r   r   r   r   r   rc   rd   s           r+   re   zAsyncJobs.list_eventså  sj   € ð: ×!Ñ!Ø Ð!3Ð 4°GÐ<Ü Ô!3Ñ4Ü(Ø+Ø'Ø%ØÜ%à!&Ø!&ñô +×>Ñ>óôô %ð! "ó 
ð 	
r,   )r)   r   rf   rg   rh   ro   )rO   rp   rP   rq   r1   rk   r2   rl   r3   rm   r4   rn   rf   z=AsyncPaginator[FineTuningJob, AsyncCursorPage[FineTuningJob]])rL   ri   rO   rp   rP   rq   r1   rk   r2   rl   r3   rm   r4   rn   rf   zGAsyncPaginator[FineTuningJobEvent, AsyncCursorPage[FineTuningJobEvent]]rr   rx   s   @r+   r   r     s
  ø… Ø/Ó/õ@ð IRØ+4Ø4=ð )-Ø$(Ø"&Ø;DñS
ð RðS
ð ð	S
ð
 FðS
ð )ðS
ð 2ðS
ð &ðS
ð "ðS
ð  ðS
ð 9ðS
ð 
óS
ðv )-Ø$(Ø"&Ø;Dñ
àð
ð &ð
ð "ð
ð  ð
ð 9ð
ð 
ó
ðH !*Ø )ð )-Ø$(Ø"&Ø;Dñ-
ð ð-
ð ð	-
ð &ð-
ð "ð-
ð  ð-
ð 9ð-
ð 
Gó-
ðj )-Ø$(Ø"&Ø;Dñ
àð
ð &ð
ð "ð
ð  ð
ð 9ð
ð 
ó
ðF !*Ø )ð )-Ø$(Ø"&Ø;Dñ.
àð.
ð ð	.
ð
 ð.
ð &ð.
ð "ð.
ð  ð.
ð 9ð.
ð 
Q÷.
r,   c                  ó   — e Zd Zdd„Zy)r!   c                ó  — t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        t        |j
                  «      | _        y r$   )r   rD   rM   r[   r`   re   ©r(   Újobss     r+   r&   zJobsWithRawResponse.__init__  sl   € Ü-Ø�K‰Kó
ˆŒô 0Ø�M‰Mó
ˆŒô ,Ø�I‰Ió
ˆŒ	ô .Ø�K‰Kó
ˆŒô 3Ø×Ñó
ˆÕr,   N)r„   r   rf   rg   ©rs   rt   ru   r&   © r,   r+   r!   r!     ó   „ ô
r,   r!   c                  ó   — e Zd Zdd„Zy)rz   c                ó  — t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        t        |j                  «      | _        t        |j
                  «      | _        y r$   )r   rD   rM   r[   r`   re   rƒ   s     r+   r&   z!AsyncJobsWithRawResponse.__init__*  sl   € Ü3Ø�K‰Kó
ˆŒô 6Ø�M‰Mó
ˆŒô 2Ø�I‰Ió
ˆŒ	ô 4Ø�K‰Kó
ˆŒô 9Ø×Ñó
ˆÕr,   N)r„   r   rf   rg   r…   r†   r,   r+   rz   rz   )  r‡   r,   rz   )+Ú
__future__r   Útypingr   r   r   Útyping_extensionsr   ÚhttpxÚ_typesr	   r
   r   r   r   Ú_utilsr   Ú	_resourcer   r   Ú	_responser   r   Ú
paginationr   r   Ú_base_clientr   r   Útypes.fine_tuningr   r   r   r   r   Ú_clientr   r   Ú__all__r   r   r!   rz   r†   r,   r+   ú<module>r—      sz   ðõ #ç 1Ñ 1Ý %ã ç ?Õ ?Ý %ß :ß Oß 9ß @÷õ ñ ß.à�;Ð
€ôy
ˆ?ô y
ôxy
Ð ô y
÷x
ñ 
÷&
ò 
r,   