Package dev.langchain4j.model.input
Class Prompt
-
- All Implemented Interfaces:
public class PromptRepresents 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.
-
-
Method Summary
Modifier and Type Method Description Stringtext()The text of the prompt. SystemMessagetoSystemMessage()Convert this prompt to a SystemMessage. UserMessagetoUserMessage(String userName)Convert this prompt to a UserMessage with specified userName. UserMessagetoUserMessage()Convert this prompt to a UserMessage. AiMessagetoAiMessage()Convert this prompt to an AiMessage. booleanequals(Object o)inthashCode()StringtoString()static Promptfrom(String text)Create a new Prompt. -
-
Constructor Detail
-
Prompt
Prompt(String text)
Create a new Prompt.- Parameters:
text- the text of the prompt.
-
-
Method Detail
-
toSystemMessage
SystemMessage toSystemMessage()
Convert this prompt to a SystemMessage.
- Returns:
the SystemMessage.
-
toUserMessage
UserMessage toUserMessage(String userName)
Convert this prompt to a UserMessage with specified userName.
- Returns:
the UserMessage.
-
toUserMessage
UserMessage toUserMessage()
Convert this prompt to a UserMessage.
- Returns:
the UserMessage.
-
toAiMessage
AiMessage toAiMessage()
Convert this prompt to an AiMessage.
- Returns:
the AiMessage.
-
hashCode
int hashCode()
-
-
-
-