
    f j_                    ~   d dl mZ d dl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 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& ddgZ' G d de          Z( G d de          Z) G d d          Z* G d d          Z+ G d d          Z, G d d          Z-dS )    )annotations)UnionOptional)LiteralN   )_legacy_response)	NOT_GIVENBodyQueryHeadersNotGiven)maybe_transformasync_maybe_transform)cached_property)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)SyncCursorPageAsyncCursorPage)AsyncPaginatormake_request_options)FineTuningJobFineTuningJobEventjob_list_paramsjob_create_paramsjob_list_events_paramsJobs	AsyncJobsc                      e Zd Zed(d            Ze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
eedddedd-d'ZdS ).r   returnJobsWithRawResponsec                     t          |           S N)r"   selfs    uC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\openai/resources/fine_tuning/jobs.pywith_raw_responsezJobs.with_raw_response$   s    "4(((    JobsWithStreamingResponsec                     t          |           S r$   )r*   r%   s    r'   with_streaming_responsezJobs.with_streaming_response(   s    (...r)   Nhyperparameterssuffixvalidation_fileextra_headersextra_query
extra_bodytimeoutmodelBUnion[str, Literal['babbage-002', 'davinci-002', 'gpt-3.5-turbo']]training_filestrr.   ,job_create_params.Hyperparameters | NotGivenr/   Optional[str] | NotGivenr0   r1   Headers | Noner2   Query | Noner3   Body | Noner4   '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/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r5   r7   r.   r/   r0   r1   r2   r3   r4   bodyoptionscast_to)_postr   r   JobCreateParamsr   r   
r&   r5   r7   r.   r/   r0   r1   r2   r3   r4   s
             r'   createzJobs.create,   su    H zz "%2'6$'6  "1	 	 )+Q[el   "  
 
 	
r)   rC   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/rC   rF   rG   
ValueError_getr   r   r&   rL   r1   r2   r3   r4   s         r'   retrievezJobs.retrieve   sn    2 " 	ywaswwxxxyy5!355(+Q[el   "  
 
 	
r)   afterlimitr1   r2   r3   r4   rX   str | NotGivenrY   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
        rA   rX   rY   r1   r2   r3   r4   querypagerF   r5   )_get_api_listr   r   r   r   r   JobListParamsr&   rX   rY   r1   r2   r3   r4   s          r'   listz	Jobs.list   st    8 !!.(+'%%!&!&  $1     ! " 
 
 	
r)   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
        rO   rP   /cancelrC   rQ   rS   rH   r   r   rU   s         r'   cancelzJobs.cancel   sq    . " 	ywaswwxxxzz<!3<<<(+Q[el   "  
 
 	
