
    Cji                     N   S r SSKrSSKrSSKJr  SSKJrJrJrJ	r	J
r
Jr  SSKrSSKrSSKJr  SSKJ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  SSKJ r   SSK!J"r"J#r#  \" 5       r$Sr%Sq&S\\'\4   S\
\   4S jr(S\\'\4   S\
\\'\4      S\
\\'\4      4S jr)S r*\#       S&S\
\	\      S\
\'   S\
\\'\4      S\
\\'\4      S\
\\'\4      S\
\\+\RX                  4      S\
\'   S\4S jj5       r-\#       S&S\
\	\      S\
\'   S\
\\'\4      S\
\\'\4      S\
\\'\4      S\
\\+\RX                  4      S\
\'   S\\\\\\4   4   4S jj5       r.\#       S&S\
\/   S\
\'   S\
\'   S\
\\'\4      S\
\\'\4      S\
\\+\RX                  4      S\
\'   S\4S jj5       r0\#       S&S\
\/   S\
\'   S\
\'   S\
\\'\4      S\
\\'\4      S\
\\+\RX                  4      S\
\'   S\\\\\\4   4   4S  jj5       r1\#    S'S!\'S\
\\'\4      S\
\\'\4      S\
\\+\RX                  4      S\
\'   S\4S" jj5       r2\#    S'S!\'S\
\\'\4      S\
\\'\4      S\
\\+\RX                  4      S\
\'   S\\\\\\4   4   4S# jj5       r3\#    S'S!\'S\
\\'\4      S\
\\'\4      S\
\\+\RX                  4      S\
\'   S\4S$ jj5       r4\#    S'S!\'S\
\\'\4      S\
\\'\4      S\
\\+\RX                  4      S\
\'   S\\\\\\4   4   4S% jj5       r5g)(zi
Main entry point for Skills API operations
Provides create, list, get, and delete operations for skills
    N)partial)Any	CoroutineDictListOptionalUnion)request_timeout)Logging)BaseSkillsAPIConfig)BaseLLMHTTPHandler)CreateSkillRequestDeleteSkillResponseListSkillsParamsListSkillsResponseSkill)GenericLiteLLMParams)LlmProviders)ProviderConfigManagerclientzhttps://api.anthropic.com/v1kwargsreturnc                     S HD  nU R                  U5      n[        U[        5      (       d  M+  UR                  S5      c  M?  US   s  $    g )N)metadatalitellm_metadatauser_api_key_auth)get
