Skip to content

Commit

Permalink
Merge pull request #7 from j-dominguez9/dev
Browse files Browse the repository at this point in the history
added readme to examples subdir and cleaned up unit test + translation
  • Loading branch information
j-dominguez9 authored Jun 10, 2024
2 parents 018caa1 + 8a6d103 commit 7965883
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
16 changes: 16 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -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.
3 changes: 0 additions & 3 deletions src/translation_agent/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,12 @@ def test_one_chunk_improve_translation(mock_get_completion, example_data):
{example_data["reflection"]}
</EXPERT_SUGGESTIONS>
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."""
Expand Down

0 comments on commit 7965883

Please sign in to comment.