
    g
                      z    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mZmZmZ  G d	 d
e      Zy)zACode generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.   )BaseSDK    )modelsutils)HookContext)OptionalNullableUNSET)get_security_from_env)AnyMappingOptionalUnionc                      e Zd ZdZdeedddddeej                  ej                  f   de	e
   dee
   deej                     d	e	e
   d
e	e   de	ee
e
f      de	ej                      fdZdeedddddeej                  ej                  f   de	e
   dee
   deej                     d	e	e
   d
e	e   de	ee
e
f      de	ej                      fdZy)
EmbeddingszEmbeddings API.zmistral-embedN)modelencoding_formatretries
server_url
timeout_mshttp_headersinputsr   r   r   r   r   r   returnc                   d}d}	|| j                   j                  }||}t        j                  |||      | j	                  dd||	ddddd|| j                   j
                  fd	|
      }
|t        k(  r2| j                   j                  t        ur| j                   j                  }d}t        |t        j                        r|g df}| j                  t        dg t        | j                   j
                  t        j                              |
g d|      }d}t        j                  |dd      r5t        j                   |j"                  t$        t        j&                           S t        j                  |dd      rDt        j                   |j"                  t        j(                        }t        j*                  |      t        j                  |ddgd      r7t        j,                  |      }t        j.                  d|j0                  ||      |j2                  j5                  d      }t        j,                  |      }t        j.                  d|j0                   d| d|j0                  ||      )  Embeddings

        Embeddings

        :param inputs: Text to embed.
        :param model: ID of the model to use.
        :param encoding_format: The format to return the embeddings in.
        :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   POST/v1/embeddingsTF
user-agentapplication/jsonc                  R    t        j                   dddt        j                        S NFjsonr   serialize_request_bodyr   EmbeddingRequestrequests   I/var/www/openai/venv/lib/python3.12/site-packages/mistralai/embeddings.py<lambda>z#Embeddings.create.<locals>.<lambda>@   !    (D(Dvv/F/F)    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operation_idoauth2_scopessecurity_source4224XX5XXhook_ctxr'   error_status_codesretry_config200rD   datarE   rF   *API error occurredContent-Type$Unexpected response received (code: , type: ))sdk_configurationr   r   r%   _build_requestr6   r	   rJ   
isinstancer   RetryConfig
do_requestr   r
   Securitymatch_responseunmarshal_jsontextr   EmbeddingResponseHTTPValidationErrorDataHTTPValidationErrorstream_to_textSDKErrorstatus_codeheadersgetselfr   r   r   r   r   r   r   r/   r0   reqrJ   http_resrM   http_res_textcontent_typer'   s                   @r(   createzEmbeddings.create   s`   . //::J!!H))+
 !!!'"&$)%)* 2%++44! "! " 
& e%%22%?00==gu001#%HIL?? <  5**33V__! 4% # 
 %1CD''x(@(@A  %1CD''v7U7UVD,,$775%.#>!00:M//$h&:&:M8   ''++N;,,X6oo283G3G2HQ]P^^_`  	
 	
r+   c                6  K   d}d}	|| j                   j                  }||}t        j                  |||      | j	                  dd||	ddddd|| j                   j
                  fd	|
      }
|t        k(  r2| j                   j                  t        ur| j                   j                  }d}t        |t        j                        r|g df}| j                  t        dg t        | j                   j
                  t        j                              |
g d|       d{   }d}t        j                  |dd      r5t        j                   |j"                  t$        t        j&                           S t        j                  |dd      rDt        j                   |j"                  t        j(                        }t        j*                  |      t        j                  |ddgd      r?t        j,                  |       d{   }t        j.                  d|j0                  ||      |j2                  j5                  d      }t        j,                  |       d{   }t        j.                  d|j0                   d| d|j0                  ||      7 q7 7 <w)r   Nr   r   r   TFr   r   c                  R    t        j                   dddt        j                        S r!   r#   r&   s   r(   r)   z)Embeddings.create_async.<locals>.<lambda>   r*   r+   r,   r8   r>   r?   rC   rG   rK   rD   rL   rE   rF   rN   rO   rP   rQ   rR   rS   )rT   r   r   r%   _build_request_asyncr6   r	   rJ   rV   r   rW   do_request_asyncr   r
   rY   rZ   r[   r\   r   r]   r^   r_   stream_to_text_asyncra   rb   rc   rd   re   s                   @r(   create_asynczEmbeddings.create_asyncr   s    . //::J!!H))+
 ''!'"&$)%)* 2%++44! "! ( 
& e%%22%?00==gu001#%HIL.. <  5**33V__! 4% / 
 
 %1CD''x(@(@A  %1CD''v7U7UVD,,$775%.#>"'"<"<X"FFM//$h&:&:M8   ''++N;#88BBoo283G3G2HQ]P^^_`  	
 	
;
, G Cs8   DJ!J"CJ JAJJ8JJJ)__name__
__module____qualname____doc__r	   r   r   InputsInputsTypedDictr   strr   r   rW   intr   r]   rk   rq    r+   r(   r   r      s|     /167<$($(48b
 fmmV%;%;;<b
 }	b

 *#.b
 "%"3"34b
 SMb
 SMb
 wsCx01b
 
&**	+b
P  /167<$($(48b
 fmmV%;%;;<b
 }	b

 *#.b
 "%"3"34b
 SMb
 SMb
 wsCx01b
 
&**	+b
r+   r   N)ru   basesdkr   	mistralair   r   mistralai._hooksr   mistralai.typesr   r	   mistralai.utilsr
   typingr   r   r   r   r   rz   r+   r(   <module>r      s+    G  # ( 3 1 0 0I
 I
r+   