ProjectUnifree / unifree

MIT License
1.43k stars 75 forks source link

Use RAG LLM Trick to Support Known Translations #47

Closed bshikin closed 11 months ago

bshikin commented 11 months ago

Using known_translations/{target_engine}.yaml with a collection of known correct translations.

Use chromadb as a vector DB for embeddings of known translations. Lookup closest translations and add them into the translation context on each query.

Example configuration:

known_translations:
  target_engine: godot
  embedding_function: krlvi/sentence-t5-base-nlpl-code_search_net
  result_count: 5
  user_request: |
    Remember this correct translation from Unity: 
${SOURCE}
```
is translated as:
```
${TARGET}
```

assistant_response: Certainly! I will remember this translation.


Where example content of the known translations file is:

translations: