Copyright 2008 - 2025 S. Volkan Kücükbudak
NOTE! THIS IS NOT AN APP! It is a demonstration of how to implement ADI. If you use this code, please read the LICENSE file. Respect free work of developers.
The Anti-Dump Algorithm helps evaluate and filter low-quality inputs by calculating the Anti-Dump Index (ADI). This guide explains how to:
- Analyze input metrics (Noise, Effort, Context, Details, etc.).
- Compute the ADI using a weighted formula.
- Make decisions and generate recommendations for improving input quality.
This implementation can be integrated into AI tools, support systems, or any application requiring input quality assessment.
The core logic for calculating the ADI is implemented in the adi.py
file. This file includes functions to analyze input text and compute the ADI.
-
Metrics Extraction:
- Noise: Measures irrelevant content.
- Effort: Evaluates clarity, structure, and punctuation.
- Context: Assesses the presence of background information.
- Details: Measures technical depth.
- Bonus Factors: Rewards for well-formatted inputs.
- Penalty Factors: Deductions for poor practices (e.g., excessive punctuation).
-
Calculation Formula:
- Decision Rules:
- ADI > 1: Reject input, ask for revision.
- 0 ≤ ADI ≤ 1: Medium-priority input.
- ADI < 0: High-quality input, prioritize response.
This file contains the implementation of the Anti-Dump Algorithm. It includes functions to calculate noise, effort, context, details, bonus factors, and penalty factors, as well as to compute the ADI. You can use the ADI as follows:
from adi import DumpindexAnalyzer
# Initialisiere den ADI-Analyzer
analyzer = DumpindexAnalyzer()
This file demonstrates how to use the adi.py
implementation in a simple Flask application. It includes endpoints to analyze input text and return the ADI and recommendations.
View example_app.py
Source Code
- Preprocessing:
- Analyze user input to extract metrics.
- ADI Calculation:
- Use the weights and formula to compute ADI.
- Decision Making:
- ADI > 1: Reject input.
- 0 ≤ ADI ≤ 1: Medium priority.
- ADI < 0: High priority.
- Feedback Loop:
- Provide recommendations for improving input quality based on detected issues.
This example analyzes the input, calculates the ADI value, and selects the appropriate API based on the quality of the input. This ensures that lower-cost APIs are used for less valuable inputs and higher-performance APIs are used for higher-quality inputs.
# Import
from adi import DumpindexAnalyzer
# Initialisiere ADI-Analyzer
analyzer = DumpindexAnalyzer()
# API selection function based on ADI
def choose_api_based_on_adi(input_text):
result = analyzer.analyze_input(input_text)
adi_value = result['adi']
if adi_value > 1:
return "GPT-3.5"
elif 0 <= adi_value <= 1:
return "GPT-4"
else:
return "o3"
# Example input
input_text = "Pls fix my code. Urgent!!!"
# API selection based auf ADI
chosen_api = choose_api_based_on_adi(input_text)
print(f"Die gewählte API ist: {chosen_api}")
S. Volkan Kücükbudak
Stay Dump-Free! 🚀