o
    ưi
                     @   sp   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
dZG dd dZdS )z)
Utility functions for Interactions API.
    )AnyDictOptionalcast)BaseInteractionsAPIConfig)$InteractionsAPIOptionalRequestParams>   Zresponse_formatZsystem_instructionstreamZgeneration_configstoreZprevious_interaction_idZagent_config
backgroundZresponse_modalitiesZtoolsZresponse_mime_typeNprovidermodelreturnc                 C   s6   ddl m} | |jjks| dkrddlm} | S dS )a  
    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)Zlitellm.types.utilsr   ZGEMINIvalueZ/litellm.llms.gemini.interactions.transformationr   )r   r   r   r    r   Q/home/app/Keep/.python/lib/python3.10/site-packages/litellm/interactions/utils.py$get_provider_interactions_api_config   s
   r   c                   @   s.   e Zd ZdZedeeef defddZ	dS )InteractionsAPIRequestUtilsz8Helper utils for constructing Interactions API requests.paramsr   c                 C   s^   ddl m} | dd}| di }| dd}|j| |||dd tD g d	d
}tt|S )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_paramsc                 S   s   i | ]}|d qS Nr   ).0kr   r   r   
<dictcomp>O   s    z^InteractionsAPIRequestUtils.get_requested_interactions_api_optional_params.<locals>.<dictcomp>)inputr   Zagent)Zpassed_paramsspecial_paramsr   r   Zdefault_param_valuesZ#additional_endpoint_specific_params)Zlitellm.utilsr   popZ#base_pre_process_non_default_params INTERACTIONS_API_OPTIONAL_PARAMSr   r   )r   r   r   r    r   Znon_default_paramsr   r   r   .get_requested_interactions_api_optional_params6   s   
zJInteractionsAPIRequestUtils.get_requested_interactions_api_optional_paramsN)
__name__
__module____qualname____doc__staticmethodr   strr   r   r#   r   r   r   r   r   3   s    
r   r   )r'   typingr   r   r   r   Z1litellm.llms.base_llm.interactions.transformationr   Zlitellm.types.interactionsr   r"   r)   r   r   r   r   r   r   <module>   s    
