
    hY%h                       d dl mZ d dlmZ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l0m1Z1 ddl2m3Z3 ddgZ4 G d de      Z5 G d de       Z6 G d d      Z7 G d d      Z8 G d d      Z9 G d d      Z:y)     )annotations)Dict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)Metadata)FineTuningJob)FineTuningJobEventJobs	AsyncJobsc                     e Zd Zedd       Zedd       Zedd       Zeeeeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded	 	 	 	 	 	 	 	 	 	 	 d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ddded	 	 	 	 	 	 	 	 	 	 	 ddZy)r(   c                ,    t        | j                        S N)r   _clientselfs    |/var/www/pru.catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/openai/resources/fine_tuning/jobs/jobs.pycheckpointszJobs.checkpoints&   s    4<<((    c                    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
        )JobsWithRawResponser.   s    r0   with_raw_responsezJobs.with_raw_response*   s     #4((r2   c                    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
        )JobsWithStreamingResponser.   s    r0   with_streaming_responsezJobs.with_streaming_response4   s     )..r2   Nhyperparametersintegrationsmetadatamethodseedsuffixvalidation_fileextra_headersextra_query
extra_bodytimeoutc                   | j                  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.

          metadata: Set of 16 key-value pairs that can be attached to an object. This can be useful
              for storing additional information about the object in a structured format, and
              querying for objects via API or the dashboard.

              Keys are strings with a maximum length of 64 characters. Values are strings with
              a maximum length of 512 characters.

          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	modeltraining_filer<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   bodyoptionscast_to)_postr   r#   JobCreateParamsr!   r&   r/   rK   rL   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   s                 r0   createzJobs.create=   sk    ~ zz "%2'6$0 ($ $'6
 "11 )+Q[el "'  
 	
r2   rM   c          	     r    |st        d|      | 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
        AExpected a non-empty value for `fine_tuning_job_id` but received /fine_tuning/jobs/rM   rP   rQ   
ValueError_getr!   r&   r/   fine_tuning_job_idrC   rD   rE   rF   s         r0   retrievezJobs.retrieve   sV    2 "`as`vwxxyy !3 45(+Q[el "  
 	
r2   afterlimitr>   rC   rD   rE   rF   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.

          metadata: Optional metadata filter. To filter, use the syntax `metadata[k]=v`.
              Alternatively, set `metadata=null` to indicate no metadata.

          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
        rI   )rb   rc   r>   rC   rD   rE   rF   querypagerP   rK   )_get_api_listr   r&   r!   r   r"   JobListParamsr/   rb   rc   r>   rC   rD   rE   rF   s           r0   listz	Jobs.list   sb    @ !!.(+'%%!&!&$,
 $11  # " 
 	
r2   c          	     t    |st        d|      | 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
        rX   rY   /cancelrM   rZ   r\   rR   r!   r&   r^   s         r0   cancelzJobs.cancel	  X    . "`as`vwxxzz !3 4G<(+Q[el "  
 	
r2   rb   rc   rC   rD   rE   rF   c                   |st        d|      | 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
        rX   rY   z/events)rb   rc   rf   rh   )r\   rj   r   r'   r!   r   r$   JobListEventsParamsr/   r_   rb   rc   rC   rD   rE   rF   s           r0   list_eventszJobs.list_events*  s    : "`as`vwxx!! !3 4G< 23(+'%%!&!& +>> %! " 
 	
r2   c          	     t    |st        d|      | j                  d| dt        ||||      t              S )J  
        Pause 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
        rX   rY   /pauserM   rZ   rq   r^   s         r0   pausez
Jobs.pause\  sX    . "`as`vwxxzz !3 4F;(+Q[el "  
 	
r2   c          	     t    |st        d|      | j                  d| dt        ||||      t              S )K  
        Resume 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
        rX   rY   /resumerM   rZ   rq   r^   s         r0   resumezJobs.resume}  rs   r2   )returnr   )r   r5   )r   r9   rK   zQUnion[str, Literal['babbage-002', 'davinci-002', 'gpt-3.5-turbo', 'gpt-4o-mini']]rL   strr<   z,job_create_params.Hyperparameters | NotGivenr=   z<Optional[Iterable[job_create_params.Integration]] | NotGivenr>   zOptional[Metadata] | NotGivenr?   z#job_create_params.Method | NotGivenr@   zOptional[int] | NotGivenrA   Optional[str] | NotGivenrB   r   rC   Headers | NonerD   Query | NonerE   Body | NonerF   'float | httpx.Timeout | None | NotGivenr   r&   r_   r   rC   r   rD   r   rE   r   rF   r   r   r&   )rb   str | NotGivenrc   int | NotGivenr>   #Optional[Dict[str, str]] | NotGivenrC   r   rD   r   rE   r   rF   r   r   zSyncCursorPage[FineTuningJob])r_   r   rb   r   rc   r   rC   r   rD   r   rE   r   rF   r   r   z"SyncCursorPage[FineTuningJobEvent]__name__
