
    ^h1                         S SK r S SKrS SKrS SKJrJr  S SKrS SKrS SKJ	r	J
r
JrJr   " S S\5      r " S S5      rS r   SS	\S
\S\S\S\S\4S jjrS rg)    N)CallableOptional)ChoicesMessageModelResponseUsagec                   (   ^  \ rS rSrU 4S jrSrU =r$ )AlephAlphaError   c                    > Xl         X l        [        R                  " SSS9U l        [        R
                  " XR                  S9U l        [        TU ]!  U R                  5        g )NPOSTz$https://api.aleph-alpha.com/complete)methodurl)status_coderequest)	r   messagehttpxRequestr   Responseresponsesuper__init__)selfr   r   	__class__s      g/home/james-whalen/.local/lib/python3.13/site-packages/litellm/llms/deprecated_providers/aleph_alpha.pyr   AlephAlphaError.__init__   sN    &}}E
 ;ULL	
    )r   r   r   r   )__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__)r   s   @r   r
   r
      s    	
 	
r   r
   c            A       0   \ rS rSr% Sr\R                  r\\	   \
S'   Sr\\	   \
S'   Sr\\   \
S'   Sr\\	   \
S'   Sr\\	   \
S'   Sr\\	   \
S	'   Sr\\	   \
S
'   Sr\\	   \
S'   Sr\\	   \
S'   Sr\\	   \
S'   Sr\\   \
S'   Sr\\   \
S'   Sr\\   \
S'   Sr\\   \
S'   Sr\\   \
S'   Sr\\   \
S'   Sr\\   \
S'   Sr\\	   \
S'   Sr\\	   \
S'   Sr\\    \
S'   Sr!\\	   \
S'   Sr"\\#   \
S'   Sr$\\   \
S'   Sr%\\   \
S'   Sr&\\   \
S'   Sr'\\#   \
S'   Sr(\\#   \
S'   Sr)\\   \
S'   Sr*\\   \
S '   Sr+\\	   \
S!'   Sr,\\   \
S"'                                  S'S\\	   S\\	   S\\   S\\	   S\\	   S	\\	   S
\\	   S\\	   S\\	   S\\	   S\\   S\\   S\\   S\\   S\\   S\\   S\\   S\\	   S\\	   S\\    S\\	   S\\#   S\\   S\\   S\\   S\\#   S\\#   S\\   S \\   S!\\	   S"\\   S#S4@S$ jjr-\.S% 5       r/S&r0g)(AlephAlphaConfig   a.  
Reference: https://docs.aleph-alpha.com/api/complete/

The `AlephAlphaConfig` class represents the configuration for the Aleph Alpha API. Here are the properties:

- `maximum_tokens` (integer, required): The maximum number of tokens to be generated by the completion. The sum of input tokens and maximum tokens may not exceed 2048.

- `minimum_tokens` (integer, optional; default value: 0): Generate at least this number of tokens before an end-of-text token is generated.

- `echo` (boolean, optional; default value: false): Whether to echo the prompt in the completion.

- `temperature` (number, nullable; default value: 0): Adjusts how creatively the model generates outputs. Use combinations of temperature, top_k, and top_p sensibly.

- `top_k` (integer, nullable; default value: 0): Introduces randomness into token generation by considering the top k most likely options.

- `top_p` (number, nullable; default value: 0): Adds randomness by considering the smallest set of tokens whose cumulative probability exceeds top_p.

- `presence_penalty`, `frequency_penalty`, `sequence_penalty` (number, nullable; default value: 0): Various penalties that can reduce repetition.

- `sequence_penalty_min_length` (integer; default value: 2): Minimum number of tokens to be considered as a sequence.

- `repetition_penalties_include_prompt`, `repetition_penalties_include_completion`, `use_multiplicative_presence_penalty`,`use_multiplicative_frequency_penalty`,`use_multiplicative_sequence_penalty` (boolean, nullable; default value: false): Various settings that adjust how the repetition penalties are applied.

- `penalty_bias` (string, nullable): Text used in addition to the penalized tokens for repetition penalties.

