
    2hb0                    t   S SK Jr  S SKrS SKrS SKJrJrJrJr  S SK	J
r
  S SKrSSKJr  SSKJr  SSKJrJrJrJrJr  SS	KJrJr  SS
KJr  SSKJrJr  SSKJ r J!r!  SSK"J#r#J$r$  SSK%J&r&  SSK'J(r(  SSK)J*r*  SS/r+ " S S\ 5      r, " S S\!5      r- " S S5      r. " S S5      r/ " S S5      r0 " S S5      r1g)    )annotationsN)ListUnionIterablecast)Literal   )_legacy_response)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)EmbeddingModel)CreateEmbeddingResponse
EmbeddingsAsyncEmbeddingsc                      \ rS rSr\SS j5       r\S	S j5       r\\\SSS\S.                   S
S jjrSr	g)r      c                    [        U 5      $ z
This property can be used as a prefix for any HTTP method call to return
the raw response object instead of the parsed content.

For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
)EmbeddingsWithRawResponseselfs    S/var/www/auris/envauris/lib/python3.13/site-packages/openai/resources/embeddings.pywith_raw_responseEmbeddings.with_raw_response   s     )..    c                    [        U 5      $ z
An alternative to `.with_raw_response` that doesn't eagerly read the response body.

For more information, see https://www.github.com/openai/openai-python#with_streaming_response
)EmbeddingsWithStreamingResponser$   s    r&   with_streaming_response"Embeddings.with_streaming_response&   s     /t44r)   N
dimensionsencoding_formatuserextra_headersextra_query
extra_bodytimeoutc       	           ^ UUUUTS.n
[        T5      (       d  SU
S'   SU4S jjnU R                  S[        U
[        R                  5      [        UUUU	US9[        S9$ )	  
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
      all embedding models), 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. In addition to the per-input token limit, all embedding
      models enforce a maximum of 300,000 tokens summed across all inputs in a single
      request.

  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) 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
inputmodelr2   r0   r1   base64r1   c                  > [        T5      (       a  U $ U R                  (       d  [        S5      eU R                   H  n[        [        UR
                  5      n[        U[        5      (       d  M4  [        5       (       d@  [        R                  " S[        R                  " U5      5      R                  5       Ul        M  [        R                  " [        R                  " U5      SS9R                  5       Ul        M     U $ NzNo embedding data receivedffloat32)dtyper   data
ValueErrorr   object	embedding
isinstancestrr   arrayr<   	b64decodetolistnp
frombufferobjrF   rC   r1   s      r&   parser!Embeddings.create.<locals>.parsern       ((
88 !=>> XX	FI$7$78!$,, {{*/++c6;K;KD;Q*R*Y*Y*[I'*,--((.i+fh ' & Jr)   /embeddingsr3   r4   r5   r6   post_parserbodyoptionscast_torO   r   returnr   r   _postr   r   EmbeddingCreateParamsr   r   r%   r:   r;   r0   r1   r2   r3   r4   r5   r6   paramsrP   s       `       r&   createEmbeddings.create/   s    l $.
 (((0F$%	, zz )@)V)VW(+'%" ,  
 	
r)    )r[   r#   )r[   r,   r:   z=Union[str, List[str], Iterable[int], Iterable[Iterable[int]]]r;   zUnion[str, EmbeddingModel]r0   zint | NotGivenr1   z%Literal['float', 'base64'] | NotGivenr2   zstr | NotGivenr3   zHeaders | Noner4   zQuery | Noner5   zBody | Noner6   z'float | httpx.Timeout | None | NotGivenr[   r   
__name__
__module____qualname____firstlineno__r   r'   r-   r   ra   __static_attributes__rc   r)   r&   r   r      s    / / 5 5 &/AJ( )-$("&;D`
 M`
 *	`

 #`
 ?`
 `
 &`
 "`
  `
 9`
 
!`
 `
r)   c                      \ rS rSr\SS j5       r\S	S j5       r\\\SSS\S.                   S
S jjrSr	g)r      c                    [        U 5      $ r"   )AsyncEmbeddingsWithRawResponser$   s    r&   r'   !AsyncEmbeddings.with_raw_response   s     .d33r)   c                    [        U 5      $ r+   )$AsyncEmbeddingsWithStreamingResponser$   s    r&   r-   'AsyncEmbeddings.with_streaming_response   s     4D99r)   Nr/   c       	           ^#    UUUUTS.n
[        T5      (       d  SU
S'   S	U4S jjnU R                  S[        U
[        R                  5      [        UUUU	US9[        S9I Sh  vN $  N7f)
r8   r9   r<   r1   c                  > [        T5      (       a  U $ U R                  (       d  [        S5      eU R                   H  n[        [        UR
                  5      n[        U[        5      (       d  M4  [        5       (       d@  [        R                  " S[        R                  " U5      5      R                  5       Ul        M  [        R                  " [        R                  " U5      SS9R                  5       Ul        M     U $ r>   rB   rN   s      r&   rP   &AsyncEmbeddings.create.<locals>.parser   rR   r)   rS   rT   rV   NrZ   r\   r_   s       `       r&   ra   AsyncEmbeddings.create   s     l $.
 (((0F$%	, ZZ )@)V)VW(+'%" ,   
 
 	
 
s   A"A,%A*&A,rc   )r[   rn   )r[   rq   rd   re   rc   r)   r&   r   r      s    4 4 : : &/AJ( )-$("&;D`
 M`
 *	`

 #`
 ?`
 `
 &`
 "`
  `
 9`
 
!`
 `
r)   c                      \ rS rSrSS jrSrg)r#   i	  c                Z    Xl         [        R                  " UR                  5      U l        g N)_embeddingsr
   to_raw_response_wrapperra   r%   
embeddingss     r&   __init__"EmbeddingsWithRawResponse.__init__
  s#    %&>>
r)   rz   ra   Nr}   r   r[   Nonerf   rg   rh   ri   r~   rj   rc   r)   r&   r#   r#   	      
r)   r#   c                      \ rS rSrSS jrSrg)rn   i  c                Z    Xl         [        R                  " UR                  5      U l        g ry   )rz   r
   async_to_raw_response_wrapperra   r|   s     r&   r~   'AsyncEmbeddingsWithRawResponse.__init__  s#    %&DD
r)   r   Nr}   r   r[   r   r   rc   r)   r&   rn   rn     r   r)   rn   c                      \ rS rSrSS jrSrg)r,   i  c                D    Xl         [        UR                  5      U l        g ry   )rz   r   ra   r|   s     r&   r~   (EmbeddingsWithStreamingResponse.__init__  s    %2
r)   r   Nr   r   rc   r)   r&   r,   r,     r   r)   r,   c                      \ rS rSrSS jrSrg)rq   i$  c                D    Xl         [        UR                  5      U l        g ry   )rz   r   ra   r|   s     r&   r~   -AsyncEmbeddingsWithStreamingResponse.__init__%  s    %8
r)   r   Nr   r   rc   r)   r&   rq   rq   $  r   r)   rq   )2
__future__r   rI   r<   typingr   r   r   r   typing_extensionsr   httpx r
   typesr   _typesr   r   r   r   r   _utilsr   r   _compatr   _extrasr   rL   r   	_resourcer   r   	_responser   r   _base_clientr   types.embedding_modelr   types.create_embedding_responser   __all__r   r   r#   rn   r,   rq   rc   r)   r&   <module>r      s    #   . . %   + > > . % , 9 X / 2 E*
+t
 t
nt
& t
n
 

 

 

 
r)   