Class EnhancedPrompt

java.lang.Object
com.tnsai.prompt.strategy.EnhancedPrompt

public class EnhancedPrompt extends Object
Result of enhancing a prompt with strategies.

Contains the system prompt (with strategy instructions) and the original user message, ready for use with an LLM client.

Usage


 EnhancedPrompt prompt = enhancer.enhance("What is the capital of France?");

 // Use with LLM client
 ChatResponse response = client.chat(
     prompt.getUserMessage(),
     Optional.of(prompt.getSystemPrompt()),
     Optional.empty(),
     Optional.empty()
 );

 // For multi-pass strategies
 if (prompt.requiresMultiPass()) {
     // Handle verification or refinement passes
 }
 
  • Constructor Details

  • Method Details

    • getSystemPrompt

      public String getSystemPrompt()
      Gets the enhanced system prompt with strategy instructions.
    • getUserMessage

      public String getUserMessage()
      Gets the original user message.
    • getSystemPromptOptional

      public Optional<String> getSystemPromptOptional()
      Gets the system prompt as an Optional for convenience with LLMClient.
    • getStrategies

      public List<PromptStrategy> getStrategies()
      Gets the list of applied strategies.
    • getOutputFormat

      public Optional<PromptEnhancer.OutputFormat> getOutputFormat()
      Gets the output format if specified.
    • requiresMultiPass

      public boolean requiresMultiPass()
      Returns true if any strategy requires multiple LLM calls.
    • requiresPostProcessing

      public boolean requiresPostProcessing()
      Returns true if any strategy requires post-processing.
    • expectsConfidenceScore

      public boolean expectsConfidenceScore()
      Returns true if confidence scoring is expected in the response.
    • expectsStructuredThinking

      public boolean expectsStructuredThinking()
      Returns true if structured thinking sections are expected.
    • expectsVerification

      public boolean expectsVerification()
      Returns true if verification questions are expected.
    • getCombinedPrompt

      public String getCombinedPrompt()
      Combines system prompt and user message into a single prompt. Useful for models that don't support separate system prompts.
    • getEstimatedOverhead

      public int getEstimatedOverhead()
      Gets the estimated additional token overhead from enhancement. Useful for cost estimation.
    • toString

      public String toString()
      Overrides:
      toString in class Object