
    Cjo[              1       T   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JrJr  SSKrSSKrSSKJr  SSKJrJr  SSKJr  SSKJrJrJrJrJrJrJr  SS	K J!r!  SS
K"J#r#  \#                  S'S\\$   S\\$   S\\   S\\\      S\\$   S\\	\$\4      S\\%   S\\%   S\\%   S\\   S\\\$      S\\	\$\4      S\\$   S\\$   S\\	\$\4      S\\	\$\4      S\\\&\RN                  4      S\\$   S\\\\   4   4&S jj5       r(\#                  S'S\\$   S\\$   S\\   S\\\      S\\$   S\\	\$\4      S\\%   S\\%   S\\%   S\\   S\\\$      S\\	\$\4      S\\$   S\\$   S\\	\$\4      S\\	\$\4      S\\\&\RN                  4      S\\$   S\\\
\   \\\\\\\   4   4   4   4&S jj5       r)\#   S(S \$S\\	\$\4      S\\\&\RN                  4      S\\$   S\4
S! jj5       r*\#   S(S \$S\\	\$\4      S\\\&\RN                  4      S\\$   S\\\\\\4   4   4
S" jj5       r+\#   S(S \$S\\	\$\4      S\\\&\RN                  4      S\\$   S\4
S# jj5       r,\#   S(S \$S\\	\$\4      S\\\&\RN                  4      S\\$   S\\\\\\4   4   4
S$ jj5       r-\#   S(S \$S\\	\$\4      S\\\&\RN                  4      S\\$   S\4
S% jj5       r.\#   S(S \$S\\	\$\4      S\\\&\RN                  4      S\\$   S\\\\\\4   4   4
S& jj5       r/g))a  
LiteLLM Interactions API - Main Module

Per OpenAPI spec (https://ai.google.dev/static/api/interactions.openapi.json):
- Create interaction: POST /{api_version}/interactions
- Get interaction: GET /{api_version}/interactions/{interaction_id}
- Delete interaction: DELETE /{api_version}/interactions/{interaction_id}

Usage:
    import litellm

    # Create an interaction with a model
    response = litellm.interactions.create(
        model="gemini-2.5-flash",
        input="Hello, how are you?"
    )

    # Create an interaction with an agent
    response = litellm.interactions.create(
        agent="deep-research-pro-preview-12-2025",
        input="Research the current state of cancer research"
    )

    # Async version
    response = await litellm.interactions.acreate(...)

    # Get an interaction
    response = litellm.interactions.get(interaction_id="...")

    # Delete an interaction
    result = litellm.interactions.delete(interaction_id="...")
    N)partial)AnyAsyncIterator	CoroutineDictIteratorListOptionalUnion)interactions_http_handler)InteractionsAPIRequestUtils$get_provider_interactions_api_config)Logging)CancelInteractionResultDeleteInteractionResultInteractionEnvironmentInteractionInputInteractionsAPIResponse InteractionsAPIStreamingResponseInteractionTool)GenericLiteLLMParams)clientmodelagentinputtoolssystem_instructiongeneration_configstreamstore
backgroundenvironmentresponse_modalitiesresponse_formatresponse_mime_typeprevious_interaction_idextra_headers
extra_bodytimeoutcustom_llm_providerreturnc           	        #    [        5       n [        R                  " 5       nSUS'   Uc2  U (       a+  [        R                  " U UR                  SS5      S9u  nn  nOUc  Sn[        [        40 SU _SU_S	U_S
U_SU_SU_SU_SU_SU_SU	_SU
_SU_SU_SU_SU_SU_SU_SU_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                  " U UUUUS9eSnAff = f7f)u.  
Async: Create a new interaction using Google's Interactions API.

Per OpenAPI spec, provide either `model` or `agent`.

Args:
    model: The model to use (e.g., "gemini-2.5-flash")
    agent: The agent to use (e.g., "deep-research-pro-preview-12-2025")
    input: The input content (string, content object, or list)
    tools: Tools available for the model
    system_instruction: System instruction for the interaction
    generation_config: Generation configuration
    stream: Whether to stream the response
    store: Whether to store the response for later retrieval
    background: Whether to run in background
    environment: Agent execution environment — ``"remote"``, an existing env id
        string, or a config object such as
        ``{"type": "remote", "sources": [...]}`` /
        ``{"type": "remote", "network": {...}}``
    response_modalities: Requested response modalities (TEXT, IMAGE, AUDIO)
    response_format: JSON schema for response format
    response_mime_type: MIME type of the response
    previous_interaction_id: ID of previous interaction for continuation
    extra_headers: Additional headers
    extra_body: Additional body parameters
    timeout: Request timeout
    custom_llm_provider: Override the LLM provider

Returns:
    InteractionsAPIResponse or async iterator for streaming