r)   "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
        rO   rP   z/eventsr_   r`   rb   )rS   rd   r   r   r   r   r   JobListEventsParamsr&   rL   rX   rY   r1   r2   r3   r4   s           r'   list_eventszJobs.list_events   s    : " 	ywaswwxxx!!<!3<<< 23(+'%%!&!&  +>    %! " 
 
 	
r)   )r!   r"   )r!   r*   r5   r6   r7   r8   r.   r9   r/   r:   r0   r:   r1   r;   r2   r<   r3   r=   r4   r>   r!   r   rL   r8   r1   r;   r2   r<   r3   r=   r4   r>   r!   r   )rX   rZ   rY   r[   r1   r;   r2   r<   r3   r=   r4   r>   r!   r\   )rL   r8   rX   rZ   rY   r[   r1   r;   r2   r<   r3   r=   r4   r>   r!   rm   __name__
__module____qualname__r   r(   r,   r	   rK   rV   rg   rl   rr    r)   r'   r   r   #   sU       ) ) ) _) / / / _/ IR+44= )-$("&;DT
 T
 T
 T
 T
 T
x )-$("&;D!
 !
 !
 !
 !
 !
L !* ) )-$("&;D-
 -
 -
 -
 -
 -
j )-$("&;D
 
 
 
 
 
J !* ) )-$("&;D0
 0
 0
 0
 0
 0
 0
 0
r)   c                      e Zd Zed(d            Ze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
eedddedd-d'ZdS ).r   r!   AsyncJobsWithRawResponsec                     t          |           S r$   )r{   r%   s    r'   r(   zAsyncJobs.with_raw_response)  s    '---r)   AsyncJobsWithStreamingResponsec                     t          |           S r$   )r}   r%   s    r'   r,   z!AsyncJobs.with_streaming_response-  s    -d333r)   Nr-   r5   r6   r7   r8   r.   r9   r/   r:   r0   r1   r;   r2   r<   r3   r=   r4   r>   r   c       	           K   |                      dt          |||||dt          j                   d{V t	          ||||	          t
                     d{V S )r@   rA   rB   NrC   rD   )rH   r   r   rI   r   r   rJ   s
             r'   rK   zAsyncJobs.create1  s      H ZZ,"%2'6$'6  "1	 	 	 	 	 	 	 	 )+Q[el   "   
 
 
 
 
 
 
 
 	
r)   rC   rL   c          	        K   |st          d|          |                     d| t          ||||          t                     d{V S )rN   rO   rP   rC   rQ   NrR   rU   s         r'   rV   zAsyncJobs.retrieve  s      2 " 	ywaswwxxxYY5!355(+Q[el   "  
 
 
 
 
 
 
 
 	
r)   rW   rX   rZ   rY   r[   =AsyncPaginator[FineTuningJob, AsyncCursorPage[FineTuningJob]]c                   |                      dt          t                   t          ||||t	          ||dt
          j                            t                    S r^   )rd   r   r   r   r   r   re   rf   s          r'   rg   zAsyncJobs.list  st    8 !! /(+'%%!&!&  $1     ! " 
 
 	
r)   c          	        K   |st          d|          |                     d| dt          ||||          t                     d{V S )ri   rO   rP   rj   rC   rQ   Nrk   rU   s         r'   rl   zAsyncJobs.cancel  s      . " 	ywaswwxxxZZ<!3<<<(+Q[el   "   
 
 
 
 
 
 
 
 	
r)   GAsyncPaginator[FineTuningJobEvent, AsyncCursorPage[FineTuningJobEvent]]c                   |st          d|          |                     d| dt          t                   t	          ||||t          ||dt          j                            t                    S ro   )rS   rd   r   r   r   r   r   rp   rq   s           r'   rr   zAsyncJobs.list_events  s    : " 	ywaswwxxx!!<!3<<< !34(+'%%!&!&  +>    %! " 
 
 	
r)   )r!   r{   )r!   r}   rs   rt   )rX   rZ   rY   r[   r1   r;   r2   r<   r3   r=   r4   r>   r!   r   )rL   r8   rX   rZ   rY   r[   r1   r;   r2   r<   r3   r=   r4   r>   r!   r   ru   ry   r)   r'   r   r   (  sU       . . . _. 4 4 4 _4 IR+44= )-$("&;DT
 T
 T
 T
 T
 T
x )-$("&;D!
 !
 !
 !
 !
 !
L !* ) )-$("&;D-
 -
 -
 -
 -
 -
j )-$("&;D
 
 
 
 
 
J !* ) )-$("&;D0
 0
 0
 0
 0
 0
 0
 0
r)   c                      e Zd ZddZdS )r"   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_wrapperrK   rV   rg   rl   rr   r&   r   s     r'   __init__zJobsWithRawResponse.__init__.  s    
&>K
 
 )@M
 
 %<I
 
	 '>K
 
 ,C
 
r)   Nr   r   r!   r   rv   rw   rx   r   ry   r)   r'   r"   r"   -  (        
 
 
 
 
 
r)   r"   c                      e Zd Z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_wrapperrK   rV   rg   rl   rr   r   s     r'   r   z!AsyncJobsWithRawResponse.__init__C  s    
&DK
 
 )FM
 
 %BI
 
	 'DK
 
 ,I
 
r)   Nr   r   r!   r   r   ry   r)   r'   r{   r{   B  r   r)   r{   c                      e Zd Z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   rK   rV   rg   rl   rr   r   s     r'   r   z"JobsWithStreamingResponse.__init__X  s    
2K
 
 5M
 
 1I
 
	 3K
 
 8
 
r)   Nr   r   ry   r)   r'   r*   r*   W  r   r)   r*   c                      e Zd Z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   rK   rV   rg   rl   rr   r   s     r'   r   z'AsyncJobsWithStreamingResponse.__init__m  s    
8K
 
 ;M
 
 7I
 
	 9K
 
 >
 
r)   Nr   r   ry   r)   r'   r}   r}   l  r   r)   r}   ).
__future__r   typingr   r   typing_extensionsr   httpx r   _typesr	   r
   r   r   r   _utilsr   r   _compatr   	_resourcer   r   	_responser   r   
paginationr   r   _base_clientr   r   types.fine_tuningr   r   r   r   r   __all__r   r   r"   r{   r*   r}   ry   r)   r'   <module>r      s   # " " " " " " " " " " " " " % % % % % %              ? ? ? ? ? ? ? ? ? ? ? ? ? ?        ' & & & & & : : : : : : : : Y Y Y Y Y Y Y Y 9 9 9 9 9 9 9 9                     ;
B
 B
 B
 B
 B
? B
 B
 B
JB
 B
 B
 B
 B
  B
 B
 B
J
 
 
 
 
 
 
 
*
 
 
 
 
 
 
 
*
 
 
 
 
 
 
 
*
 
 
 
 
 
 
 
 
 
r)   