Interface GPTContentCreationService
-
- All Known Implementing Classes:
GPTContentCreationServiceImpl
public interface GPTContentCreationService
Service to generate content (keywords / descriptions from a text, and so forth.)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
executePrompt(String prompt, GPTChatRequest additionalParameters)
Executes a given prompt from the user using ChatGPT.String
executePromptOnText(String prompt, String text, GPTChatRequest additionalParameters)
Executes a given prompt from the user using ChatGPT, using the given text as context.void
executePromptOnTextStreaming(String prompt, String text, GPTChatRequest additionalParameters, GPTCompletionCallback callback)
Executes a given prompt from the user using ChatGPT, using the given text as context.void
executePromptStreaming(String prompt, GPTChatRequest additionalParameters, GPTCompletionCallback callback)
Executes a given prompt from the user using ChatGPT.String
generateDescription(String text, int maxwords, GPTConfiguration configuration)
Generates a description from the given text.List<String>
generateKeywords(String text, GPTConfiguration configuration)
Generates a list of keywords from the given text.
-
-
-
Method Detail
-
generateKeywords
@Nonnull List<String> generateKeywords(@Nullable String text, @Nullable GPTConfiguration configuration) throws GPTException
Generates a list of keywords from the given text.- Parameters:
text
- The text to generate keywords from.- Returns:
- A list of generated keywords, possibly empty.
- Throws:
GPTException
-
generateDescription
@Nonnull String generateDescription(@Nullable String text, int maxwords, @Nullable GPTConfiguration configuration) throws GPTException
Generates a description from the given text.- Parameters:
text
- The text to generate a description from.maxwords
- approximate maximum number of words in the description, if > 0- Returns:
- A generated description, possibly empty.
- Throws:
GPTException
-
executePrompt
@Nonnull String executePrompt(@Nullable String prompt, @Nullable GPTChatRequest additionalParameters) throws GPTException
Executes a given prompt from the user using ChatGPT.- Parameters:
prompt
- the prompt text from the usermaxtokens
- used to hard limit text length to that many tokens. If < 1, no limit is set.- Throws:
GPTException
-
executePromptStreaming
void executePromptStreaming(@Nonnull String prompt, @Nullable GPTChatRequest additionalParameters, @Nonnull GPTCompletionCallback callback) throws GPTException
Executes a given prompt from the user using ChatGPT.- Parameters:
prompt
- the prompt text from the usermaxtokens
- used to hard limit text length to that many tokens. If < 1, no limit is set.callback
- the callback to use for streaming the result- Throws:
GPTException
-
executePromptOnText
@Nonnull String executePromptOnText(@Nullable String prompt, @Nullable String text, @Nullable GPTChatRequest additionalParameters) throws GPTException
Executes a given prompt from the user using ChatGPT, using the given text as context.- Parameters:
prompt
- the prompt text from the usertext
- the text to use as context for the promptmaxtokens
- used to hard limit text length to that many tokens. If < 1, no limit is set.- Throws:
GPTException
-
executePromptOnTextStreaming
void executePromptOnTextStreaming(@Nonnull String prompt, @Nonnull String text, @Nullable GPTChatRequest additionalParameters, @Nonnull GPTCompletionCallback callback) throws GPTException
Executes a given prompt from the user using ChatGPT, using the given text as context.- Parameters:
prompt
- the prompt text from the usertext
- the text to use as context for the promptmaxtokens
- used to hard limit text length to that many tokens. If < 1, no limit is set.callback
- the callback to use for streaming the result- Throws:
GPTException
-
-