Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use RAG LLM Trick to Support Known Translations #47

Merged
merged 2 commits into from
Sep 21, 2023

Conversation

bshikin
Copy link
Contributor

@bshikin bshikin commented Sep 21, 2023

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:
  - title: Ternary Operators
    source: |
      variable = {condition} ? (true_statement) : (false_statement);
    target: |
      variable = {translated_true_statement} if {translated_condition} else "{translated_false_statement}
  # ---------------------------------------------------------------------------------------------------------------------
  - title: Start() Function
    source: |
      private void Start()
      {
        {function_body}
      }

    target: |
      func _ready() -> void:
      {
        {translated_function_body}
      }
  # ---------------------------------------------------------------------------------------------------------------------

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.
@bshikin bshikin mentioned this pull request Sep 21, 2023
@bshikin bshikin linked an issue Sep 21, 2023 that may be closed by this pull request
@bshikin bshikin linked an issue Sep 21, 2023 that may be closed by this pull request
@bshikin bshikin merged commit e0affd5 into main Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ternary Operators Godot Method Names Not Ported Correctly
1 participant