Tacreate_interactionNapi_base)r   r.   geminir   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   r   r*   original_exceptioncompletion_kwargsextra_kwargs)localsasyncioget_event_looplitellmget_llm_providergetr   createcontextvarscopy_contextrunrun_in_executoriscoroutine	Exceptionexception_type)r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   kwargs
local_varsloop_funcctxfunc_with_contextinit_responseresponsees                               k/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/litellm/interactions/main.pyacreaterM   A   s    D J3
%%'(,$%&5+2+C+CfjjT&B,(A"Aq !("*

 
 	

 
  2
 0
 
 
 "
 $
 !4
 ,
  2
 %<
  (!
" "#
$ %
& !4)
. &&(#CGGT2"2249JKK}--**H  %H L +
  
$$ 3 (
 	

sY   ECD (D)$D DD ED ED D 
E&D>>EE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(       a  X:X  a  Sn U(       a  U (       d  U=(       d    SnOCU (       a1  [        R
                  " U UUR                  UR                  S9u  n n  nOU=(       d    Sn[        UU S	9nUR                  U5        [        R                  " U5      nUS
:X  d  Uc/  SSKJn  U" 5       nUR                  " SU =(       d    SUUUUUS.UD6$ UR                  UU [!        U5      SU0US9  ["        R$                  " U UUUUUUUUUUUUS9nU$ ! [&         a  n[        R(                  " U UUUUS9eSnAff = f)u'  
Sync: Create a new interaction using Google's Interactions API.

Per OpenAPI spec, provide either `model` or `agent`.

Args:
    model: The model to use (e.g., "gemini-2.5-flash")
    agent: The agent to use (e.g., "deep-research-pro-preview-12-2025")
    input: The input content (string, content object, or list)
    tools: Tools available for the model
    system_instruction: System instruction for the interaction
    generation_config: Generation configuration
    stream: Whether to stream the response
    store: Whether to store the response for later retrieval
    background: Whether to run in background
    environment: Agent execution environment — ``"remote"``, an existing env id
        string, or a config object such as
        ``{"type": "remote", "sources": [...]}`` /
        ``{"type": "remote", "network": {...}}``
    response_modalities: Requested response modalities (TEXT, IMAGE, AUDIO)
    response_format: JSON schema for response format
    response_mime_type: MIME type of the response
    previous_interaction_id: ID of previous interaction for continuation
    extra_headers: Additional headers
    extra_body: Additional body parameters
    timeout: Request timeout
    custom_llm_provider: Override the LLM provider

Returns:
    InteractionsAPIResponse or iterator for streaming
litellm_logging_objlitellm_call_idNr-   FTr/   )r   r*   r.   api_key)providerr   litellm_responsesr   )#LiteLLMResponsesInteractionsHandler )r   r   optional_paramsr*   	_is_asyncr   rB   r   rV   litellm_paramsr*   )r   r   r   interactions_api_configrV   r*   rY   logging_objr'   r(   r)   rW   r   r0    )r4   r9   popr   r7   r8   r.   rQ   r   updater   .get_requested_interactions_api_optional_params=litellm.interactions.litellm_responses_transformation.handlerrT   interactions_api_handlerupdate_from_kwargsdictr   create_interactionr@   rA   )r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r)   r*   rB   rC   rO   rP   rW   rY   rE   rZ   rV   rT   handlerrJ   rK   s                                  rL   r:   r:      s   T J[
17<Q1R)/4Et)LJJ4e<D	-77
 U^E"5"A/6/G/G$7'00&..	0,E&1 #6"A"F(#
 	&!'VV 	  #66&. :;G33 kr /$7#   	.. 1-? 3 	/ 	
 -??$;+ 3)+'!
   
$$ 3 (
 	

s   DE" "?E" "
F	,FF	interaction_idc           	        #    [        5       n [        R                  " 5       nSUS'   [        [        4U UUU=(       d    S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=(       d    SUUUS9eSnAff = f7f)z$Async: Get an interaction by its ID.Taget_interactionr/   rf   r'   r)   r*   Nr0   )r4   r5   r6   r   r9   r;   r<   r=   r>   r?   r@   r7   rA   rf   r'   r)   r*   rB   rC   rD   rF   rG   rH   rI   rJ   rK   s                rL   agetrk   i  s      J
%%'%)!"
)' 3 ?x
 
 &&(#CGGT2"2249JKK}--**H  %H L +
  
$$ 3 ?x (
 	

Y   C-A8B: B6$B: +B8,B: 1C-2B: 5C-6B: 8B: :
C*!C%%C**C-c                    [        5       nU=(       d    S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S9n
U
c  [        S	U 35      eUR                  USS
U 0SU0US9  [        R                  " U U
UU	UUUUS9$ ! [         a  n[        R                  " SUUUUS9eSnAff = f)z#Sync: Get an interaction by its ID.r/   rO   rP   Nrh   FTrR   $Interactions API not supported for: rf   rX   rf   rZ   r*   rY   r[   r'   r)   rW   r0   r\   )r4   r9   r]   r   r   
ValueErrorrb   r   get_interactionr@   r7   rA   rf   r'   r)   r*   rB   rC   rO   rP   rW   rY   rZ   rK   s               rL   r9   r9     s    J-9)
17<Q1R)/4Et)LJJ159TA	-77"F(#
 #*67J6KL  	..-~>-? 3 	/ 	
 )88)$; 3)+'	
 		
  
$$ 3 (
 	

   BB% %
C/CCc           	        #    [        5       n [        R                  " 5       nSUS'   [        [        4U UUU=(       d    S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=(       d    SUUUS9eSnAff = f7f)z'Async: Delete an interaction by its ID.Tadelete_interactionr/   ri   Nr0   )r4   r5   r6   r   deleter;   r<   r=   r>   r?   r@   r7   rA   rj   s                rL   adeleterx           J
%%'(,$%
)' 3 ?x
 
 &&(#CGGT2"2249JKK}--**H  %H L +
  
$$ 3 ?x (
 	

rl   c                    [        5       nU=(       d    S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S9n
U
c  [        S	U 35      eUR                  USS
U 0SU0US9  [        R                  " U U
UU	UUUUS9$ ! [         a  n[        R                  " SUUUUS9eSnAff = f)z&Sync: Delete an interaction by its ID.r/   rO   rP   Nrv   FTrn   ro   rf   rX   rp   r0   r\   )r4   r9   r]   r   r   rq   rb   r   delete_interactionr@   r7   rA   rs   s               rL   rw   rw         J-9)
17<Q1R)/4Et)LJJ4e<D	-77"F(#
 #*67J6KL  	..-~>-? 3 	/ 	
 );;)$; 3)+'	
 		
  
$$ 3 (
 	

rt   c           	        #    [        5       n [        R                  " 5       nSUS'   [        [        4U UUU=(       d    S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=(       d    SUUUS9eSnAff = f7f)z'Async: Cancel an interaction by its ID.Tacancel_interactionr/   ri   Nr0   )r4   r5   r6   r   cancelr;   r<   r=   r>   r?   r@   r7   rA   rj   s                rL   acancelr   9  ry   rl   c                    [        5       nU=(       d    S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S9n
U
c  [        S	U 35      eUR                  USS
U 0SU0US9  [        R                  " U U
UU	UUUUS9$ ! [         a  n[        R                  " SUUUUS9eSnAff = f)z&Sync: Cancel an interaction by its ID.r/   rO   rP   Nr~   FTrn   ro   rf   rX   rp   r0   r\   )r4   r9   r]   r   r   rq   rb   r   cancel_interactionr@   r7   rA   rs   s               rL   r   r   d  r|   rt   )NNNNNNNNNNNNNNNNNN)NNN)0__doc__r5   r;   	functoolsr   typingr   r   r   r   r   r	   r
   r   httpxr7   !litellm.interactions.http_handlerr   litellm.interactions.utilsr   r   *litellm.litellm_core_utils.litellm_loggingr   LiteLLMLoggingObjlitellm.types.interactionsr   r   r   r   r   r   r   litellm.types.routerr   litellm.utilsr   strboolfloatTimeoutrM   r:   rk   r9   rx   rw   r   r   r\       rL   <module>r      s  B    W W W   G T   6     (,-1(,26! !%48/304(,-1.2+/59)-?u
C=u
 C=u

 $%u
 D)*u
 !u
  S#X/u
 TNu
 D>u
" #u
& 01'u
* "$s),+u
, d38n--u
. !/u
2 &c]3u
6 DcN+7u
8 c3h(9u
: eE5==012;u
> "#?u
B "M2R$SSTCu
 u
p   (,-1(,26! !%48/304(,-1.2+/59)-?f
C=f
 C=f

 $%f
 D)*f
 !f
  S#X/f
 TNf
 D>f
" #f
& 01'f
* "$s),+f
, d38n--f
. !/f
2 &c]3f
6 DcN+7f
8 c3h(9f
: eE5==012;f
> "#?f
B -.%}5U'VVW	YCf
 f
\  /359)-	'
'
DcN+'
 eE5==012'
 "#	'
 '
 '
T  /359)-	4
4
DcN+4
 eE5==0124
 "#	4
 "Ic38O.O$PPQ4
 4
x  /359)-	'
'
DcN+'
 eE5==012'
 "#	'
 '
 '
T  /359)-	4
4
DcN+4
 eE5==0124
 "#	4
 "Ic38O.O$PPQ4
 4
x  /359)-	'
'
DcN+'
 eE5==012'
 "#	'
 '
 '
T  /359)-	4
4
DcN+4
 eE5==0124
 "#	4
 "Ic38O.O$PPQ4
 4
r   