类 Prompt

java.lang.Object
dev.langchain4j.model.input.Prompt

public class Prompt extends Object
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.
  • 构造器详细资料

    • Prompt

      public Prompt(String text)
      Create a new Prompt.
      参数:
      text - the text of the prompt.
  • 方法详细资料

    • text

      public String text()
      The text of the prompt.
      返回:
      the text of the prompt.
    • toSystemMessage

      public SystemMessage toSystemMessage()
      Convert this prompt to a SystemMessage.
      返回:
      the SystemMessage.
    • toUserMessage

      public UserMessage toUserMessage(String userName)
      Convert this prompt to a UserMessage with specified userName.
      返回:
      the UserMessage.
    • toUserMessage

      public UserMessage toUserMessage()
      Convert this prompt to a UserMessage.
      返回:
      the UserMessage.
    • toAiMessage

      public AiMessage toAiMessage()
      Convert this prompt to an AiMessage.
      返回:
      the AiMessage.
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object
    • from

      public static Prompt from(String text)
      Create a new Prompt.
      参数:
      text - the text of the prompt.
      返回:
      the new Prompt.