Class PromptTemplate

java.lang.Object
org.episteme.natural.computing.ai.generative.prompt.PromptTemplate

public class PromptTemplate extends Object
A handy templating engine for constructing LLM prompts.

Supports variable interpolation using {{variable}} syntax.

Since:
2.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Constructor Details

    • PromptTemplate

      public PromptTemplate(String template)
  • Method Details

    • render

      public String render(Map<String,Object> variables)
      Renders the template with the provided variables.
      Parameters:
      variables - map of variable names to values.
      Returns:
      the rendered prompt string.
    • fromString

      public static PromptTemplate fromString(String templateStr)
      Example usage helper.