
    gr                       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
 ddlmZmZmZmZmZ ddlmZmZ dd	lmZ d
dlmZmZmZmZ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( ddl)m*Z*m+Z+m,Z, ddl-m.Z. ddl/m0Z0 ddgZ1 G d de          Z2 G d de          Z3 G d d          Z4 G d d          Z5 G d d          Z6 G d d          Z7dS )    )annotations)UnionIterableOptional)LiteralN   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transformasync_maybe_transform)cached_property   )CheckpointsAsyncCheckpointsCheckpointsWithRawResponseAsyncCheckpointsWithRawResponse CheckpointsWithStreamingResponse%AsyncCheckpointsWithStreamingResponse)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)job_list_paramsjob_create_paramsjob_list_events_params)FineTuningJob)FineTuningJobEventJobs	AsyncJobsc                      e Zd Zed0d            Zed1d            Zed2d            Zeeeeeeddded	
d3d"Zddded#d4d%Z	eeddded&d5d,Z
ddded#d4d-Zeeddded&d6d/ZdS )7r&   returnr   c                *    t          | j                  S N)r   _clientselfs    d/var/www/html/mpstechhub/venv/lib/python3.11/site-packages/openai/resources/fine_tuning/jobs/jobs.pycheckpointszJobs.checkpoints(   s    4<(((    JobsWithRawResponsec                     t          |           S a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
        )r2   r-   s    r/   with_raw_responsezJobs.with_raw_response,   s     #4(((r1   JobsWithStreamingResponsec                     t          |           S z
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
        )r6   r-   s    r/   with_streaming_responsezJobs.with_streaming_response6   s     )...r1   N
