
    AHj
                     x    d Z ddlmZmZmZmZ ddlmZ ddlm	Z	 h dZ
	 ddedee   d	ee   fd
Z G d d      Zy)z)
Utility functions for Interactions API.
    )AnyDictOptionalcast)BaseInteractionsAPIConfig)$InteractionsAPIOptionalRequestParams>   storetoolsstream
backgroundagent_configresponse_formatgeneration_configresponse_mime_typesystem_instructionresponse_modalitiesprevious_interaction_idNprovidermodelreturnc                 f    ddl m} | |j                  j                  k(  s| dk(  rddlm}  |       S y)z
    Get the interactions API config for the given provider.

    Args:
        provider: The LLM provider name
        model: Optional model name

    Returns:
        The provider-specific interactions API config, or None if not supported
    r   )LlmProvidersgemini) GoogleAIStudioInteractionsConfigN)litellm.types.utilsr   GEMINIvalue/litellm.llms.gemini.interactions.transformationr   )r   r   r   r   s       R/root/tools/cai/cai_env/lib/python3.12/site-packages/litellm/interactions/utils.py$get_provider_interactions_api_configr       s5     1<&&,,,H0D	
 011    c                   4    e Zd ZdZedeeef   defd       Z	y)InteractionsAPIRequestUtilsz8Helper utils for constructing Interactions API requests.paramsr   c                     ddl m} | j                  dd      }| j                  di       }| j                  dd      }|j                  | |||t        D ci c]  }|d c}g d      }t        t        |      S c c}w )	a  
        Filter parameters to only include valid optional params per OpenAPI spec.

        Args:
            params: Dictionary of parameters to filter (typically from locals())

        Returns:
            Dict with only the valid optional parameters
        r   )PreProcessNonDefaultParamscustom_llm_providerNkwargsadditional_drop_params)inputr   agent)passed_paramsspecial_paramsr'   r)   default_param_values#additional_endpoint_specific_params)litellm.utilsr&   pop#base_pre_process_non_default_params INTERACTIONS_API_OPTIONAL_PARAMSr   r   )r$   r&   r'   r-   r)   knon_default_paramss          r   .get_requested_interactions_api_optional_paramszJInteractionsAPIRequestUtils.get_requested_interactions_api_optional_params7   s     	=$jj)>EHb1!',Dd!K 'JJ$-$7'=%E& !AtG& 5P K 	 	 8:LMM&s   
A9N)
__name__
__module____qualname____doc__staticmethodr   strr   r   r6    r!   r   r#   r#   4   s3    BNS#XN	-N Nr!   r#   )N)r:   typingr   r   r   r   1litellm.llms.base_llm.interactions.transformationr   litellm.types.interactionsr   r3   r<   r    r#   r=   r!   r   <module>rA      sZ    - , W K$  "  C= '(4#N #Nr!   