Interface AIChatBuilder
-
- All Known Implementing Classes:
CopyPseudoAIChatBuilderImpl
,OpenAIChatBuilderImpl
public interface AIChatBuilder
Defines the interface for building AI chat interactions, allowing customization of the model, token limits, and messages.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description AIChatBuilder
assistantMsg(String text)
Adds an assistant message to the chat.String
execute()
Executes the chat completion request and returns the response.AIChatBuilder
key(String key)
Sets the API key for the chat completion request.AIChatBuilder
maxTokens(int maxTokens)
Sets the maximum number of tokens the completion can use.AIChatBuilder
model(String model)
Sets the AI model to be used for the chat completion.AIChatBuilder
organizationId(String organizationId)
Sets the organization ID for the chat completion request - if applicable (OpenAI).AIChatBuilder
systemMsg(String text)
Adds a system message to the chat.String
toJson()
Converts the chat completion request to a JSON string.AIChatBuilder
url(String url)
Sets the URL for the chat completion request.AIChatBuilder
userMsg(String text)
Adds a user message to the chat.
-
-
-
Method Detail
-
url
AIChatBuilder url(String url)
Sets the URL for the chat completion request.- Parameters:
url
- The URL.- Returns:
- The builder instance for chaining.
-
key
AIChatBuilder key(String key)
Sets the API key for the chat completion request.- Parameters:
key
- The API key.- Returns:
- The builder instance for chaining.
-
organizationId
AIChatBuilder organizationId(String organizationId)
Sets the organization ID for the chat completion request - if applicable (OpenAI).- Parameters:
organizationId
- The organization ID.- Returns:
- The builder instance for chaining.
-
maxTokens
AIChatBuilder maxTokens(int maxTokens)
Sets the maximum number of tokens the completion can use.- Parameters:
maxTokens
- The maximum number of tokens.- Returns:
- The builder instance for chaining.
-
model
AIChatBuilder model(String model)
Sets the AI model to be used for the chat completion.- Parameters:
model
- The model name.- Returns:
- The builder instance for chaining.
-
systemMsg
AIChatBuilder systemMsg(String text)
Adds a system message to the chat.- Parameters:
text
- The text of the message.- Returns:
- The builder instance for chaining.
-
userMsg
AIChatBuilder userMsg(String text)
Adds a user message to the chat.- Parameters:
text
- The text of the message.- Returns:
- The builder instance for chaining.
-
assistantMsg
AIChatBuilder assistantMsg(String text)
Adds an assistant message to the chat.- Parameters:
text
- The text of the message.- Returns:
- The builder instance for chaining.
-
toJson
String toJson()
Converts the chat completion request to a JSON string.- Returns:
- The JSON string.
-
execute
String execute()
Executes the chat completion request and returns the response.- Returns:
- The chat completion response.
-
-