o
    i#                     @   s   d 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    )modelsutils)HookContext)OptionalNullableUNSET)get_security_from_env)unmarshal_json_response)AnyMappingOptionalUnionc                   @   s  e Zd ZdZeddedddddedeejej	f de
e deej deej 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edddddedeejej	f de
e deej deej d	e
ej d
ee dee deeeef  dejfddZdS )
EmbeddingszEmbeddings API.N)output_dimensionoutput_dtypeencoding_formatretries
server_url
timeout_mshttp_headersmodelinputsr   r   r   r   r   r   r   returnc       	            s  d}
d}|du r| j j}|dur|}
n| |
|}
tj|||||d | jdd|
| ddddd|	| j j fd	d
|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|g d|d}d}t
|ddrttj|S t
|ddrttj|}t||t
|ddrt
|}td||t
|ddrt
|}td||td|)[  Embeddings

        Embeddings

        :param model: ID of the model to use.
        :param inputs: Text to embed.
        :param output_dimension: The dimension of the output embeddings.
        :param output_dtype:
        :param encoding_format:
        :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   POST/v1/embeddingsTF
user-agentapplication/jsonc                         t  dddtjS NFjsonr   serialize_request_bodyr   EmbeddingRequest requestr&   Z/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/mistralai/embeddings.py<lambda>K       z#Embeddings.create.<locals>.<lambda>methodpathbase_urlurl_variablesr(   request_body_requiredrequest_has_path_paramsrequest_has_query_paramsuser_agent_headeraccept_header_valuer   securityget_serialized_bodyr   429500502503504 embeddings_v1_embeddings_postconfigr/   operation_idoauth2_scopessecurity_source4224XX5XXhook_ctxr(   error_status_codesretry_config200rF   rG   *API error occurredrH   Unexpected response received)sdk_configurationr   _get_urlr   r%   _build_requestr6   r   rL   
isinstancer   RetryConfig
do_requestr   r	   Securitymatch_responser
   EmbeddingResponseHTTPValidationErrorDataHTTPValidationErrorstream_to_textSDKErrorselfr   r   r   r   r   r   r   r   r   r/   r0   reqrL   http_resresponse_datahttp_res_textr&   r'   r)   create   s   

	

zEmbeddings.createc       	            s  d}
d}|du r| j j}|dur|}
n| |
|}
tj|||||d | jdd|
| ddddd|	| j j fd	d
|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|g d|dI dH }d}t
|ddrttj|S t
|ddrttj|}t||t
|ddrt
|I dH }td||t
|ddrt
|I dH }td||td|)r   Nr   r   r   TFr   r   c                      r    r!   r#   r&   r'   r&   r)   r*      r+   z)Embeddings.create_async.<locals>.<lambda>r,   r8   r>   r?   r@   rE   rI   rM   rF   rG   rN   rO   rH   rP   )rQ   r   rR   r   r%   _build_request_asyncr6   r   rL   rT   r   rU   do_request_asyncr   r	   rW   rX   r
   rY   rZ   r[   stream_to_text_asyncr]   r^   r&   r'   r)   create_asyncy   s   

	zEmbeddings.create_async)__name__
__module____qualname____doc__r   strr   r   EmbeddingRequestInputsEmbeddingRequestInputsTypedDictr   intr   EmbeddingDtypeEncodingFormatr   rU   r   rY   rd   rh   r&   r&   r&   r)   r      s|    	
	

q
	
r   N)rl   basesdkr   	mistralair   r   mistralai._hooksr   mistralai.typesr   r   mistralai.utilsr	   'mistralai.utils.unmarshal_json_responser
   typingr   r   r   r   r   r&   r&   r&   r)   <module>   s    