
    h&                     x    d dl mZmZ d dlmZmZmZmZmZm	Z	 d dl
mZ d dlmZ  G d de	      Z G d de      Zy	)
    )ABCabstractmethod)AnyDictListOptionalTuple	TypedDict)AllMessageValues)StandardCallbackDynamicParamsc                   h    e Zd ZU eed<   ee   ed<   ee   ed<   eeee	f      ed<   eee      ed<   y)PromptManagementClient	prompt_idprompt_templateprompt_template_modelprompt_template_optional_paramscompleted_messagesN)
__name__
__module____qualname__str__annotations__r   r   r   r   r        g/var/www/Befach/backend/env/lib/python3.12/site-packages/litellm/integrations/prompt_management_base.pyr   r      sA    N*++#C=(%-d38n%== &6!788r   r   c                   j   e Zd Zeedefd              Zedededefd       Z	e	 	 ddede
e   dede
e   d	e
e   defd
       Zdee   dee   dee   fdZ	 	 ddede
e   dee   dede
e   d	e
e   defdZdededefdZ	 	 ddedee   dede
e   de
e   dede
e   d	e
e   deeee   ef   fdZy)PromptManagementBasereturnc                      y Nr   )selfs    r   integration_namez%PromptManagementBase.integration_name   s     	r   r   dynamic_callback_paramsc                      y r    r   )r!   r   r#   s      r   should_run_prompt_managementz1PromptManagementBase.should_run_prompt_management   s     	r   Nprompt_variablesprompt_labelprompt_versionc                      y r    r   )r!   r   r&   r#   r'   r(   s         r   _compile_prompt_helperz+PromptManagementBase._compile_prompt_helper   s     	r   r   client_messagesc                     ||z   S r    r   )r!   r   r+   s      r   merge_messagesz#PromptManagementBase.merge_messages)   s    
 00r   c                     | j                  |||||      }	 |d   |z   }||d<   |S # t        $ r}	t        d|	 d| d| d| d| 
      d }	~	ww xY w)	N)r   r&   r#   r'   r(   r   zError compiling prompt: z. Prompt id=z, prompt_variables=z, client_messages=z, dynamic_callback_params=r   )r*   	Exception
ValueError)
r!   r   r&   r+   r#   r'   r(   compiled_prompt_clientmessageses
             r   compile_promptz#PromptManagementBase.compile_prompt0   s     "&!<!<-$;%) "= "
	-.?@?RH 8@34%%  	*1#\)DWXhWii{  }L  |M  Mg  h  g@  A 	s   ' 	AA

Aprompt_management_clientmodelc                 l    |d   |d   S |j                  dj                  | j                        d      S )Nr   z{}/ )replaceformatr"   )r!   r5   r6   s      r   _get_model_from_promptz+PromptManagementBase._get_model_from_promptK   s<     $$;<H+,CDD==d.C.C!DbIIr   r2   non_default_paramsc	                     |t        d      | j                  ||      s|||fS | j                  ||||||      }	|	d   xs |}
|	d   xs i }i ||}| j                  |	|      }||
|fS )Nz6prompt_id is required for Prompt Management Base class)r   r#   )r   r&   r+   r#   r'   r(   r   r   )r5   r6   )r0   r%   r4   r;   )r!   r6   r2   r<   r   r&   r#   r'   r(   r   r   r   updated_non_default_paramss                r   get_chat_completion_promptz/PromptManagementBase.get_chat_completion_promptS   s     UVV009P 1 
 ($666---$$;%) . 
 --ABNh =>D" 	(&
 &
-&
"
 ++%4E , 
 (*DDDr   )NN)r   r   r   propertyr   r   r"   r   boolr%   r   dictintr   r*   r   r   r-   r4   r;   r	   r?   r   r   r   r   r      s   #     "? 
	   '+(, #4. "?	
 sm ! 
  1./1 ./1 
		1 '+(,&& #4.& ./	&
 "?& sm& !& 
 &6J(>JGJJ	J  '+(,*E*E '(*E !	*E
 C=*E #4.*E "?*E sm*E !*E 
sD)*D0	1*Er   r   N)abcr   r   typingr   r   r   r   r	   r
   litellm.types.llms.openair   litellm.types.utilsr   r   r   r   r   r   <module>rH      s0    # > > 6 =9Y 9mE3 mEr   