isinstancedict)r   metadata_keyr   s      e/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/litellm/skills/main.py"_get_user_api_key_auth_from_kwargsr"   %   sG    8::l+h%%(,,7J*K*W/00 9     
extra_bodyc                    U(       a)  [        UR                  S5      [        5      (       a  US   $ U R                  S5      n[        U[        5      (       a)  [        UR                  S5      [        5      (       a  US   $ g )Nr   requester_metadata)r   r   r   )r   r$   r   s      r!   _get_skill_request_metadatar'   -   sn     j
!;TBB*%%zz*%H(D!!j)*D' ' ,--r#   c                  6    [         c  SSKJn   U " 5       q [         $ )zGLazy initialization of LiteLLM skills handler to avoid import overhead.r   "LiteLLMSkillsTransformationHandler)_litellm_skills_handler0litellm.llms.litellm_proxy.skills.transformationr*   r)   s    r!   _get_litellm_skills_handlerr-   <   s!     &	
 #E"F""r#   filesdisplay_titleextra_headersextra_querytimeoutcustom_llm_providerc                   #    [        5       n [        R                  " 5       n	SUS'   [        [        4U UUUUUUS.UD6n
[
        R                  " 5       n[        UR                  U
5      nU	R                  SU5      I Sh  vN n[        R                  " U5      (       a  UI Sh  vN nU$ UnU$  N/ N! [         a  n[        R                  " SUUUUS9eSnAff = f7f)a	  
Async: Create a new skill

Args:
    files: Files to upload for the skill. All files must be in the same top-level directory and must include a SKILL.md file at the root.
    display_title: Optional display title for the skill
    extra_headers: Additional headers for the request
    extra_query: Additional query parameters
    extra_body: Additional body parameters
    timeout: Request timeout
    custom_llm_provider: Provider name (e.g., 'anthropic')
    **kwargs: Additional parameters

Returns:
    Skill object
Tacreate_skill)r.   r/   r0   r1   r$   r2   r3   Nmodelr3   original_exceptioncompletion_kwargsextra_kwargs)localsasyncioget_event_loopr   create_skillcontextvarscopy_contextrunrun_in_executoriscoroutine	Exceptionlitellmexception_type)r.   r/   r0   r1   r$   r2   r3   r   
local_varsloopfuncctxfunc_with_contextinit_responseresponsees                   r!   r5   r5   H   s     6 J 
%%'"&

''#! 3

 

 &&(#CGGT2"2249JKK}--**H  %H L +  
$$ 3 (
 	

Y   CA2B4  B0$B4 %B2&B4 +C,B4 /C0B4 2B4 4
C>CCCc                    [        5       n UR                  S5      n	UR                  SS5      n
UR                  SS5      SL n[        S0 UD6nUc  Sn0 nUb  XS'   U b  XS	'   U(       a  UR	                  U5        U[
        R                  R                  :X  a?  [        5       R                  UU [        Xt5      UR                  S
5      [        U5      UU	U
S9$ [        R                  " [        R
                  " U5      S9nUc  [        SU 35      eU=(       d    0 nUR!                  XS9nUR#                  UUUS9nSSKJn  UR)                  UR*                  5      nUR-                  USS9nU	R/                  USUSU
0US9  [0        R                  UUUUUU	UU=(       d    [2        UUR                  S5      UR                  S5      S9nU$ ! [4         a  n[        R6                  " SUUUUS9eSnAff = f)a  
Create a new skill

Args:
    files: Files to upload for the skill. All files must be in the same top-level directory and must include a SKILL.md file at the root.
    display_title: Optional display title for the skill
    extra_headers: Additional headers for the request
    extra_query: Additional query parameters
    extra_body: Additional body parameters
    timeout: Request timeout
    custom_llm_provider: Provider name (e.g., 'anthropic')
    **kwargs: Additional parameters

Returns:
    Skill object
litellm_logging_objlitellm_call_idNr5   FT	anthropicr/   r.   user_id)r/   r.   r   rT   user_api_key_dict	_is_asynclogging_objrR   providerz"CREATE skill is not supported for headerslitellm_params)create_requestr\   r[   r   AnthropicModelInfoskills)api_baseendpointr   r7   optional_paramsr\   r3   r   shared_session)urlrequest_bodyskills_api_provider_configr3   r\   rW   r0   r2   rV   r   re   r6    )r;   r   popr   updater   LITELLM_PROXYvaluer-   create_skill_handlerr'   r"   r   get_provider_skills_api_configrE   
ValueErrorvalidate_environmenttransform_create_skill_request#litellm.llms.anthropic.common_utilsr_   get_api_basera   get_complete_urlupdate_from_kwargsbase_llm_http_handlerr
   rD   rF   )r.   r/   r0   r1   r$   r2   r3   r   rG   rQ   rR   rV   r\   r]   rh   r[   rg   r_   ra   rf   rM   rN   s                         r!   r>   r>      sj   6 Je
17<Q1R)/4Et)LJJ6$>	 .77 &"- .0$.;?+&+7# !!*- ,"<"<"B"BB.0EE+4VH

9-"DV"L#/ / F 	 	 "@@ --.AB 	# &-ABUAVWXX  %2,AA B 

 2PP)) Q 
 	K%22>3J3JK(99 : 

 	..(!? !4 	/ 	
 )==%'A 3)+!.::h'!::&67 > 
  
$$ 3 (
 	

s   CG C3G 
G3G..G3limitpagesourcec                   #    [        5       n [        R                  " 5       n	SUS'   [        [        4U UUUUUUS.UD6n
[
        R                  " 5       n[        UR                  U
5      nU	R                  SU5      I Sh  vN n[        R                  " U5      (       a  UI Sh  vN nU$ UnU$  N/ N! [         a  n[        R                  " SUUUUS9eSnAff = f7f)a  
Async: List all skills

Args:
    limit: Number of results to return per page (max 100, default 20)
    page: Pagination token for fetching a specific page of results
    source: Filter skills by source ('custom' or 'anthropic')
    extra_headers: Additional headers for the request
    extra_query: Additional query parameters
    timeout: Request timeout
    custom_llm_provider: Provider name (e.g., 'anthropic')
    **kwargs: Additional parameters

Returns:
    ListSkillsResponse object
Talist_skills)rx   ry   rz   r0   r1   r2   r3   Nr6   )r;   r<   r=   r   list_skillsr?   r@   rA   rB   rC   rD   rE   rF   )rx   ry   rz   r0   r1   r2   r3   r   rG   rH   rI   rJ   rK   rL   rM   rN   s                   r!   r|   r|     s     6 J 
%%'!%~

'# 3

 

 &&(#CGGT2"2249JKK}--**H  %H L +  
$$ 3 (
 	

rO   c                 |   [        5       n UR                  S5      n	UR                  SS5      n
UR                  SS5      SL n[        S0 UD6nUc  SnU[        R
                  R                  :X  a.  [        5       R                  U =(       d    SS	[        U5      UU	U
S
9$ [        R                  " [        R                  " U5      S9nUc  [        SU 35      e0 nU b  XS'   Ub  XS'   Ub  X.S'   U(       a  UR                  U5        U=(       d    0 nUR                  XS9nUR!                  UUUS9u  nnU	R#                  USUSU
0US9  [$        R                  UUUUUU	UU=(       d    [&        UUR                  S5      UR                  S5      S9nU$ ! [(         a  n[        R*                  " SUUUUS9eSnAff = f)a  
List all skills

Args:
    limit: Number of results to return per page (max 100, default 20)
    page: Pagination token for fetching a specific page of results
    source: Filter skills by source ('custom' or 'anthropic')
    extra_headers: Additional headers for the request
    extra_query: Additional query parameters
    timeout: Request timeout
    custom_llm_provider: Provider name (e.g., 'anthropic')
    **kwargs: Additional parameters

Returns:
    ListSkillsResponse object
rQ   rR   Nr|   FTrS      r   )rx   offsetrU   rV   rW   rR   rX   z!LIST skills is not supported for rx   ry   rz   rZ   )list_paramsr\   r[   rc   r   re   )rf   query_paramsrh   r3   r\   rW   r0   r2   rV   r   re   r6   ri   )r;   r   rj   r   r   rl   rm   r-   list_skills_handlerr"   r   ro   rE   rp   rk   rq   transform_list_skills_requestrv   rw   r
   rD   rF   )rx   ry   rz   r0   r1   r2   r3   r   rG   rQ   rR   rV   r\   rh   r   r[   rf   r   rM   rN   s                       r!   r}   r}   J  s7   6 J]
17<Q1R)/4Et)LJJ~u5=	 .77 &"- ,"<"<"B"BB.0DDkr"DV"L#/ / E   "@@ --.AB 	# &-@AT@UVWW )+#( "&$*! {+  %2,AA B 

 7TT#) U 
\ 	..(!? !4 	/ 	
 )<<%'A 3)+!.::h'!::&67 = 
  
$$ 3 (
 	

s   BF C4F 
F;F66F;skill_idc           	        #    [        5       n [        R                  " 5       nSUS'   [        [        4U UUUUS.UD6n[
        R                  " 5       n	[        U	R                  U5      n
UR                  SU
5      I Sh  vN n[        R                  " U5      (       a  UI Sh  vN nU$ UnU$  N/ N! [         a  n[        R                  " SUUUUS9eSnAff = f7f)aF  
Async: Get a skill by ID

Args:
    skill_id: The ID of the skill to fetch
    extra_headers: Additional headers for the request
    extra_query: Additional query parameters
    timeout: Request timeout
    custom_llm_provider: Provider name (e.g., 'anthropic')
    **kwargs: Additional parameters

Returns:
    Skill object
T
aget_skillr   r0   r1   r2   r3   Nr6   )r;   r<   r=   r   	get_skillr?   r@   rA   rB   rC   rD   rE   rF   r   r0   r1   r2   r3   r   rG   rH   rI   rJ   rK   rL   rM   rN   s                 r!   r   r     s     . J
%%'#|
'# 3
 
 &&(#CGGT2"2249JKK}--**H  %H L +  
$$ 3 (
 	

Y   CA0B2 >B.?$B2 #B0$B2 )C*B2 -C.B2 0B2 2
C<CCCc                 h   [        5       n UR                  S5      nUR                  SS5      nUR                  SS5      SL n	[        S0 UD6n
Uc  SnU[        R
                  R                  :X  a$  [        5       R                  U [        U5      U	UUS9$ [        R                  " [        R                  " U5      S	9nUc  [        S
U 35      eU=(       d    0 nUR                  XS9nSSKJn  UR#                  U
R$                  5      nUR'                  U U=(       d    [(        U
US9u  pUR+                  USSU 0SU0US9  [,        R                  UUUU
UUU=(       d    [.        U	UR                  S5      UR                  S5      S9
nU$ ! [0         a  n[        R2                  " SUUUUS9eSnAff = f)a?  
Get a skill by ID

Args:
    skill_id: The ID of the skill to fetch
    extra_headers: Additional headers for the request
    extra_query: Additional query parameters
    timeout: Request timeout
    custom_llm_provider: Provider name (e.g., 'anthropic')
    **kwargs: Additional parameters

Returns:
    Skill object
rQ   rR   Nr   FTrS   r   rU   rV   rW   rR   rX   zGET skill is not supported for rZ   r   r^   r   ra   r\   r[   r   rc   r   re   
rf   rh   r3   r\   rW   r0   r2   rV   r   re   r6   ri   )r;   r   rj   r   r   rl   rm   r-   get_skill_handlerr"   r   ro   rE   rp   rq   rs   r_   rt   ra   transform_get_skill_requestDEFAULT_ANTHROPIC_API_BASErv   rw   r
   rD   rF   r   r0   r1   r2   r3   r   rG   rQ   rR   rV   r\   rh   r[   r_   ra   rf   rM   rN   s                     r!   r   r     s   . JT
17<Q1R)/4Et)LJJ|U3t;	 .77 &"- ,"<"<"B"BB.0BB!"DV"L#/ / C   "@@ --.AB 	# &->?R>STUU  %2,AA B 

 	K%22>3J3JK 2MM;!;)	 N 
 	..'2!? !4 	/ 	
 )::'A 3)+!.::h'!::&67 ; 
  
$$ 3 (
 	

   BF
 C4F
 

F1F,,F1c           	        #    [        5       n [        R                  " 5       nSUS'   [        [        4U UUUUS.UD6n[
        R                  " 5       n	[        U	R                  U5      n
UR                  SU
5      I Sh  vN n[        R                  " U5      (       a  UI Sh  vN nU$ UnU$  N/ N! [         a  n[        R                  " SUUUUS9eSnAff = f7f)aX  
Async: Delete a skill by ID

Args:
    skill_id: The ID of the skill to delete
    extra_headers: Additional headers for the request
    extra_query: Additional query parameters
    timeout: Request timeout
    custom_llm_provider: Provider name (e.g., 'anthropic')
    **kwargs: Additional parameters

Returns:
    DeleteSkillResponse object
Tadelete_skillr   Nr6   )r;   r<   r=   r   delete_skillr?   r@   rA   rB   rC   rD   rE   rF   r   s                 r!   r   r   n  s     . J
%%'"&
'# 3
 
 &&(#CGGT2"2249JKK}--**H  %H L +  
$$ 3 (
 	

r   c                 h   [        5       n UR                  S5      nUR                  SS5      nUR                  SS5      SL n	[        S0 UD6n
Uc  SnU[        R
                  R                  :X  a$  [        5       R                  U [        U5      U	UUS9$ [        R                  " [        R                  " U5      S	9nUc  [        S
U 35      eU=(       d    0 nUR                  XS9nSSKJn  UR#                  U
R$                  5      nUR'                  U U=(       d    [(        U
US9u  pUR+                  USSU 0SU0US9  [,        R                  UUUU
UUU=(       d    [.        U	UR                  S5      UR                  S5      S9
nU$ ! [0         a  n[        R2                  " SUUUUS9eSnAff = f)aQ  
Delete a skill by ID

Args:
    skill_id: The ID of the skill to delete
    extra_headers: Additional headers for the request
    extra_query: Additional query parameters
    timeout: Request timeout
    custom_llm_provider: Provider name (e.g., 'anthropic')
    **kwargs: Additional parameters

Returns:
    DeleteSkillResponse object
rQ   rR   Nr   FTrS   r   rX   z"DELETE skill is not supported for rZ   r   r^   r   r   rc   r   re   r   r6   ri   )r;   r   rj   r   r   rl   rm   r-   delete_skill_handlerr"   r   ro   rE   rp   rq   rs   r_   rt   ra   transform_delete_skill_requestr   rv   rw   r
   rD   rF   r   s                     r!   r   r     s   . JT
17<Q1R)/4Et)LJJ6$>	 .77 &"- ,"<"<"B"BB.0EE!"DV"L#/ / F   "@@ --.AB 	# &-ABUAVWXX  %2,AA B 

 	K%22>3J3JK 2PP;!;)	 Q 
 	..'2!? !4 	/ 	
 )=='A 3)+!.::h'!::&67 > 
  
$$ 3 (
 	

r   )NNNNNNN)NNNN)6__doc__r<   r?   	functoolsr   typingr   r   r   r   r   r	   httpxrE   litellm.constantsr
   *litellm.litellm_core_utils.litellm_loggingr   LiteLLMLoggingObj+litellm.llms.base_llm.skills.transformationr   *litellm.llms.custom_httpx.llm_http_handlerr   #litellm.types.llms.anthropic_skillsr   r   r   r   r   litellm.types.routerr   litellm.types.utilsr   litellm.utilsr   r   rw   r   r+   strr"   r'   r-   floatTimeoutr5   r>   intr|   r}   r   r   r   r   ri   r#   r!   <module>r      sU  
    > >   - S K I  6 , 7 +, ;   tCH~ (3- cNc3h( d38n	# !%#'.2,0+/59)-;
DI;
C=;
 DcN+;
 $sCx.)	;

 c3h(;
 eE5==012;
 "#;
 ;
 ;
| !%#'.2,0+/59)-@
DI@
C=@
 DcN+@
 $sCx.)	@

 c3h(@
 eE5==012@
 "#@
 5)CeO,,-@
 @
F  .2,059)-;
C=;

3-;
 SM;
 DcN+	;

 $sCx.);
 eE5==012;
 "#;
 ;
 ;
|  .2,059)-x
C=x

3-x
 SMx
 DcN+	x

 $sCx.)x
 eE5==012x
 "#x
 yc3E)EFFGx
 x
v  /3,059)-5
5
DcN+5
 $sCx.)5
 eE5==012	5

 "#5
 5
 5
p  /3,059)-k
k
DcN+k
 $sCx.)k
 eE5==012	k

 "#k
 5)CeO,,-k
 k
\  /3,059)-5
5
DcN+5
 $sCx.)5
 eE5==012	5

 "#5
 5
 5
p  /3,059)-k
k
DcN+k
 $sCx.)k
 eE5==012	k

 "#k
 	#s4G*G HHIk
 k
r#   