hyperparametersintegrationsmethodseedsuffixvalidation_fileextra_headersextra_query
extra_bodytimeoutmodelQUnion[str, Literal['babbage-002', 'davinci-002', 'gpt-3.5-turbo', 'gpt-4o-mini']]training_filestrr;   ,job_create_params.Hyperparameters | NotGivenr<   <Optional[Iterable[job_create_params.Integration]] | NotGivenr=   #job_create_params.Method | NotGivenr>   Optional[int] | NotGivenr?   Optional[str] | NotGivenr@   rA   Headers | NonerB   Query | NonerC   Body | NonerD   'float | httpx.Timeout | None | NotGivenr$   c                   |                      dt          ||||||||dt          j                  t	          |	|
||          t
                    S )  
        Creates a fine-tuning job which begins the process of creating a new 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#which-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/create)
              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`.

              The contents of the file should differ depending on if the model uses the
              [chat](https://platform.openai.com/docs/api-reference/fine-tuning/chat-input),
              [completions](https://platform.openai.com/docs/api-reference/fine-tuning/completions-input)
              format, or if the fine-tuning method uses the
              [preference](https://platform.openai.com/docs/api-reference/fine-tuning/preference-input)
              format.

              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. This value is now deprecated
              in favor of `method`, and should be passed in under the `method` parameter.

          integrations: A list of integrations to enable for your fine-tuning job.

          method: The method used for fine-tuning.

          seed: The seed controls the reproducibility of the job. Passing in the same seed and
              job parameters should produce the same results, but may differ in rare cases. If
              a seed is not specified, one will be generated for you.

          suffix: A string of up to 64 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-4o-mini: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rE   rG   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   bodyoptionscast_to)_postr   r"   JobCreateParamsr    r$   r.   rE   rG   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   s                r/   createzJobs.create?   s~    n zz "%2'6$0$ $'6	 	 "1  )+Q[el   "%  
 
 	
r1   rV   fine_tuning_job_idc          	         |st          d|          |                     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
        AExpected a non-empty value for `fine_tuning_job_id` but received /fine_tuning/jobs/rV   rY   rZ   
ValueError_getr    r$   r.   r_   rA   rB   rC   rD   s         r/   retrievezJobs.retrieve   sn    2 " 	ywaswwxxxyy5!355(+Q[el   "  
 
 	
r1   afterlimitrA   rB   rC   rD   rk   str | NotGivenrl   int | NotGivenSyncCursorPage[FineTuningJob]c                   |                      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
        rT   rk   rl   rA   rB   rC   rD   querypagerY   rE   )_get_api_listr   r$   r    r   r!   JobListParamsr.   rk   rl   rA   rB   rC   rD   s          r/   listz	Jobs.list   st    8 !!.(+'%%!&!&  $1     ! " 
 
 	
r1   c          	         |st          d|          |                     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
        rb   rc   /cancelrV   rd   rf   r[   r    r$   rh   s         r/   cancelzJobs.cancel   sq    . " 	ywaswwxxxzz<!3<<<(+Q[el   "  
 
 	
r1   "SyncCursorPage[FineTuningJobEvent]c                   |st          d|          |                     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
        rb   rc   z/eventsrr   rs   ru   )rf   rw   r   r%   r    r   r#   JobListEventsParamsr.   r_   rk   rl   rA   rB   rC   rD   s           r/   list_eventszJobs.list_events  s    : " 	ywaswwxxx!!<!3<<< 23(+'%%!&!&  +>    %! " 
 
 	
r1   )r)   r   )r)   r2   )r)   r6   rE   rF   rG   rH   r;   rI   r<   rJ   r=   rK   r>   rL   r?   rM   r@   rM   rA   rN   rB   rO   rC   rP   rD   rQ   r)   r$   r_   rH   rA   rN   rB   rO   rC   rP   rD   rQ   r)   r$   )rk   rm   rl   rn   rA   rN   rB   rO   rC   rP   rD   rQ   r)   ro   )r_   rH   rk   rm   rl   rn   rA   rN   rB   rO   rC   rP   rD   rQ   r)   r   __name__
__module____qualname__r   r0   r5   r9   r
   r^   ri   rz   r   r    r1   r/   r&   r&   '   s~       ) ) ) _) ) ) ) _) / / / _/ IRU^6?)2+44= )-$("&;D!j
 j
 j
 j
 j
 j
d )-$("&;D!
 !
 !
 !
 !
 !
L !* ) )-$("&;D-
 -
 -
 -
 -
 -
j )-$("&;D
 
 
 
 
 
J !* ) )-$("&;D0
 0
 0
 0
 0
 0
 0
 0
r1   c                      e Zd Zed0d            Zed1d            Zed2d            Zeeeeeeddded	
d3d"Zddded#d4d%Z	eeddded&d5d,Z
ddded#d4d-Zeeddded&d6d/ZdS )7r'   r)   r   c                *    t          | j                  S r+   )r   r,   r-   s    r/   r0   zAsyncJobs.checkpointsR  s    ---r1   AsyncJobsWithRawResponsec                     t          |           S r4   )r   r-   s    r/   r5   zAsyncJobs.with_raw_responseV  s     (---r1   AsyncJobsWithStreamingResponsec                     t          |           S r8   )r   r-   s    r/   r9   z!AsyncJobs.with_streaming_response`  s     .d333r1   Nr:   rE   rF   rG   rH   r;   rI   r<   rJ   r=   rK   r>   rL   r?   rM   r@   rA   rN   rB   rO   rC   rP   rD   rQ   r$   c                  K   |                      dt          ||||||||dt          j                   d{V t	          |	|
||          t
                     d{V S )rS   rT   rU   NrV   rW   )r[   r   r"   r\   r    r$   r]   s                r/   r^   zAsyncJobs.createi  s      n ZZ,"%2'6$0$ $'6	 	 "1        )+Q[el   "%   
 
 
 
 
 
 
 
 	
r1   rV   r_   c          	        K   |st          d|          |                     d| t          ||||          t                     d{V S )ra   rb   rc   rV   rd   Nre   rh   s         r/   ri   zAsyncJobs.retrieve  s      2 " 	ywaswwxxxYY5!355(+Q[el   "  
 
 
 
 
 
 
 
 	
r1   rj   rk   rm   rl   rn   =AsyncPaginator[FineTuningJob, AsyncCursorPage[FineTuningJob]]c                   |                      dt          t                   t          ||||t	          ||dt
          j                            t                    S rq   )rw   r   r$   r    r   r!   rx   ry   s          r/   rz   zAsyncJobs.list  st    8 !! /(+'%%!&!&  $1     ! " 
 
 	
r1   c          	        K   |st          d|          |                     d| dt          ||||          t                     d{V S )r|   rb   rc   r}   rV   rd   Nr~   rh   s         r/   r   zAsyncJobs.cancel'  s      . " 	ywaswwxxxZZ<!3<<<(+Q[el   "   
 
 
 
 
 
 
 
 	
r1   GAsyncPaginator[FineTuningJobEvent, AsyncCursorPage[FineTuningJobEvent]]c                   |st          d|          |                     d| dt          t                   t	          ||||t          ||dt          j                            t                    S r   )rf   rw   r   r%   r    r   r#   r   r   s           r/   r   zAsyncJobs.list_eventsH  s    : " 	ywaswwxxx!!<!3<<< !34(+'%%!&!&  +>    %! " 
 
 	
r1   )r)   r   )r)   r   )r)   r   r   r   )rk   rm   rl   rn   rA   rN   rB   rO   rC   rP   rD   rQ   r)   r   )r_   rH   rk   rm   rl   rn   rA   rN   rB   rO   rC   rP   rD   rQ   r)   r   r   r   r1   r/   r'   r'   Q  s~       . . . _. . . . _. 4 4 4 _4 IRU^6?)2+44= )-$("&;D!j
 j
 j
 j
 j
 j
d )-$("&;D!
 !
 !
 !
 !
 !
L !* ) )-$("&;D-
 -
 -
 -
 -
 -
j )-$("&;D
 
 
 
 
 
J !* ) )-$("&;D0
 0
 0
 0
 0
 0
 0
 0
r1   c                  .    e Zd Zd	dZed
d            ZdS )r2   jobsr&   r)   Nonec                @   || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S r+   )_jobsr	   to_raw_response_wrapperr^   ri   rz   r   r   r.   r   s     r/   __init__zJobsWithRawResponse.__init__|  s    
&>K
 
 )@M
 
 %<I
 
	 '>K
 
 ,C
 
