Ë
    tPêj„  ã                   ó   — U d dl mZmZmZ erd dlmZ d dlmZmZ ddl	m
Z
mZ d dlmZ ddlmZ dZeedz     ed	<   dZeed
      ed<   deddfd„Zdedefd„Zdd„Zej.                  j0                  eiZeed<   g d¢Zy)é    )ÚTYPE_CHECKINGÚFinalÚOptional)ÚCustomPromptManagement)ÚPromptLiteLLMParamsÚ
PromptSpecé   )ÚPromptManagerÚPromptTemplate)ÚSupportedPromptIntegrations)ÚDotpromptManagerNÚglobal_prompt_directoryr
   Úglobal_prompt_managerÚ	directoryÚreturnc                 ó   — ddl }| |_        y)z‡
    Set the global prompt directory for dotprompt files.

    Args:
        directory: Path to directory containing .prompt files
    r   N)Úlitellmr   )r   r   s     úl/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/litellm/integrations/dotprompt/__init__.pyÚset_global_prompt_directoryr      s   € ó à&/€GÕ#ó    Údotprompt_contentc                 ój   — ddl m}  |«       }|j                  | «      \  }}|j                  «       |dœS )zê
    Get the prompt data from the dotprompt content.

    The UI stores prompts under `dotprompt_content` in the database. This function parses the content and returns the prompt data in the format expected by the prompt manager.
    r	   )r
   )ÚcontentÚmetadata)Úprompt_managerr
   Ú_parse_frontmatterÚstrip)r   r
   Útemp_managerr   r   s        r   Ú'_get_prompt_data_from_dotprompt_contentr      s9   € õ .ñ (›/€LØ$×7Ñ7Ð8IÓJÑ€Hˆgð —}‘}“°HÑ=Ð=r   c                 ó^  — t        | dd«      }t        | dd«      }t        | dd«      }|rt        d«      ‚t        | dd«      }t        | dd«      }|r|s|st        |«      }dd	lm} |xs   ||j
                  «      xs |j
                  }	 t        ||||¬
«      }	|	S # t        $ r}
|
‚d}
~
ww xY w)z2
    Initialize a prompt from a .prompt file.
    Úprompt_directoryNÚprompt_dataÚ	prompt_idzgCannot set prompt_directory when working with prompt_initializer. Needs to be a specific dotprompt fileÚprompt_filer   r	   )Ústrip_version_suffix)r!   r"   r$   r#   )ÚgetattrÚ
ValueErrorr   r   r%   r#   r   Ú	Exception)Úlitellm_paramsÚprompt_specr!   r"   r#   r$   r   r%   Úregistration_prompt_idÚdot_prompt_managerÚes              r   Úprompt_initializerr.   .   sÖ   € ô & nÐ6HÈ$ÓOÐÜ˜.¨-¸Ó>€KÜ˜~¨{¸DÓA€IÙÜØuó
ð 	
ô ! °ÀÓE€Kô  ' ~Ð7JÈDÓQÐÙ¡±[Ü=Ð>OÓPˆå4à$-Ò$uÑ1EÀk×F[ÑF[Ó1\Ò$uÐ`k×`uÑ`uÐð
Ü$4Ø-Ø#Ø#Ø,ô	%
Ðð "Ð!øÜò Øˆûðús   ÂB Â	B,Â%B'Â'B,Úprompt_initializer_registry)r   r
   r   r   r   r   )r)   r   r*   r   r   r   )Útypingr   r   r   Ú-litellm.integrations.custom_prompt_managementr   Ú"litellm.types.prompts.init_promptsr   r   r   r
   r   r   Údotprompt_managerr   r   ÚstrÚ__annotations__r   r   Údictr   r.   Ú
DOT_PROMPTÚvaluer/   Ú__all__© r   r   ú<module>r;      sž   ðß 1Ò 1áÝTßRç=å Jå /ð .2Ð ˜˜s T™zÑ*Ó 1Ø:>Ð �u˜X oÑ6Ñ7Ó >ð	0¨3ð 	0°4ó 	0ð>¸sð >Àtó >ó !ðJ  ×*Ñ*×0Ñ0Ð2Dð&Ð ˜Uó ò
�r   