From 8a6d103f1d0ad3f569e1796205b22f48caa6c5c2 Mon Sep 17 00:00:00 2001 From: Joaquin Dominguez Date: Mon, 10 Jun 2024 18:26:59 -0400 Subject: [PATCH] added readme to examples subdir and cleaned up unit test + translation output --- examples/README.md | 16 ++++++++++++++++ src/translation_agent/utils.py | 3 --- tests/test_agent.py | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 examples/README.md diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 0000000..28e6045 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,16 @@ +# Examples + +This directory contains example scripts demonstrating the usage of the `translation-agent` workflow. + +## Contents +- `example_script.py`: A simple script showing how to perform machine translation using the package. +- `sample-texts/`: A directory containing a few sample texts from The Batch letters written by Andrew and Data Points summaries found on the [DeepLearning.ai website](https://www.deeplearning.ai/the-batch/tag/data-points/). + +## Usage +To run the example scripts, ensure that you have installed the `translation-agent` package and have activated your virtual environment. Then run: + +```python +python example_script.py +``` + +If you have any questions or encounter any issues, please feel free to open an issue on the Github repository. diff --git a/src/translation_agent/utils.py b/src/translation_agent/utils.py index 871dc98..1256281 100755 --- a/src/translation_agent/utils.py +++ b/src/translation_agent/utils.py @@ -178,7 +178,6 @@ def one_chunk_reflect_on_translation( translation_1=translation_1, ) reflection = get_completion(prompt, system_message=system_message) - print("Reflection:", reflection) return reflection @@ -260,8 +259,6 @@ def one_chunk_translate_text( source_lang, target_lang, source_text ) - ic(translation_1) - reflection = one_chunk_reflect_on_translation( source_lang, target_lang, source_text, translation_1, country ) diff --git a/tests/test_agent.py b/tests/test_agent.py index 7661aae..6cad42d 100644 --- a/tests/test_agent.py +++ b/tests/test_agent.py @@ -198,12 +198,12 @@ def test_one_chunk_improve_translation(mock_get_completion, example_data): {example_data["reflection"]} -Please take into account the expert suggestions when editing the translation. Edit the translation by ensuring: +Please take into account the expert suggestions when editing the translation. Edit the translation by ensuring: (i) accuracy (by correcting errors of addition, mistranslation, omission, or untranslated text), (ii) fluency (by applying Spanish grammar, spelling and punctuation rules and ensuring there are no unnecessary repetitions), \ (iii) style (by ensuring the translations reflect the style of the source text) -(iv) terminology (inappropriate for context, inconsistent use), or \ +(iv) terminology (inappropriate for context, inconsistent use), or (v) other errors. Output only the new translation and nothing else."""