Ë
    ,Œ:jÞ#  ã                  ó4  — 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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 ddlmZmZ ddlmZm Z  ddl!m"Z" erddl#m$Z$m%Z% ddgZ& G d„ de«      Z' G d„ de«      Z( G d„ d«      Z) G d„ d«      Z*y)é    )ÚannotationsN)ÚTYPE_CHECKINGÚListÚUnionÚcast)ÚLiteralé   )ÚCreateEmbeddingResponseÚembedding_create_params)Ú	NOT_GIVENÚBodyÚQueryÚHeadersÚNotGiven)Úis_givenÚmaybe_transform)Únumpy)Ú	has_numpy)ÚSyncAPIResourceÚAsyncAPIResource)Úto_raw_response_wrapperÚasync_to_raw_response_wrapper)Úmake_request_options)ÚOpenAIÚAsyncOpenAIÚ
EmbeddingsÚAsyncEmbeddingsc                  óf   ‡ — e Zd ZU ded<   dˆ fd„Zeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zˆ xZS )	r   ÚEmbeddingsWithRawResponseÚwith_raw_responsec                óD   •— t         ‰| �  |«       t        | «      | _        y ©N)ÚsuperÚ__init__r   r    ©ÚselfÚclientÚ	__class__s     €ú]/var/www/html/tokenscope/api/venv/lib/python3.12/site-packages/openai/resources/embeddings.pyr$   zEmbeddings.__init__   s   ø€ Ü‰Ñ˜Ô Ü!:¸4Ó!@ˆÕó    N©Úencoding_formatÚuserÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutc               óÐ   ‡— |||‰dœ}	t        ‰«      st        «       rd|	d<   dˆfd„}
| j                  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`) and cannot be an empty string.
              [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.

          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
        ©ÚinputÚmodelr-   r,   Úbase64r,   c                ó  •— t        ‰«      r| S | j                  D ]j  }t        t        |j                  «      }t        |t        «      sŒ.t        j                  t        j                  |«      d¬«      j                  «       |_        Œl | S ©NÚfloat32)Údtype©r   Údatar   ÚobjectÚ	embeddingÚ
isinstanceÚstrÚnpÚ
frombufferr7   Ú	b64decodeÚtolist©Úobjr?   r=   r,   s      €r)   Úparserz!Embeddings.create.<locals>.parserX   ót   ø€ Ü˜Ô(à�
à ŸX™Xò �	ÜœF I×$7Ñ$7Ó8�Ü! $¬Ô,àä&(§m¡mÜ×$Ñ$ TÓ*°)ô'ç‘&“(ð Õ#ðð ˆJr*   ú/embeddings©r.   r/   r0   r1   Úpost_parser©ÚbodyÚoptionsÚcast_to©rG   r
   Úreturnr
   ©r   r   Ú_postr   r   ÚEmbeddingCreateParamsr   r
   ©r&   r5   r6   r,   r-   r.   r/   r0   r1   ÚparamsrH   s      `       r)   ÚcreatezEmbeddings.create!   s   ø€ ð^ ØØØ.ñ	
