
    7Mg                     v    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  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OptionalUnionc                   p   e Zd ZdZdee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j                     fdZdee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j                     fdZy)
EmbeddingszEmbeddings API.zmistral-embedN)modelencoding_formatretries
server_url
timeout_msinputsr   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
        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   bE:\wamp.anq\www\apps\calme\nutritwin\resources\nutritwin\Lib\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_value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200rB   datarC   rD   *API error occurredContent-Type$Unexpected response received (code: , type: ))sdk_configurationr   r   r#   build_requestr4   r	   rH   
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.   reqrH   http_resrK   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                4  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*   r6   r<   r=   rA   rE   rI   rB   rJ   rC   rD   rL   rM   rN   rO   rP   rQ   )rR   r   r   r#   build_request_asyncr4   r	   rH   rT   r   rU   do_request_asyncr   r
   rW   rX   rY   rZ   r   r[   r\   r]   stream_to_text_asyncr_   r`   ra   rb   rc   s                  @r&   create_asynczEmbeddings.create_asynco   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   rU   intr[   ri   ro    r)   r&   r   r      sD     /167<$($(_
 fmmV%;%;;<_
 }	_

 *#._
 "%"3"34_
 SM_
 SM_
 
&**	+_
J  /167<$($(_
 fmmV%;%;;<_
 }	_

 *#._
 "%"3"34_
 SM_
 SM_
 
&**	+_
r)   r   N)rs   basesdkr   	mistralair   r   mistralai._hooksr   mistralai.typesr   r	   mistralai.utilsr
   typingr   r   r   r   rx   r)   r&   <module>r      s+    G  # ( 3 1 ' 'C
 C
r)   