Interface GPTTranslationService
-
- All Known Implementing Classes:
GPTTranslationServiceImpl
public interface GPTTranslationService
Building onGPTChatCompletionService
this implements translation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default List<String>
fragmentedTranslation(List<String> texts, String targetLanguage, GPTConfiguration configuration)
Translates the texts into the target language.List<String>
fragmentedTranslation(List<String> texts, String targetLanguage, GPTConfiguration configuration, List<GPTResponseCheck> translationChecks)
Translates the texts into the target language.String
singleTranslation(String text, String sourceLanguage, String targetLanguage, GPTConfiguration configuration)
Translate the text from the target to destination language, either Java locale name or language name.void
streamingSingleTranslation(String text, String sourceLanguage, String targetLanguage, GPTConfiguration configuration, GPTCompletionCallback callback)
Translate the text from the target to destination language, either Java locale name or language name.
-
-
-
Method Detail
-
singleTranslation
@Nullable String singleTranslation(@Nullable String text, @Nullable String sourceLanguage, @Nullable String targetLanguage, @Nullable GPTConfiguration configuration) throws GPTException
Translate the text from the target to destination language, either Java locale name or language name.- Parameters:
text
- the text to translatesourceLanguage
- the language to translate from - human readable name, or null for autodetecttargetLanguage
- the language to translate to - human readable nameconfiguration
- the configuration to use- Throws:
GPTException
-
streamingSingleTranslation
void streamingSingleTranslation(@Nonnull String text, @Nonnull String sourceLanguage, @Nonnull String targetLanguage, @Nullable GPTConfiguration configuration, @Nonnull GPTCompletionCallback callback) throws GPTException
Translate the text from the target to destination language, either Java locale name or language name.- Throws:
GPTException
-
fragmentedTranslation
@Nonnull default List<String> fragmentedTranslation(@Nonnull List<String> texts, @Nonnull String targetLanguage, @Nullable GPTConfiguration configuration) throws GPTException
Translates the texts into the target language. The texts should belong together, like e.g. the texts of a page, since the translations might influence each other. (We try to translate them in one request.)- Parameters:
texts
- the texts to translatetargetLanguage
- the language to translate to - human readable name- Returns:
- the translated texts
- Throws:
GPTException
-
fragmentedTranslation
@Nonnull List<String> fragmentedTranslation(@Nonnull List<String> texts, @Nonnull String targetLanguage, @Nullable GPTConfiguration configuration, @Nullable List<GPTResponseCheck> translationChecks) throws GPTException
Translates the texts into the target language. The texts should belong together, like e.g. the texts of a page, since the translations might influence each other. (We try to translate them in one request.)- Parameters:
texts
- the texts to translatetargetLanguage
- the language to translate to - human readable nameconfiguration
- the configuration to usetranslationChecks
- additional checks to verify the translation- Returns:
- the translated texts
- Throws:
GPTException
-
-