
    f j)                    ~   d dl mZ d dlZd dlmZmZmZmZ d dlm	Z	 d dl
Z
ddlmZ ddlmZmZ ddlmZmZmZmZ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 m!Z! ddl"m#Z#m$Z$ ddl%m&Z& ddgZ' G d de           Z( G d de!          Z) G d d          Z* G d d          Z+ G d d          Z, G d d          Z-dS )    )annotationsN)ListUnionIterablecast)Literal   )_legacy_response)CreateEmbeddingResponseembedding_create_params)	NOT_GIVENBodyQueryHeadersNotGiven)is_givenmaybe_transform)cached_property)numpy	has_numpy)SyncAPIResourceAsyncAPIResource)to_streamed_response_wrapper"async_to_streamed_response_wrapper)make_request_options
EmbeddingsAsyncEmbeddingsc                  X    e Zd Zedd            Zedd            ZeeedddedddZdS )r   returnEmbeddingsWithRawResponsec                     t          |           S N)r    selfs    oC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\openai/resources/embeddings.pywith_raw_responsezEmbeddings.with_raw_response   s    (...    EmbeddingsWithStreamingResponsec                     t          |           S r"   )r(   r#   s    r%   with_streaming_responsez"Embeddings.with_streaming_response   s    .t444r'   N
dimensionsencoding_formatuserextra_headersextra_query
extra_bodytimeoutinput=Union[str, List[str], Iterable[int], Iterable[Iterable[int]]]modelaUnion[str, Literal['text-embedding-ada-002', 'text-embedding-3-small', 'text-embedding-3-large']]r,   int | NotGivenr-   %Literal['float', 'base64'] | NotGivenr.   str | NotGivenr/   Headers | Noner0   Query | Noner1   Body | Noner2   'float | httpx.Timeout | None | NotGivenr   c       	            ||||d}
t                    st                      rd|
d<   dfd}|                     dt          |
t          j                  t          ||||	|	          t          
          S )
  
        Creates an embedding vector representing the input text.

        Args:
          input: Input text to embed, encoded as a string or array of tokens. To embed multiple
              inputs in a single request, pass an array of strings or array of token arrays.
              The input must not exceed the max input tokens for the model (8192 tokens for
              `text-embedding-ada-002`), cannot be an empty string, and any array must be 2048
              dimensions or less.
              [Example Python code](https://cookbook.openai.com/examples/how_to_count_tokens_with_tiktoken)
              for counting tokens.

          model: ID of the model to use. You can use the
              [List models](https://platform.openai.com/docs/api-reference/models/list) API to
              see all of your available models, or see our
              [Model overview](https://platform.openai.com/docs/models/overview) for
              descriptions of them.

          dimensions: The number of dimensions the resulting output embeddings should have. Only
              supported in `text-embedding-3` and later models.

          encoding_format: The format to return the embeddings in. Can be either `float` or
              [`base64`](https://pypi.org/project/pybase64/).

          user: A unique identifier representing your end-user, which can help OpenAI to monitor
              and detect abuse.
              [Learn more](https://platform.openai.com/docs/guides/safety-best-practices/end-user-ids).

          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
        r3   r5   r.   r,   r-   base64r-   objr   r   c                   t                    r| S | j        D ]q}t          t          |j                  }t          |t                    s2t          j        t          j
        |          d                                          |_        r| S Nfloat32)dtyper   datar   object	embedding
isinstancestrnp
frombufferrA   	b64decodetolistrB   rJ   rH   r-   s      r%   parserz!Embeddings.create.<locals>.parser`       (( 
 X  	FI$788!$,, &(m$T**)' ' '&(( ## Jr'   /embeddingsr/   r0   r1   r2   post_parserbodyoptionscast_torB   r   r   r   r   r   _postr   r   EmbeddingCreateParamsr   r   r$   r3   r5   r,   r-   r.   r/   r0   r1   r2   paramsrR   s       `       r%   createzEmbeddings.create#   s    h $.
 
 (( 	1Y[[ 	1(0F$%	 	 	 	 	 	" zz )@)VWW(+'%"   ,  
 
 	
r'   )r   r    )r   r(   r3   r4   r5   r6   r,   r7   r-   r8   r.   r9   r/   r:   r0   r;   r1   r<   r2   r=   r   r   __name__
__module____qualname__r   r&   r*   r   ra    r'   r%   r   r      s        / / / _/ 5 5 5 _5 &/AJ( )-$("&;DY
 Y
 Y
 Y
 Y
 Y
 Y
 Y
r'   c                  X    e Zd Zedd            Zedd            ZeeedddedddZdS )r   r   AsyncEmbeddingsWithRawResponsec                     t          |           S r"   )ri   r#   s    r%   r&   z!AsyncEmbeddings.with_raw_response   s    -d333r'   $AsyncEmbeddingsWithStreamingResponsec                     t          |           S r"   )rk   r#   s    r%   r*   z'AsyncEmbeddings.with_streaming_response   s    3D999r'   Nr+   r3   r4   r5   r6   r,   r7   r-   r8   r.   r9   r/   r:   r0   r;   r1   r<   r2   r=   r   c       	          K   ||||d}
t                    st                      rd|
d<   dfd}|                     dt          |
t          j                  t          ||||	|	          t          
           d{V S )r?   r@   rA   r-   rB   r   r   c                   t                    r| S | j        D ]q}t          t          |j                  }t          |t                    s2t          j        t          j
        |          d                                          |_        r| S rD   rG   rQ   s      r%   rR   z&AsyncEmbeddings.create.<locals>.parser   rS   r'   rT   rU   rW   Nr[   r\   r_   s       `       r%   ra   zAsyncEmbeddings.create   s      h $.
 
 (( 	1Y[[ 	1(0F$%	 	 	 	 	 	" ZZ )@)VWW(+'%"   ,   
 
 
 
 
 
 
 
 	
r'   )r   ri   )r   rk   rb   rc   rg   r'   r%   r   r      s        4 4 4 _4 : : : _: &/AJ( )-$("&;DY
 Y
 Y
 Y
 Y
 Y
 Y
 Y
r'   c                      e Zd ZddZdS )r    
embeddingsr   r   Nonec                P    || _         t          j        |j                  | _        d S r"   )_embeddingsr
   to_raw_response_wrapperra   r$   rp   s     r%   __init__z"EmbeddingsWithRawResponse.__init__   s(    %&>
 
r'   Nrp   r   r   rq   rd   re   rf   rv   rg   r'   r%   r    r       (        
 
 
 
 
 
r'   r    c                      e Zd ZddZdS )ri   rp   r   r   rq   c                P    || _         t          j        |j                  | _        d S r"   )rs   r
   async_to_raw_response_wrapperra   ru   s     r%   rv   z'AsyncEmbeddingsWithRawResponse.__init__   s(    %&D
 
r'   Nrp   r   r   rq   rx   rg   r'   r%   ri   ri      ry   r'   ri   c                      e Zd ZddZdS )r(   rp   r   r   rq   c                F    || _         t          |j                  | _        d S r"   )rs   r   ra   ru   s     r%   rv   z(EmbeddingsWithStreamingResponse.__init__   s%    %2
 
r'   Nrw   rx   rg   r'   r%   r(   r(      ry   r'   r(   c                      e Zd ZddZdS )rk   rp   r   r   rq   c                F    || _         t          |j                  | _        d S r"   )rs   r   ra   ru   s     r%   rv   z-AsyncEmbeddingsWithStreamingResponse.__init__   s%    %8
 
r'   Nr}   rx   rg   r'   r%   rk   rk      ry   r'   rk   ).
__future__r   rA   typingr   r   r   r   typing_extensionsr   httpx r
   typesr   r   _typesr   r   r   r   r   _utilsr   r   _compatr   _extrasr   rM   r   	_resourcer   r   	_responser   r   _base_clientr   __all__r   r   r    ri   r(   rk   rg   r'   r%   <module>r      sc   # " " " " "  . . . . . . . . . . . . % % % % % %        D D D D D D D D > > > > > > > > > > > > > > . . . . . . . . % % % % % % , , , , , , , , 9 9 9 9 9 9 9 9 X X X X X X X X      *
+b
 b
 b
 b
 b
 b
 b
 b
Jb
 b
 b
 b
 b
& b
 b
 b
J
 
 
 
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 
 
 
 

 
 
 
 
 
 
 
 
 
r'   