__module____qualname__r   r1   r6   r:   r   rU   r`   rm   rr   ry   r}   r    r2   r0   r(   r(   %   s   ) ) ) ) / / IRU^2;6?)2+44= )-$("&;D#s
 as
 	s

 Fs
 Ss
 0s
 4s
 's
 )s
 2s
 &s
 "s
   !s
" 9#s
$ 
%s
v )-$("&;D!
!
 &!
 "!
  !
 9!
 
!
L !* )8A )-$("&;D2
 2
 	2

 62
 &2
 "2
  2
 92
 
'2
t )-$("&;D

 &
 "
  
 9
 

J !* ) )-$("&;D0
0
 	0

 0
 &0
 "0
  0
 90
 
,0
p )-$("&;D

 &
 "
  
 9
 

N )-$("&;D

 &
 "
  
 9
 

r2   c                     e Zd Zedd       Zedd       Zedd       Zeeeeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded	 	 	 	 	 	 	 	 	 	 	 d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ddded	 	 	 	 	 	 	 	 	 	 	 ddZy)r)   c                ,    t        | j                        S r,   )r   r-   r.   s    r0   r1   zAsyncJobs.checkpoints  s    --r2   c                    t        |       S r4   )AsyncJobsWithRawResponser.   s    r0   r6   zAsyncJobs.with_raw_response  s     (--r2   c                    t        |       S r8   )AsyncJobsWithStreamingResponser.   s    r0   r:   z!AsyncJobs.with_streaming_response  s     .d33r2   Nr;   c                  K   | j                  dt        |||||||||	d	t        j                         d{   t	        |
|||      t
               d{   S 7 $7 w)rH   rI   rJ   NrM   rN   )rR   r   r#   rS   r!   r&   rT   s                 r0   rU   zAsyncJobs.create  s     ~ ZZ,"%2'6$0 ($ $'6
 "11  )+Q[el "'   
 
 	

s!   4AA
AAAArM   c          	        K   |st        d|      | j                  d| t        ||||      t               d{   S 7 w)rW   rX   rY   rM   rZ   Nr[   r^   s         r0   r`   zAsyncJobs.retrieve,  sd     2 "`as`vwxxYY !3 45(+Q[el "  
 
 	
 
s   <AAAra   c                   | j                  dt        t           t        ||||t	        |||dt
        j                              t              S re   )rj   r   r&   r!   r   r"   rk   rl   s           r0   rm   zAsyncJobs.listO  sb    @ !! /(+'%%!&!&$,
 $11  # " 
 	
r2   c          	        K   |st        d|      | j                  d| dt        ||||      t               d{   S 7 w)ro   rX   rY   rp   rM   rZ   Nrq   r^   s         r0   rr   zAsyncJobs.cancel  f     . "`as`vwxxZZ !3 4G<(+Q[el "   
 
 	
 
   =AA Art   c                   |st        d|      | j                  d| dt        t           t	        ||||t        ||dt        j                              t              S rv   )r\   rj   r   r'   r!   r   r$   rw   rx   s           r0   ry   zAsyncJobs.list_events  s    : "`as`vwxx!! !3 4G< !34(+'%%!&!& +>> %! " 
 	
r2   c          	        K   |st        d|      | j                  d| dt        ||||      t               d{   S 7 w)r{   rX   rY   r|   rM   rZ   Nrq   r^   s         r0   r}   zAsyncJobs.pause  sf     . "`as`vwxxZZ !3 4F;(+Q[el "   
 
 	
 
