Class LocalPromptTemplate

java.lang.Object
com.sap.ai.sdk.orchestration.PromptTemplate
com.sap.ai.sdk.orchestration.LocalPromptTemplate

public final class LocalPromptTemplate extends PromptTemplate
A template to use in OrchestrationModuleConfig.
Since:
1.4.0
  • Method Details

    • withMessages

      @Nonnull public LocalPromptTemplate withMessages(@Nonnull Message message, @Nonnull Message... moreMessages)
      Create a new template with the given messages.
      Parameters:
      message - the first message to use in the template.
      moreMessages - additional messages to use in the template.
      Returns:
      the updated template.
    • toLowLevel

      @Nonnull protected PromptTemplatingModuleConfigPrompt toLowLevel()
      Create a low-level representation of the template.
      Specified by:
      toLowLevel in class PromptTemplate
      Returns:
      the low-level representation of the template.
    • withJsonSchemaResponse

      @Nonnull public LocalPromptTemplate withJsonSchemaResponse(@Nonnull ResponseJsonSchema schema)
      Set the response format to the given JSON schema.
      Parameters:
      schema - the JSON schema to use.
      Returns:
      the updated template.
    • withJsonResponse

      @Nonnull public LocalPromptTemplate withJsonResponse()
      Set the response format to JSON object.
      Returns:
      the updated template.
    • getChatMessages

      @Nullable public List<ChatMessage> getChatMessages()
    • getMessageHistory

      @Nonnull public List<Message> getMessageHistory()
      Description copied from class: PromptTemplate
      Get the message history to prepend to the conversation for this template.
      Specified by:
      getMessageHistory in class PromptTemplate
      Returns:
      the message history for this template.
    • getInputParameters

      @Nonnull public Map<String,String> getInputParameters()
      Description copied from class: PromptTemplate
      Get the placeholder values supplied for this template.
      Specified by:
      getInputParameters in class PromptTemplate
      Returns:
      the placeholder values supplied for this template.
    • getDefaults

      @Nullable public Map<String,String> getDefaults()
    • getResponseFormat

      @Nullable public TemplateResponseFormat getResponseFormat()
    • getTools

      @Nullable public List<ChatCompletionTool> getTools()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class PromptTemplate
    • canEqual

      protected boolean canEqual(Object other)
      Overrides:
      canEqual in class PromptTemplate
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class PromptTemplate
    • withMessageHistory

      public LocalPromptTemplate withMessageHistory(@Nonnull List<Message> messageHistory)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withInputParameters

      public LocalPromptTemplate withInputParameters(@Nonnull Map<String,String> inputParameters)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withDefaults

      public LocalPromptTemplate withDefaults(@Nullable Map<String,String> defaults)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).
    • withTools

      public LocalPromptTemplate withTools(@Nullable List<ChatCompletionTool> tools)
      Returns:
      a clone of this object, except with this updated property (returns this if an identical value is passed).