ˆô ˜Ô(¬Y¬[Ø(0ˆFÐ$Ñ%õ	ð" �z‰zØÜ  Ô)@×)VÑ)VÓWÜ(Ø+Ø'Ø%ØØ"ôô ,ð ó 
ð 	
r*   )r'   r   rR   ÚNone©r5   z1Union[str, List[str], List[int], List[List[int]]]r6   z-Union[str, Literal['text-embedding-ada-002']]r,   z%Literal['float', 'base64'] | NotGivenr-   zstr | NotGivenr.   zHeaders | Noner/   zQuery | Noner0   zBody | Noner1   z'float | httpx.Timeout | None | NotGivenrR   r
   ©Ú__name__Ú
__module__Ú__qualname__Ú__annotations__r$   r   rX   Ú__classcell__©r(   s   @r)   r   r      s‘   ø… Ø0Ó0õAð BKØ(ð )-Ø$(Ø"&Ø;DñS
ð AðS
ð =ð	S
ð
 ?ðS
ð ðS
ð &ðS
ð "ðS
ð  ðS
ð 9ðS
ð 
!÷S
r*   c                  óf   ‡ — e Zd ZU ded<   dˆ fd„Zeedddedœ	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd„Zˆ xZS )	r   ÚAsyncEmbeddingsWithRawResponser    c                óD   •— t         ‰| �  |«       t        | «      | _        y r"   )r#   r$   rc   r    r%   s     €r)   r$   zAsyncEmbeddings.__init__z   s   ø€ Ü‰Ñ˜Ô Ü!?ÀÓ!EˆÕr*   Nr+   c             ƒ  óì   ‡K  — |||‰dœ}	t        ‰«      st        «       rd|	d<   d	ˆfd„}
| j                  dt        |	t        j
                  «      t        |||||
¬«      t        ¬«      ƒ d{  –—† S 7 Œ­w)
r3   r4   r7   r,   c                ó  •— t        ‰«      r| S | j                  D ]j  }t        t        |j                  «      }t        |t        «      sŒ.t        j                  t        j                  |«      d¬«      j                  «       |_        Œl | S r9   r<   rF   s      €r)   rH   z&AsyncEmbeddings.create.<locals>.parserµ   rI   r*   rJ   rK   rM   NrQ   rS   rV   s      `       r)   rX   zAsyncEmbeddings.create~   s�   øè ø€ ð^ ØØØ.ñ	
ˆô ˜Ô(¬Y¬[Ø(0ˆFÐ$Ñ%õ	ð" —Z‘ZØÜ  Ô)@×)VÑ)VÓWÜ(Ø+Ø'Ø%ØØ"ôô ,ð  ó 
÷ 
ð 	
ð 
ús   ƒA*A4Á-A2Á.A4)r'   r   rR   rY   rZ   r[   ra   s   @r)   r   r   w   s‘   ø… Ø5Ó5õFð BKØ(ð )-Ø$(Ø"&Ø;DñS
ð AðS
ð =ð	S
ð
 ?ðS
ð ðS
ð &ðS
ð "ðS
ð  ðS
ð 9ðS
ð 
!÷S
r*   c                  ó   — e Zd Zdd„Zy)r   c                ó8   — t        |j                  «      | _        y r"   )r   rX   ©r&   Ú
embeddingss     r)   r$   z"EmbeddingsWithRawResponse.__init__Õ   s   € Ü-Ø×Ñó
ˆ�r*   N)rj   r   rR   rY   ©r\   r]   r^   r$   © r*   r)   r   r   Ô   ó   „ ô
r*   r   c                  ó   — e Zd Zdd„Zy)rc   c                ó8   — t        |j                  «      | _        y r"   )r   rX   ri   s     r)   r$   z'AsyncEmbeddingsWithRawResponse.__init__Ü   s   € Ü3Ø×Ñó
ˆ�r*   N)rj   r   rR   rY   rk   rl   r*   r)   rc   rc   Û   rm   r*   rc   )+Ú
__future__r   r7   Útypingr   r   r   r   Útyping_extensionsr   ÚhttpxÚtypesr
   r   Ú_typesr   r   r   r   r   Ú_utilsr   r   Ú_extrasr   rB   r   Ú	_resourcer   r   Ú	_responser   r   Ú_base_clientr   Ú_clientr   r   Ú__all__r   r   r   rc   rl   r*   r)   ú<module>r}      sx   ðõ #ã ß 3Ó 3Ý %ã ç Dß >Õ >ß .Ý !Ý ß 9ß NÝ /áß-àÐ*Ð
+€ôZ
�ô Z
ôzZ
Ð&ô Z
÷z
ñ 
÷
ò 
r*   