- `penalty_exceptions` (string[], nullable): Strings that may be generated without penalty.

- `penalty_exceptions_include_stop_sequences` (boolean, nullable; default value: true): Include all stop_sequences in penalty_exceptions.

- `best_of` (integer, nullable; default value: 1): The number of completions will be generated on the server side.

- `n` (integer, nullable; default value: 1): The number of completions to return.

- `logit_bias` (object, nullable): Adjust the logit scores before sampling.

- `log_probs` (integer, nullable): Number of top log probabilities for each token generated.

- `stop_sequences` (string[], nullable): List of strings that will stop generation if they're generated.

- `tokens` (boolean, nullable; default value: false): Flag indicating whether individual tokens of the completion should be returned or not.

- `raw_completion` (boolean; default value: false): if True, the raw completion of the model will be returned.

- `disable_optimizations` (boolean, nullable; default value: false): Disables any applied optimizations to both your prompt and completion.

- `completion_bias_inclusion`, `completion_bias_exclusion` (string[], default value: []): Set of strings to bias the generation of tokens.

- `completion_bias_inclusion_first_token_only`, `completion_bias_exclusion_first_token_only` (boolean; default value: false): Consider only the first token for the completion_bias_inclusion/exclusion.

- `contextual_control_threshold` (number, nullable): Control over how similar tokens are controlled.

- `control_log_additive` (boolean; default value: true): Method of applying control to attention scores.
maximum_tokensNminimum_tokensechotemperaturetop_ktop_ppresence_penaltyfrequency_penaltysequence_penaltysequence_penalty_min_length#repetition_penalties_include_prompt'repetition_penalties_include_completion#use_multiplicative_presence_penalty$use_multiplicative_frequency_penalty#use_multiplicative_sequence_penaltypenalty_bias)penalty_exceptions_include_stop_sequencesbest_ofn
logit_bias	log_probsstop_sequencestokensraw_completiondisable_optimizationscompletion_bias_inclusioncompletion_bias_exclusion*completion_bias_inclusion_first_token_only*completion_bias_exclusion_first_token_onlycontextual_control_thresholdcontrol_log_additivereturnc                      [        5       n U R                  5        H*  u  n!n"U!S:w  d  M  U"c  M  [        U R                  U!U"5        M,     g )Nr   )localsitemssetattrr   )#r   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   locals_keyvalues#                                      r   r   AlephAlphaConfig.__init__r   s<    D (!--/JCf}!2U3 *r   c                    U R                   R                  5        VVs0 s H_  u  pUR                  S5      (       a  M  [        U[        R
                  [        R                  [        [        45      (       a  MX  Uc  M]  X_Ma     snn$ s  snnf )N__)	__dict__rI   
startswith
isinstancetypesFunctionTypeBuiltinFunctionTypeclassmethodstaticmethod)clskvs      r   
get_configAlephAlphaConfig.get_config   s     **,
,<<%  &&-- 	   AD,
 	
 
s   B7B9B>B )NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN)1r   r   r    r!   __doc__litellm
max_tokensr'   r   int__annotations__r(   r)   boolr*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   strr7   r8   r9   r:   dictr;   r<   listr=   r>   r?   r@   rA   rB   rC   rD   rE   r   rW   r\   r"   r^   r   r   r%   r%      s   4n 	 HSM  %)NHSM(D(4.!%K#%E8C=E8C=&*hsm*'+x}+&*hsm*15#5:>'$>>B+Xd^B:>'$>;?((4.?:>'$>"&L(3-&@D-x~D!GXc]!Ax}!%J%#Ix}#%)NHTN)!FHTN!%)NHTN),08D>004x~404x~4AE.EAE.E26 (3-6+/(4./ )-(,#%)##*.+/*.59>BBF>B?C>B&*DH!%%)#')-!%)-044848EIEI6:/3A%4 %4 !%4 tn	%4
 c]%4 }%4 }%4 #3-%4 $C=%4 #3-%4 &.c]%4 .6d^%4 2:$%4 .6d^%4 /7tn%4  .6d^!%4" sm#%4$ 4<D>%%4& #'%4( C=)%4* TN+%4, C=-%4. !/%40 1%42 !3%44  (~5%46 $,D>7%48 $,D>9%4: 5=TN;%4< 5=TN=%4> '/sm?%4@ 'tnA%4B 