r1   r   c                4    t          | j        j                  S r+   )r   r   r0   r-   s    r/   r0   zJobsWithRawResponse.checkpoints  s    )$**@AAAr1   Nr   r&   r)   r   )r)   r   r   r   r   r   r   r0   r   r1   r/   r2   r2   {  sN        
 
 
 
& B B B _B B Br1   r2   c                  .    e Zd Zd	dZed
d            ZdS )r   r   r'   r)   r   c                @   || _         t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        t          j        |j                  | _        d S r+   )r   r	   async_to_raw_response_wrapperr^   ri   rz   r   r   r   s     r/   r   z!AsyncJobsWithRawResponse.__init__  s    
&DK
 
 )FM
 
 %BI
 
	 'DK
 
 ,I
 
r1   r   c                4    t          | j        j                  S r+   )r   r   r0   r-   s    r/   r0   z$AsyncJobsWithRawResponse.checkpoints  s    .tz/EFFFr1   Nr   r'   r)   r   )r)   r   r   r   r1   r/   r   r     sN        
 
 
 
& G G G _G G Gr1   r   c                  .    e Zd Zd	dZed
d            ZdS )r6   r   r&   r)   r   c                   || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        d S r+   )r   r   r^   ri   rz   r   r   r   s     r/   r   z"JobsWithStreamingResponse.__init__  s    
2K
 
 5M
 
 1I
 
	 3K
 
 8
 
r1   r   c                4    t          | j        j                  S r+   )r   r   r0   r-   s    r/   r0   z%JobsWithStreamingResponse.checkpoints  s    /
0FGGGr1   Nr   )r)   r   r   r   r1   r/   r6   r6     sN        
 
 
 
& H H H _H H Hr1   r6   c                  .    e Zd Zd	dZed
d            ZdS )r   r   r'   r)   r   c                   || _         t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        t          |j                  | _        d S r+   )r   r   r^   ri   rz   r   r   r   s     r/   r   z'AsyncJobsWithStreamingResponse.__init__  s    
8K
 
 ;M
 
 7I
 
	 9K
 
 >
 
r1   r   c                4    t          | j        j                  S r+   )r   r   r0   r-   s    r/   r0   z*AsyncJobsWithStreamingResponse.checkpoints  s    4TZ5KLLLr1   Nr   )r)   r   r   r   r1   r/   r   r     sN        
 
 
 
& M M M _M M Mr1   r   )8
__future__r   typingr   r   r   typing_extensionsr   httpx r	   _typesr
   r   r   r   r   _utilsr   r   _compatr   r0   r   r   r   r   r   r   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r    types.fine_tuningr!   r"   r#   !types.fine_tuning.fine_tuning_jobr$   'types.fine_tuning.fine_tuning_job_eventr%   __all__r&   r'   r2   r   r6   r   r   r1   r/   <module>r      s   # " " " " " , , , , , , , , , , % % % % % %  ! ! ! ! ! ! @ @ @ @ @ @ @ @ @ @ @ @ @ @        ( ' ' ' ' '                < ; ; ; ; ; ; ; Z Z Z Z Z Z Z Z : : : : : : : :        ] \ \ \ \ \ \ \ \ \ ? ? ? ? ? ? J J J J J J;
g
 g
 g
 g
 g
? g
 g
 g
T	g
 g
 g
 g
 g
  g
 g
 g
T	B B B B B B B B2G G G G G G G G2H H H H H H H H2M M M M M M M M M Mr1   