Interface GPTResponseCheck


  • public interface GPTResponseCheck
    An additional check that verifies whether the translation was carried out right - such as paths in HTML weren't translated.
    • Field Detail

      • KEEP_HREF_TRANSLATION_CHECK

        static final GPTResponseCheck KEEP_HREF_TRANSLATION_CHECK
        A check that all href attributes in richtext appear in the translation. Sometimes the GPT translates paths containing recognizable words, so we check that the set of HREFs in the original is the same as the set of HREFs in the translation.
    • Method Detail

      • responseProblem

        @Nullable
        String responseProblem​(@Nonnull
                               String source,
                               @Nonnull
                               String translation)
        Performs a check, and if the check fails it returns additional instructions with which the request is retried.
        Returns:
        null if the response is fine, otherwise the additional instructions to fix the response (possibly an empty string).