andrewyng / translation-agent

MIT License
4.83k stars 553 forks source link

remove redundant line #8

Closed rdmueller closed 4 months ago

rdmueller commented 5 months ago

the line removed was redundant - the source_text gets already replaced through the f"-string

rdmueller commented 5 months ago

There is this string

    translation_prompt = f"""This is an {source_lang} to {target_lang} translation, please provide the {target_lang} translation for this text. \
Do not provide any explanations or text apart from the translation.
{source_lang}: {source_text}
{target_lang}:"""

the f""" means format which replaces all {variable} with the content of variable

The next line

prompt = translation_prompt.format(source_text=source_text)

also invokes the format but does nothing, since the variables are already substituted.

siddhantx0 commented 5 months ago

ohhh makes sense ok ty :)

methanet commented 4 months ago

@rdmueller Thank you for catching this and for opening the PR! In addition to your proposed changes, it looks like a similar update needs to be performed in the one_chunk_reflect_on_translation function. Would you be able to add this fix to the PR before we merge? Much appreciated!

rdmueller commented 4 months ago

@methanet correct. I've updated the script accordingly