Package dev.langchain4j.model.input
Class Prompt
java.lang.Object
dev.langchain4j.model.input.Prompt
Represents a prompt (an input text sent to the LLM).
A prompt usually contains instructions, contextual information, end-user input, etc.
A Prompt is typically created by applying one or multiple values to a PromptTemplate.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
static Prompt
Create a new Prompt.int
hashCode()
text()
The text of the prompt.Convert this prompt to an AiMessage.toString()
Convert this prompt to a SystemMessage.Convert this prompt to a UserMessage.toUserMessage
(String userName) Convert this prompt to a UserMessage with specified userName.
-
Constructor Details
-
Prompt
Create a new Prompt.- Parameters:
text
- the text of the prompt.
-
-
Method Details
-
text
The text of the prompt.- Returns:
- the text of the prompt.
-
toSystemMessage
Convert this prompt to a SystemMessage.- Returns:
- the SystemMessage.
-
toUserMessage
Convert this prompt to a UserMessage with specified userName.- Returns:
- the UserMessage.
-
toUserMessage
Convert this prompt to a UserMessage.- Returns:
- the UserMessage.
-
toAiMessage
Convert this prompt to an AiMessage.- Returns:
- the AiMessage.
-
equals
-
hashCode
public int hashCode() -
toString
-
from
Create a new Prompt.- Parameters:
text
- the text of the prompt.- Returns:
- the new Prompt.
-