PromptAnalyzerBase

Base Classes · AiDotNet.PromptEngineering.Analysis

Provides a base implementation for prompt analyzers with common functionality.

Implements: IPromptAnalyzer

Known derived types: ComplexityAnalyzer, PatternDetectionAnalyzer, TokenCountAnalyzer

For Beginners

This is the foundation that all prompt analyzers build upon.

Think of it like a template for examining prompts:

  • It handles common tasks (counting words, finding variables)
  • Specific analyzers fill in details like token counting and pattern detection
  • This ensures all analyzers work consistently

How It Works

This abstract class implements the IPromptAnalyzer interface and provides common functionality for prompt analysis. It handles validation, token counting, and delegates to derived classes for specific analysis logic.

Properties

Property Summary
string Name { get; } Gets the name of this analyzer implementation.

Methods

Method Summary
IEnumerable<PromptIssue> ValidatePrompt(string prompt, ValidationOptions options) Validates a prompt for potential issues.
PromptMetrics Analyze(string prompt) Analyzes a prompt and returns detailed metrics.
Task<PromptMetrics> AnalyzeAsync(string prompt, CancellationToken cancellationToken) Analyzes a prompt asynchronously.