o
    CjiU                     @  s  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rfddl#m$Z$m%Z% ddgZ&G dd deZ'G dd deZ(G dd dZ)G dd dZ*dS )    )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< d0 fddZeeed	d	d	ed
d1ddZd	d	d	edd2d!d"Zeed	d	d	ed#d3d)d*Zd	d	d	edd2d+d,Z	eed	d	d	ed#d4d.d/Z
  ZS )5r   JobsWithRawResponsewith_raw_responseclientr   returnNonec                      t  | t| | _d S N)super__init__r    r!   selfr"   	__class__ x/var/www/html/Resume-Parser/resume-parser-inhouse/venv/lib/python3.10/site-packages/openai/resources/fine_tuning/jobs.pyr(   !      zJobs.__init__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strr1   ,job_create_params.Hyperparameters | NotGivenr2   Optional[str] | NotGivenr3   r4   Headers | Noner5   Query | Noner6   Body | Noner7   'float | httpx.Timeout | None | NotGivenr   c       	   
   	   C  s2   | j dt|||||dtjt||||	dtd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r8   r:   r1   r2   r3   r4   r5   r6   r7   bodyoptionscast_to_postr   r   JobCreateParamsr   r   
r*   r8   r:   r1   r2   r3   r4   r5   r6   r7   r-   r-   r.   create%   s    C
zJobs.createrE   fine_tuning_job_idc                C  s"   | j d| t||||dtd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/rE   rH   rI   _getr   r   r*   rO   r4   r5   r6   r7   r-   r-   r.   retrievez   s   zJobs.retrieveafterlimitr4   r5   r6   r7   rX   str | NotGivenrY   int | NotGivenSyncCursorPage[FineTuningJob]c                C  2   | j dtt t||||t||dtjdtd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
        rC   rX   rY   r4   r5   r6   r7   querypagerH   r8   )_get_api_listr   r   r   r   r   JobListParamsr*   rX   rY   r4   r5   r6   r7   r-   r-   r.   list   "   z	Jobs.listc                C  s$   | j d| dt||||dtd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
        rQ   /cancelrE   rR   rK   r   r   rU   r-   r-   r.   cancel   s   
zJobs.cancel"SyncCursorPage[FineTuningJobEvent]c                C  :   | j d| dtt t||||t||dtjdtd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
        rQ   z/eventsr_   r`   rb   )rd   r   r   r   r   r   JobListEventsParamsr*   rO   rX   rY   r4   r5   r6   r7   r-   r-   r.   list_events   "   
zJobs.list_events)r"   r   r#   r$   r8   r9   r:   r;   r1   r<   r2   r=   r3   r=   r4   r>   r5   r?   r6   r@   r7   rA   r#   r   rO   r;   r4   r>   r5   r?   r6   r@   r7   rA   r#   r   )rX   rZ   rY   r[   r4   r>   r5   r?   r6   r@   r7   rA   r#   r\   )rO   r;   rX   rZ   rY   r[   r4   r>   r5   r?   r6   r@   r7   rA   r#   rm   __name__
__module____qualname____annotations__r(   r   rN   rV   rg   rl   rr   __classcell__r-   r-   r+   r.   r      F   
 	[$5#c                      r   )5r   AsyncJobsWithRawResponser!   r"   r   r#   r$   c                   r%   r&   )r'   r(   r}   r!   r)   r+   r-   r.   r(     r/   zAsyncJobs.__init__Nr0   r8   r9   r:   r;   r1   r<   r2   r=   r3   r4   r>   r5   r?   r6   r@   r7   rA   r   c       	   
   	     s:   | j dt|||||dtjt||||	dtdI dH S )rB   rC   rD   rE   rF   NrJ   rM   r-   r-   r.   rN   !  s"   C
zAsyncJobs.createrE   rO   c                  s*   | j d| t||||dtdI dH S )rP   rQ   rE   rR   NrS   rU   r-   r-   r.   rV   v  s   zAsyncJobs.retrieverW   rX   rZ   rY   r[   =AsyncPaginator[FineTuningJob, AsyncCursorPage[FineTuningJob]]c                C  r]   r^   )rd   r   r   r   r   r   re   rf   r-   r-   r.   rg     rh   zAsyncJobs.listc                  s,   | j d| dt||||dtdI dH S )ri   rQ   rj   rE   rR   Nrk   rU   r-   r-   r.   rl     s   
zAsyncJobs.cancelGAsyncPaginator[FineTuningJobEvent, AsyncCursorPage[FineTuningJobEvent]]c                C  rn   ro   )rd   r   r   r   r   r   rp   rq   r-   r-   r.   rr     rs   zAsyncJobs.list_events)r"   r   r#   r$   rt   ru   )rX   rZ   rY   r[   r4   r>   r5   r?   r6   r@   r7   rA   r#   r~   )rO   r;   rX   rZ   rY   r[   r4   r>   r5   r?   r6   r@   r7   rA   r#   r   rv   r-   r-   r+   r.   r     r|   c                   @     e Zd ZdddZdS )	r    jobsr   r#   r$   c                 C  @   t |j| _t |j| _t |j| _t |j| _t |j| _d S r&   )r   rN   rV   rg   rl   rr   r*   r   r-   r-   r.   r(        
zJobsWithRawResponse.__init__N)r   r   r#   r$   rw   rx   ry   r(   r-   r-   r-   r.   r          r    c                   @  r   )	r}   r   r   r#   r$   c                 C  r   r&   )r   rN   rV   rg   rl   rr   r   r-   r-   r.   r(   *  r   z!AsyncJobsWithRawResponse.__init__N)r   r   r#   r$   r   r-   r-   r-   r.   r}   )  r   r}   )+
__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    r}   r-   r-   r-   r.   <module>   s(    } }