CompressionResult
Models & Types · AiDotNet.PromptEngineering.Compression
Contains the result of a prompt compression operation including metrics.
For Beginners
This is the result of compressing a prompt, with before/after stats.
When you compress a prompt, you want to know:
- What’s the compressed text?
- How much shorter is it?
- How much money did we save?
Example:
How It Works
This class encapsulates the compressed prompt along with detailed metrics about the compression operation, including token counts, compression ratio, and estimated cost savings.
Constructors
| Constructor | Summary |
|---|---|
CompressionResult() |
Properties
| Property | Summary |
|---|---|
DateTime CompressedAt { get; set; } |
Gets or sets the timestamp when compression was performed. |
IReadOnlyList<string> Warnings { get; set; } |
Gets or sets any warnings generated during compression. |
bool IsSuccessful { get; } |
Gets whether the compression was successful (reduced token count). |
decimal EstimatedCostSavings { get; set; } |
Gets or sets the estimated cost savings in USD. |
double CompressionRatio { get; } |
Gets the compression ratio (0.0 to 1.0, where higher means more compression). |
int CompressedTokenCount { get; set; } |
Gets or sets the token count of the compressed prompt. |
int OriginalTokenCount { get; set; } |
Gets or sets the token count of the original prompt. |
int TokensSaved { get; } |
Gets the number of tokens saved by compression. |
string CompressedPrompt { get; set; } |
Gets or sets the compressed prompt. |
string CompressionMethod { get; set; } |
Gets or sets the compression method used. |
string OriginalPrompt { get; set; } |
Gets or sets the original prompt before compression. |