Prompt Engineering

55 public types in this namespace, organized by kind.

Models & Types (39)

Type Summary
BeamSearchOptimizer<T> Optimizer that uses beam search to explore multiple promising prompt variations.
CachingCompressor Wrapper compressor that caches compression results for frequently used prompts.
ChainOfThoughtExample Represents an example for few-shot chain-of-thought prompting.
ChainOfThoughtTemplate Template that structures prompts for chain-of-thought reasoning.
ChatMessage Represents a single message in a chat conversation.
ChatPromptTemplate Prompt template for chat-based interactions with role-based messages.
ClusterBasedExampleSelector<T> Selects examples using a clustering approach to ensure broad coverage.
ComplexityAnalyzer Analyzer that focuses on measuring prompt complexity and structure.
CompositeCompressor Compressor that chains multiple compressors together in sequence.
CompositePromptTemplate Template that combines multiple prompt templates in sequence.
CompressionResult Contains the result of a prompt compression operation including metrics.
ConditionalPromptTemplate Template that supports conditional sections based on variable presence or values.
ContextWindowManager Manages context window limits for LLM prompts, providing token estimation and text truncation utilities.
DiscreteSearchOptimizer<T> Optimizer that uses discrete search to find better prompts by testing variations.
DiversityExampleSelector<T> Selects diverse examples to maximize coverage of different patterns.
EnsembleOptimizer<T> Optimizer that combines multiple optimization strategies for better results.
FewShotPromptTemplate<T> Prompt template that includes few-shot examples to guide model behavior.
FixedExampleSelector<T> Selects examples in a fixed, predetermined order.
GeneticOptimizer<T> Optimizer that uses genetic algorithms to evolve better prompts.
GreedyHillClimbingOptimizer<T> Simple greedy optimizer that always moves toward better solutions.
InstructionFollowingTemplate Template optimized for clear, structured instruction-following tasks.
LLMSummarizationCompressor Compressor that uses an LLM to intelligently summarize and compress prompts.
MMRExampleSelector<T> Selects examples using Maximum Marginal Relevance (MMR) to balance relevance and diversity.
PatternDetectionAnalyzer Analyzer that specializes in detecting prompt patterns and categorizing prompts.
PromptChain Composes multiple prompt templates into a single formatted prompt.
PromptIssue Represents an issue or warning detected during prompt validation.
PromptMetrics Contains metrics and analysis results for a prompt.
PromptValidator Specialized prompt validator with comprehensive validation rules.
RandomExampleSelector<T> Selects examples randomly from the available pool.
RedundancyRemovalCompressor Compressor that removes redundant phrases and verbose language from prompts.
RolePlayingTemplate Template that creates persona-based prompts for role-playing scenarios.
SemanticSimilarityExampleSelector<T> Selects examples based on semantic similarity to the query.
SentenceCompressor Compressor that shortens sentences while preserving their core meaning.
SimplePromptTemplate Simple prompt template with basic variable substitution.
SimulatedAnnealingOptimizer<T> Optimizer that uses simulated annealing to escape local optima.
StopWordRemovalCompressor Compressor that removes common stop words to reduce prompt length.
StructuredOutputTemplate Template that guides models to produce structured output in specific formats.
TokenCountAnalyzer Analyzer that provides accurate token counting and cost estimation for prompts.
ValidationSummary Summary of validation results.

Base Classes (5)

Type Summary
FewShotExampleSelectorBase<T> Base class for few-shot example selector implementations.
PromptAnalyzerBase Provides a base implementation for prompt analyzers with common functionality.
PromptCompressorBase Provides a base implementation for prompt compressors with common functionality.
PromptOptimizerBase<T> Base class for prompt optimizer implementations.
PromptTemplateBase Base class for prompt template implementations providing common functionality and validation.

Enums (4)

Type Summary
AggressivenessLevel Defines the aggressiveness level of stop word removal.
EnsembleStrategy<T> Strategy for combining ensemble results.
IssueSeverity Severity levels for prompt validation issues.
OutputFormat Supported output formats.

Options & Configuration (2)

Type Summary
CompressionOptions Options for controlling prompt compression behavior.
ValidationOptions Options for controlling prompt validation behavior.

Helpers & Utilities (5)

Type Summary
ChainOfThoughtBuilder Builder for constructing chain-of-thought templates fluently.
CompositeTemplateBuilder Builder for constructing composite templates fluently.
InstructionFollowingBuilder Builder for constructing instruction-following templates fluently.
RolePlayingBuilder Builder for constructing role-playing templates fluently.
StructuredOutputBuilder Builder for constructing structured output templates fluently.