r   c          	        K   |st        d|      | j                  d| dt        ||||      t               d{   S 7 w)r   rX   rY   r   rM   rZ   Nrq   r^   s         r0   r   zAsyncJobs.resume  r   r   )r   r   )r   r   )r   r   r   r   )rb   r   rc   r   r>   r   rC   r   rD   r   rE   r   rF   r   r   z=AsyncPaginator[FineTuningJob, AsyncCursorPage[FineTuningJob]])r_   r   rb   r   rc   r   rC   r   rD   r   rE   r   rF   r   r   zGAsyncPaginator[FineTuningJobEvent, AsyncCursorPage[FineTuningJobEvent]]r   r   r2   r0   r)   r)     s   . . . . 4 4 IRU^2;6?)2+44= )-$("&;D#s
 as
 	s

 Fs
 Ss
 0s
 4s
 's
 )s
 2s
 &s
 "s
   !s
" 9#s
$ 
%s
v )-$("&;D!
!
 &!
 "!
  !
 9!
 
!
L !* )8A )-$("&;D2
 2
 	2

 62
 &2
 "2
  2
 92
 
G2
t )-$("&;D

 &
 "
  
 9
 

J !* ) )-$("&;D0
0
 	0

 0
 &0
 "0
  0
 90
 
Q0
p )-$("&;D

 &
 "
  
 9
 

N )-$("&;D

 &
 "
  
 9
 

r2   c                  &    e Zd ZddZedd       Zy)r5   c                
   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j                        | _	        y r,   )
_jobsr
   to_raw_response_wrapperrU   r`   rm   rr   ry   r}   r   r/   jobss     r0   __init__zJobsWithRawResponse.__init__  s    
&>>KK
 )@@MM
 %<<II
	 '>>KK
 ,CC
 &==JJ

 '>>KK
r2   c                @    t        | j                  j                        S r,   )r   r   r1   r.   s    r0   r1   zJobsWithRawResponse.checkpoints3  s    )$***@*@AAr2   Nr   r(   r   None)r   r   r   r   r   r   r   r1   r   r2   r0   r5   r5     s    
2 B Br2   r5   c                  &    e Zd ZddZedd       Zy)r   c                
   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j                        | _	        y r,   )
r   r
   async_to_raw_response_wrapperrU   r`   rm   rr   ry   r}   r   r   s     r0   r   z!AsyncJobsWithRawResponse.__init__9  s    
&DDKK
 )FFMM
 %BBII
	 'DDKK
 ,II
 &CCJJ

 'DDKK
r2   c                @    t        | j                  j                        S r,   )r   r   r1   r.   s    r0   r1   z$AsyncJobsWithRawResponse.checkpointsR  s    .tzz/E/EFFr2   Nr   r)   r   r   )r   r   r   r   r2   r0   r   r   8  s    
2 G Gr2   r   c                  &    e Zd ZddZedd       Zy)r9   c                ~   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        t        |j                        | _        y r,   )	r   r   rU   r`   rm   rr   ry   r}   r   r   s     r0   r   z"JobsWithStreamingResponse.__init__X  s    
2KK
 5MM
 1II
	 3KK
 8
 2JJ

 3KK
r2   c                @    t        | j                  j                        S r,   )r   r   r1   r.   s    r0   r1   z%JobsWithStreamingResponse.checkpointsq  s    /

0F0FGGr2   Nr   )r   r   r   r   r2   r0   r9   r9   W  s    
2 H Hr2   r9   c                  &    e Zd ZddZedd       Zy)r   c                ~   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                        | _        t        |j                        | _        t        |j                        | _        y r,   )	r   r   rU   r`   rm   rr   ry   r}   r   r   s     r0   r   z'AsyncJobsWithStreamingResponse.__init__w  s    
8KK
 ;MM
 7II
	 9KK
 >
 8JJ

 9KK
r2   c                @    t        | j                  j                        S r,   )r   r   r1   r.   s    r0   r1   z*AsyncJobsWithStreamingResponse.checkpoints  s    4TZZ5K5KLLr2   Nr   )r   r   r   r   r2   r0   r   r   v  s    
2 M Mr2   r   );
__future__r   typingr   r   r   r   typing_extensionsr   httpx r
   _typesr   r   r   r   r   _utilsr   r   _compatr   r1   r   r   r   r   r   r   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr    r!   types.fine_tuningr"   r#   r$   types.shared_params.metadatar%   !types.fine_tuning.fine_tuning_jobr&   'types.fine_tuning.fine_tuning_job_eventr'   __all__r(   r)   r5   r   r9   r   r   r2   r0   <module>r      s    # 2 2 %  ! @ @ = '  < Z : ] \ 5 ? J;
w
? w
tw
  w
tB B>G G>H H>M Mr2   