Interface GPTTranslationService
-
- All Known Implementing Classes:
GPTTranslationServiceImpl
public interface GPTTranslationService
Building onGPTChatCompletionService
this implements translation.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description List<String>
fragmentedTranslation(List<String> texts, String targetLanguage, GPTConfiguration configuration)
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.- 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 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
-
-