o
    i                     @   s   d Z ddlmZ ddl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 dd	lmZ dd
lmZmZmZmZ G dd deZdS )zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )BaseSDK    )datetime)modelsutils)HookContext)OptionalNullableUNSET)get_security_from_env)unmarshal_json_response)ListMappingOptionalUnionc                "   @   s4  e Zd Zddeeedeeeeedddddee dee dee d	ee d
ee dee	 dee
j dee dee dee deej dee dee deeeef  de
jfddZddeeedeeeeedddddee dee dee d	ee d
ee dee	 dee
j dee dee dee deej dee dee deeeef  de
jfddZdeeeddeeeedddddedee
je
jf deeee
j ee
j f  deee  dee deeee
j ee
j f  dee	 dee d ee
j d!eeee
j ee
j f  d"eeee
j ee
j f  deej dee dee deeeef  de
j f d#d$Z!deeeddeeeedddddedee
je
jf deeee
j ee
j f  deee  dee deeee
j ee
j f  dee	 dee d ee
j d!eeee
j ee
j f  d"eeee
j ee
j f  deej dee dee deeeef  de
j f d%d&Z"edddd'd(edeej dee dee deeeef  de
j#fd)d*Z$edddd'd(edeej dee dee deeeef  de
j#fd+d,Z%edddd'd(edeej dee dee deeeef  de
j&fd-d.Z'edddd'd(edeej dee dee deeeef  de
j&fd/d0Z(edddd'd(edeej dee dee deeeef  de
j)fd1d2Z*edddd'd(edeej dee dee deeeef  de
j)fd3d4Z+dS )5Jobsr   d   FN)page	page_sizemodelcreated_aftercreated_beforecreated_by_mestatuswandb_project
wandb_namesuffixretries
server_url
timeout_mshttp_headersr   r   r   r   r   r   r   r   r   r   r   r   r   r   returnc                C   sX  d}d}|du r| j j}|dur|}n| ||}tj|||||||||	|
d
}| jdd|||ddddd|| j j|d	}|tkrJ| j jturJ| j j}d}t	|t
jrX|g d
f}| jt| j |p`ddg t| j jtjd|ddg|d}t
|ddrttj|S t
|ddrt
|}td||t
|ddrt
|}td||td|a  Get Fine Tuning Jobs

        Get a list of fine-tuning jobs for your organization and user.

        :param page: The page number of the results to be returned.
        :param page_size: The number of items to return per page.
        :param model: The model name used for fine-tuning to filter on. When set, the other results are not displayed.
        :param created_after: The date/time to filter on. When set, the results for previous creation times are not displayed.
        :param created_before:
        :param created_by_me: When set, only return results for jobs created by the API caller. Other results are not displayed.
        :param status: The current job state to filter on. When set, the other results are not displayed.
        :param wandb_project: The Weights and Biases project to filter on. When set, the other results are not displayed.
        :param wandb_name: The Weight and Biases run name to filter on. When set, the other results are not displayed.
        :param suffix: The model suffix to filter on. When set, the other results are not displayed.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        N)
r   r   r   r   r   r   r   r   r   r   GET/v1/fine_tuning/jobsFT
user-agentapplication/jsonmethodpathbase_urlurl_variablesrequestrequest_body_requiredrequest_has_path_paramsrequest_has_query_paramsuser_agent_headeraccept_header_valuer   securityr   429500502503504 0jobs_api_routes_fine_tuning_get_fine_tuning_jobsconfigr)   operation_idoauth2_scopessecurity_source4XX5XXhook_ctxr+   error_status_codesretry_config200*API error occurredUnexpected response received)sdk_configurationr   _get_urlr   /JobsAPIRoutesFineTuningGetFineTuningJobsRequest_build_requestr1   r	   rD   
isinstancer   RetryConfig
do_requestr   r
   Securitymatch_responser   JobsOutstream_to_textSDKErrorselfr   r   r   r   r   r   r   r   r   r   r   r   r   r   r)   r*   r+   reqrD   http_reshttp_res_text rZ   T/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/mistralai/jobs.pylist   s~   %
	

z	Jobs.listc                   sl  d}d}|du r| j j}|dur|}n| ||}tj|||||||||	|
d
}| jdd|||ddddd|| j j|d	}|tkrK| j jturK| j j}d}t	|t
jrY|g d
f}| jt| j |paddg t| j jtjd|ddg|dI dH }t
|ddrttj|S t
|ddrt
|I dH }td||t
|ddrt
|I dH }td||td|r!   )rI   r   rJ   r   rK   _build_request_asyncr1   r	   rD   rM   r   rN   do_request_asyncr   r
   rP   rQ   r   rR   stream_to_text_asyncrT   rU   rZ   rZ   r[   
list_async|   s   %
	zJobs.list_async)training_filesvalidation_filesr   integrations
auto_startinvalid_sample_skip_percentagejob_typerepositoriesclassifier_targetsr   r   r   r   hyperparametersra   rb   rc   rd   re   rf   rg   rh   c                   s  d}d}|du r| j j}|dur|}n| ||}tj|t|tttj	  ||t|t
ttj  |||	t|tjt|
t
ttj  t|t
ttj  d | jdd|| ddddd|| j j fd	d
|d}|tkry| j jtury| j j}d}t|tjr|g df}| jt| j |pddg t| j jtjd|ddg|d}t|ddrttj|S t|ddrt|}td||t|ddrt|}td||td|)  Create Fine Tuning Job

        Create a new fine-tuning job, it will be queued for processing.

        :param model: The name of the model to fine-tune.
        :param hyperparameters:
        :param training_files:
        :param validation_files: A list containing the IDs of uploaded files that contain validation data. If you provide these files, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in `checkpoints` when getting the status of a running fine-tuning job. The same data should not be present in both train and validation files.
        :param suffix: A string that will be added to your fine-tuning model name. For example, a suffix of \"my-great-model\" would produce a model name like `ft:open-mistral-7b:my-great-model:xxx...`
        :param integrations: A list of integrations to enable for your fine-tuning job.
        :param auto_start: This field will be required in a future release.
        :param invalid_sample_skip_percentage:
        :param job_type:
        :param repositories:
        :param classifier_targets:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr   ra   rb   r   rc   rd   re   rf   ri   rg   rh   POSTr#   TFr$   r%   c                         t  dddtjS NFjsonr   serialize_request_bodyr   JobInrZ   r+   rZ   r[   <lambda>O      zJobs.create.<locals>.<lambda>r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r   r1   get_serialized_bodyr   r2   r8   2jobs_api_routes_fine_tuning_create_fine_tuning_jobr:   r?   r@   rA   rE   rF   rG   rH   )rI   r   rJ   r   rr   r   get_pydantic_modelr   r   TrainingFiler   JobInIntegrationsHyperparametersJobInRepositoriesClassifierTargetInrL   r1   r	   rD   rM   rN   rO   r   r
   rP   rQ   r   2JobsAPIRoutesFineTuningCreateFineTuningJobResponserS   rT   rV   r   ri   ra   rb   r   rc   rd   re   rf   rg   rh   r   r   r   r   r)   r*   rW   rD   rX   rY   rZ   rs   r[   create   s   6

	

zJobs.createc                   s  d}d}|du r| j j}|dur|}n| ||}tj|t|tttj	  ||t|t
ttj  |||	t|tjt|
t
ttj  t|t
ttj  d | jdd|| ddddd|| j j fd	d
|d}|tkrz| j jturz| j j}d}t|tjr|g df}| jt| j |pddg t| j jtjd|ddg|dI dH }t|ddrttj|S t|ddrt|I dH }td||t|ddrt|I dH }td||td|)rj   Nrk   rl   r#   TFr$   r%   c                      rm   rn   rp   rZ   rs   rZ   r[   rt     ru   z#Jobs.create_async.<locals>.<lambda>rv   r2   r8   rx   r:   r?   r@   rA   rE   rF   rG   rH   )rI   r   rJ   r   rr   r   ry   r   r   rz   r   r{   r|   r}   r~   r]   r1   r	   rD   rM   rN   r^   r   r
   rP   rQ   r   r   r_   rT   r   rZ   rs   r[   create_asyncy  s   6

	zJobs.create_async)r   r   r   r   job_idc                C   F  d}d}|du r| j j}|dur|}n| ||}tj|d}| jdd|||ddddd|| j j|d	}	|tkrA| j jturA| j j}d}
t	|t
jrO|g d
f}
| jt| j |pWddg t| j jtjd|	ddg|
d}t
|ddrwttj|S t
|ddrt
|}td||t
|ddrt
|}td||td|a  Get Fine Tuning Job

        Get a fine-tuned job details by its UUID.

        :param job_id: The ID of the job to analyse.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr   r"   z/v1/fine_tuning/jobs/{job_id}FTr$   r%   r&   r2   r8   /jobs_api_routes_fine_tuning_get_fine_tuning_jobr:   r?   r@   rA   rE   rF   rG   rH   )rI   r   rJ   r   .JobsAPIRoutesFineTuningGetFineTuningJobRequestrL   r1   r	   rD   rM   r   rN   rO   r   r
   rP   rQ   r   /JobsAPIRoutesFineTuningGetFineTuningJobResponserS   rT   rV   r   r   r   r   r   r)   r*   r+   rW   rD   rX   rY   rZ   rZ   r[   get  p   
	

zJobs.getc                   Z  d}d}|du r| j j}|dur|}n| ||}tj|d}| jdd|||ddddd|| j j|d	}	|tkrB| j jturB| j j}d}
t	|t
jrP|g d
f}
| jt| j |pXddg t| j jtjd|	ddg|
dI dH }t
|ddr{ttj|S t
|ddrt
|I dH }td||t
|ddrt
|I dH }td||td|r   )rI   r   rJ   r   r   r]   r1   r	   rD   rM   r   rN   r^   r   r
   rP   rQ   r   r   r_   rT   r   rZ   rZ   r[   	get_async]  r   
	zJobs.get_asyncc                C   r   a  Cancel Fine Tuning Job

        Request the cancellation of a fine tuning job.

        :param job_id: The ID of the job to cancel.
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr   rl   z$/v1/fine_tuning/jobs/{job_id}/cancelFTr$   r%   r&   r2   r8   2jobs_api_routes_fine_tuning_cancel_fine_tuning_jobr:   r?   r@   rA   rE   rF   rG   rH   )rI   r   rJ   r   1JobsAPIRoutesFineTuningCancelFineTuningJobRequestrL   r1   r	   rD   rM   r   rN   rO   r   r
   rP   rQ   r   2JobsAPIRoutesFineTuningCancelFineTuningJobResponserS   rT   r   rZ   rZ   r[   cancel  r   zJobs.cancelc                   r   r   )rI   r   rJ   r   r   r]   r1   r	   rD   rM   r   rN   r^   r   r
   rP   rQ   r   r   r_   rT   r   rZ   rZ   r[   cancel_async  r   zJobs.cancel_asyncc                C   r   a  Start Fine Tuning Job

        Request the start of a validated fine tuning job.

        :param job_id:
        :param retries: Override the default retry configuration for this method
        :param server_url: Override the default server URL for this method
        :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
        :param http_headers: Additional headers to set or replace on requests.
        Nr   rl   z#/v1/fine_tuning/jobs/{job_id}/startFTr$   r%   r&   r2   r8   1jobs_api_routes_fine_tuning_start_fine_tuning_jobr:   r?   r@   rA   rE   rF   rG   rH   )rI   r   rJ   r   0JobsAPIRoutesFineTuningStartFineTuningJobRequestrL   r1   r	   rD   rM   r   rN   rO   r   r
   rP   rQ   r   1JobsAPIRoutesFineTuningStartFineTuningJobResponserS   rT   r   rZ   rZ   r[   start\  r   z
Jobs.startc                   r   r   )rI   r   rJ   r   r   r]   r1   r	   rD   rM   r   rN   r^   r   r
   rP   rQ   r   r   r_   rT   r   rZ   rZ   r[   start_async  r   zJobs.start_async),__name__
__module____qualname__r	   r   intr   strr   boolr   QueryParamStatusr   rN   r   rR   r\   r`   r   r|   HyperparametersTypedDictr   rz   TrainingFileTypedDictr{   JobInIntegrationsTypedDictfloatFineTuneableModelTyper}   JobInRepositoriesTypedDictr~   ClassifierTargetInTypedDictr   r   r   r   r   r   r   r   r   r   r   r   rZ   rZ   rZ   r[   r      s~   	

q	

u
	
 !
 
	
 !
 
Y
Y
Y
Y
Yr   N)__doc__basesdkr   r   	mistralair   r   mistralai._hooksr   mistralai.typesr   r	   mistralai.utilsr
   'mistralai.utils.unmarshal_json_responser   typingr   r   r   r   r   rZ   rZ   rZ   r[   <module>   s    