




from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase_  						=   logging.get_logger(__name__)

lowerCamelCase_  						=   {
    "tau/splinter-base": "https://huggingface.co/tau/splinter-base/resolve/main/config.json",
    "tau/splinter-base-qass": "https://huggingface.co/tau/splinter-base-qass/resolve/main/config.json",
    "tau/splinter-large": "https://huggingface.co/tau/splinter-large/resolve/main/config.json",
    "tau/splinter-large-qass": "https://huggingface.co/tau/splinter-large-qass/resolve/main/config.json",
    # See all Splinter models at https://huggingface.co/models?filter=splinter
}
class       __a					( _UpperCamelCase     ):


     """simple docstring"""


     _A				:    List[str]									=  "splinter"




     def __init__(	self			: Optional[Any]				,_UpperCamelCase			: Optional[int]=3_0_5_2_2				,_UpperCamelCase			: Optional[Any]=7_6_8				,_UpperCamelCase			: str=1_2				,_UpperCamelCase			: List[str]=1_2				,_UpperCamelCase			: int=3_0_7_2				,_UpperCamelCase			: Dict="gelu"				,_UpperCamelCase			: Optional[int]=0.1				,_UpperCamelCase			: Tuple=0.1				,_UpperCamelCase			: Optional[Any]=5_1_2				,_UpperCamelCase			: List[str]=2				,_UpperCamelCase			: Union[str, Any]=0.02				,_UpperCamelCase			: Union[str, Any]=1e-12				,_UpperCamelCase			: Union[str, Any]=True				,_UpperCamelCase			: List[Any]=0				,_UpperCamelCase			: Union[str, Any]=1_0_4				,**_UpperCamelCase			: int				,)		->   int:


         '''simple docstring'''





         super().__init__(pad_token_id=__a				,**__a						)

         SCREAMING_SNAKE_CASE__								=vocab_size
         SCREAMING_SNAKE_CASE__								=max_position_embeddings
         SCREAMING_SNAKE_CASE__								=hidden_size
         SCREAMING_SNAKE_CASE__								=num_hidden_layers
         SCREAMING_SNAKE_CASE__								=num_attention_heads
         SCREAMING_SNAKE_CASE__								=intermediate_size
         SCREAMING_SNAKE_CASE__								=hidden_act
         SCREAMING_SNAKE_CASE__								=hidden_dropout_prob
         SCREAMING_SNAKE_CASE__								=attention_probs_dropout_prob
         SCREAMING_SNAKE_CASE__								=initializer_range
         SCREAMING_SNAKE_CASE__								=type_vocab_size
         SCREAMING_SNAKE_CASE__								=layer_norm_eps
         SCREAMING_SNAKE_CASE__								=use_cache
         SCREAMING_SNAKE_CASE__								=question_token_id









import unittest

from transformers import load_tool
from transformers.tools.agent_types import AGENT_TYPE_MAPPING

from .test_tools_common import ToolTesterMixin, output_types



class     lowercase						(       unittest.TestCase ,				_UpperCamelCase					):



 '''simple docstring'''


 def   UpperCamelCase__							(self ) ->					List[Any]:






  """simple docstring"""





  UpperCAmelCase__							=				load_tool('translation' )
  self.tool.setup()
  UpperCAmelCase__							=				load_tool('translation'       ,       remote=__a )




 def   UpperCamelCase__							(self ) ->					Optional[int]:






  """simple docstring"""





  UpperCAmelCase__							=				self.tool('Hey, what\'s up?'       ,       src_lang='English'       ,       tgt_lang='French' )
  self.assertEqual(__a       ,       '- Hé, comment ça va?' )




 def   UpperCamelCase__							(self ) ->					Any:






  """simple docstring"""





  UpperCAmelCase__							=				self.remote_tool('Hey, what\'s up?'       ,       src_lang='English'       ,       tgt_lang='French' )
  self.assertEqual(__a       ,       '- Hé, comment ça va?' )




 def   UpperCamelCase__							(self ) ->					Optional[int]:






  """simple docstring"""





  UpperCAmelCase__							=				self.tool(text='Hey, what\'s up?'       ,       src_lang='English'       ,       tgt_lang='French' )
  self.assertEqual(__a       ,       '- Hé, comment ça va?' )




 def   UpperCamelCase__							(self ) ->					Optional[Any]:






  """simple docstring"""





  UpperCAmelCase__							=				self.remote_tool(text='Hey, what\'s up?'       ,       src_lang='English'       ,       tgt_lang='French' )
  self.assertEqual(__a       ,       '- Hé, comment ça va?' )




 def   UpperCamelCase__							(self ) ->					Any:






  """simple docstring"""





  UpperCAmelCase__							=				['Hey, what\'s up?', 'English', 'Spanish']
  UpperCAmelCase__							=				self.tool(*__a )

  # There is a single output
  if len(self.tool.outputs ) == 1:
   UpperCAmelCase__							=				[outputs]

  self.assertListEqual(output_types(__a )       ,       self.tool.outputs )




 def   UpperCamelCase__							(self ) ->					Optional[int]:






  """simple docstring"""





  UpperCAmelCase__							=				['Hey, what\'s up?', 'English', 'Spanish']
  UpperCAmelCase__							=				self.tool(*__a )

  if not isinstance(__a       ,       __a ):
   UpperCAmelCase__							=				[outputs]

  self.assertEqual(len(__a )       ,       len(self.tool.outputs ) )

  for output, output_type in zip(__a       ,       self.tool.outputs ):
   UpperCAmelCase__							=				AGENT_TYPE_MAPPING[output_type]
   self.assertTrue(isinstance(__a       ,       __a ) )




 def   UpperCamelCase__							(self ) ->					Dict:






  """simple docstring"""





  UpperCAmelCase__							=				['Hey, what\'s up?', 'English', 'Spanish']

  UpperCAmelCase__							=				[]

  for _input, input_type in zip(__a       ,       self.tool.inputs ):
   if isinstance(__a       ,       __a ):
    _inputs.append([AGENT_TYPE_MAPPING[_input_type](_input ) for _input_type in input_type] )
   else:
    _inputs.append(AGENT_TYPE_MAPPING[input_type](_input ) )

        # Should not raise an error
  UpperCAmelCase__							=				self.tool(*__a )

  if not isinstance(__a       ,       __a ):
   UpperCAmelCase__							=				[outputs]

  self.assertEqual(len(__a )       ,       len(self.tool.outputs ) )



