Google Translate#
- class src.openCHA.tasks.google_translator.GoogleTranslate(*, name: str = 'google_translator', chat_name: str = 'GoogleTranslator', description: str = 'Translates queries between different languages.', dependencies: List[str] = [], inputs: List[str] = ['text to be translated', 'destination language'], outputs: List[str] = [], datapipe: DataPipe = None, output_type: bool = False, return_direct: bool = False, translator: Any = None)[source]#
Description:
This task uses google translate to autmatically convert from the user language to english or vise versa.
- _execute(inputs: List[Any] = None) str [source]#
Abstract method representing the execution of the task.
- Parameters:
input (str) – Input data for the task.
- Returns:
Result of the task execution.
- Return type:
str
- Raises:
NotImplementedError – Subclasses must implement the execute method.
- explain() str [source]#
Provide a sample explanation for the task.
- Returns:
Sample explanation for the task.
- Return type:
str
- translator: Any#
- classmethod validate_environment(values: Dict) Dict [source]#
Validate that api key and python package exists in environment.
- Parameters:
cls (object) – The class itself.
values (Dict) – The dictionary containing the values for validation.
- Returns:
The original values.
- Return type:
Dict
- Raises:
ImportError – If the ‘playwright’ package is not installed.