C%4N 
 
r   r%   c                 .    SSS.nU (       a  SU  3US'   U$ )Nzapplication/json)acceptzcontent-typezBearer Authorizationr^   )api_keyheaderss     r   validate_environmentrm      s*    $*G %,WI#6 Nr   modelmessagesapi_basemodel_responseprint_verboseoptional_paramsc                    [        U5      n[        R                  R                  5       nUR	                  5        H  u  pX;  d  M  XU'   M     UnU n SnSU ;   aq  [        U5       Ha  u  nnSU;   aL  US:X  a  USUS    3-  nM  US   S:X  a  USUS    3-  nM5  US   S:X  a  US	US    3-  nMK  US
US    3-  nMX  UUS    -  nMc     OSR                  S U 5       5      nU US.UEnUR                  UUSU0S9  [        R                  R                  UU[        R                  " U5      SU;   a  US   OSS9nSU;   a  US   SL a  UR                  5       $ UR                  UUUR                  SU0S9  U" SUR                   35        UR                  5       nSU;   a  [        US   UR                   S9e / n[        US   5       HP  u  nn[#        US   5      S:  a  [%        US   S9nO	[%        S S9n['        US   US-   US9nUR)                  U5        MR     UUl        [#        UR/                  U5      5      n[#        UR/                  US   S   S   S   S S!95      n[1        [2        R2                  " 5       5      Ul        Xl        [9        UUUU-   S"9n[;        US#U5        U$ ! [,         a)    [        [        R                  " U5      UR                   S9ef = f)$N controlroler   z###Instruction: contentsystemuserz
###Input: z###Response:  c              3   *   #    U  H	  oS    v   M     g7f)rx   Nr^   ).0r   s     r   	<genexpr>completion.<locals>.<genexpr>   s     EH),Hs   )rn   promptcomplete_input_dict)inputrk   additional_argsstreamF)rl   datar   T)r   rk   original_responser   zraw model_response: error)r   r   completions
completion)rx   finish_reason   )r   indexr   choicesr   r^   )disallowed_special)prompt_tokenscompletion_tokenstotal_tokensusage)rm   r`   r%   r\   rI   	enumeratejoinpre_callmodule_level_clientpostjsondumps
iter_lines	post_calltextr
   r   lenr   r   appendr   	Exceptionencoderb   timecreatedrn   r   rJ   )rn   ro   rp   rq   rr   encodingrk   logging_objrs   litellm_params	logger_fndefault_max_tokens_to_samplerl   configrZ   r[   completion_urlr   idxr   r   r   completion_responsechoices_listitemmessage_obj
choice_objr   r   r   s                                 r   r   r      s{    #7+G %%002F$!"A	  NEFE%h/LC 1H 01C0DEEFv(2$4WY5G4H"II F2Jwy/A.B"CCM')2D1E"FFWY/01 0  EHEE D .5   **//ZZ,4,Gx(U	 0 H ?"x'@D'H""$$ 	&mm2D9	 	 	
 	,X]]O<=&mmo))!+G4$00 
!!*+>}+M!NIC4-.2&-d<6H&I&-d&;!(&*?&;!Ag +"J
 !''
3 "O *6& HOOF34OOy)!,Y7	B#%  
 "%TYY[!1$'/&)::

 	//  % JJ':; ( 4 4 s   ;A+J+ +3Kc                      g )Nr^   r^   r   r   	embeddingr   1  s    r   )NNN)r   r   rT   typingr   r   r   r`   litellm.utilsr   r   r   r   r   r
   r%   rm   re   rg   rf   r   r   r^   r   r   <module>r      s       %   @ @

i 

P
 P
f( !%xxx x "	x
 x xv	r   