Skip to content

Commit

Permalink
Fix translation prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
mzr1996 committed Feb 2, 2024
1 parent 7464d6e commit 91cd0d3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions agentlego/tools/translation/translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ def __init__(self, backend: str = 'google', toolmeta=None):
else:
raise NotImplementedError(f'The backend {backend} is not available.')

def apply(self, text: str, source_lang: str, target_lang: str) -> str:
return self._translate(text, source_lang, target_lang)

def google_translate(
def apply(
self,
text: Annotated[str, Info('The text to translate.')],
target: Annotated[str, Info('The target language code.')],
source: Annotated[str, Info('The source language code.')] = 'auto',
text: Annotated[str, Info('The text to translate')],
target: Annotated[str, Info('The target language code')],
source: Annotated[str, Info('The source language code')] = 'auto',
) -> str:
return self._translate(text, target, source)

def google_translate(self, text: str, target: str, source: str = 'auto') -> str:
text = quote_plus(text)
url_tmpl = ('https://translate.googleapis.com/translate_a/'
'single?client=gtx&sl={}&tl={}&dt=at&dt=bd&dt=ex&'
Expand Down

0 comments on commit 91cd0d3

Please sign in to comment.