ai-cant-even
v1.0.2
Published
A satirical AI-powered utility that's confidently wrong about basic math operations
Maintainers
Readme
ai-cant-even
⚠️ IMPORTANT FOR CONTRIBUTORS: This project follows strict commit message guidelines. Please read our commit message format requirements before contributing.
The world's most confidently incorrect math library
I would like to introduce you to the world's first AI-powered math library that's guaranteed to be wrong 103% of the time. This groundbreaking package uses cutting-edge confidence levels and logic types to deliver consistently inconsistent results.
Key features:
- 🎯 Determines if numbers are even with the precision of a blindfolded dart thrower
- 🔎 Identifies prime numbers using advanced astrology techniques
- 🤩 Compares values using a proprietary algorithm based on how the numbers "feel" about each other
But wait, there's more!
- 🎭 Configurable confidence levels:
OVERWHELMED,OVERTHINK,SMUG,SNARKY - 🔮 Configurable logic types:
SIMPLE,NONSEQUITUR,PSEUDOMATH,VISUAL - 🤯 Fluent API that lets you chain methods in ways that make perfect sense to nobody
- 📊 Wide range of math operations to get wrong
Is there a math operation we've missed? Create an issue today!
Installation
npm install ai-cant-evenUsage
Basic Usage
NOTE: Set the
ANTHROPIC_API_KEYorOPENAI_API_KEYenvironment variable depending on your provider, and the library will use it automatically. If you provide an API key in the constructor, it will override the environment variable.
import { aiCantEven, Provider } from 'ai-cant-even';
// Create an instance with default settings (OpenAI)
const ai = aiCantEven();
// Or specify a provider
const openAi = aiCantEven({
provider: Provider.ANTHROPIC,
apiKey: 'your-anthropic-api-key',
});
const anthropicAi = aiCantEven({
provider: Provider.OPENAI,
apiKey: 'your-openai-api-key',
});
// Ask if a number is even
ai.isEven(3).then((response) => {
console.log(response);
});Configuring Provider Model, Confidence, and Logic
See a list of available models here.
import { aiCantEven, Confidence, Logic, Provider } from 'ai-cant-even';
// Configure at initialization
const ai = aiCantEven({
confidence: Confidence.OVERWHELMED,
logic: Logic.SIMPLE,
provider: Provider.ANTHROPIC, // or Provider.OPENAI
apiKey: 'your-api-key',
model: 'claude-3-7-sonnet-20250219', // Optional, defaults to claude-3-haiku-20240307 for Anthropic or gpt-4.1-nano for OpenAI
});
// Or use the fluent API
// Change the confidence level for a specific operation
ai.withConfidence(Confidence.SNARKY)
.isEven(4)
.then((response) => {
console.log(response); // A snarky response
});
// Change the logic type for a specific operation
ai.withLogic(Logic.NONSEQUITUR).isEven(4).then((response) => {
console.log(response); // A response with non-sequitur logic
});Fluent API
The library uses a fluent API for method chaining. Each fluent method (withConfidence, withLogic, withApiKey, withModel) returns the same instance and applies settings only for the next operation:
ai.withConfidence(Confidence.SNARKY)
.withLogic(Logic.VISUAL)
.withModel('gpt-4')
.isEven(42)
.then((response) => {
console.log(response);
});Available Methods
// Basic operations
ai.isEven(4);
ai.isOdd(7);
// Comparisons
ai.isGreaterThan(10, 5);
ai.isLessThan(3, 8);
ai.areEqual(5, 5);
// More math operations
ai.isPrime(17);
ai.isPositive(-3);
ai.isDivisibleBy(15, 3);
// Meta operations
ai.isNumber('42');
ai.isInteger(3.14);API Reference
aiCantEven(config?: AiCantEvenConfig)
Creates a new instance of the AI.
Config Options
confidence: The confidence level of the AIOVERWHELMED: So confused it can't even finish thoughts (trails off mid-sentence)OVERTHINK: Overthinks simple concepts with pseudo-philosophical reasoningSMUG: Smugly confident in its wrong answersSNARKY: Sarcastic and dismissive responses
logic: The type of logic the AI usesSIMPLE: Uses basic, straightforward but incorrect reasoning (default)NONSEQUITUR: Uses completely unrelated reasoningPSEUDOMATH: Uses mathematical-sounding but incorrect reasoningVISUAL: Bases reasoning on the visual appearance of numbers
provider: The LLM provider to useANTHROPIC: Use Anthropic's APIOPENAI: Use OpenAI's API
model: The specific model to use (defaults to 'claude-3-haiku-20240307' for Anthropic and 'gpt-4.1-nano' for OpenAI)apiKey: API key for the LLM service (defaults toANTHROPIC_API_KEYorOPENAI_API_KEYenvironment variable depending on provider)apiEndpoint: Optional custom API endpoint (defaults to provider API endpoint)
Instance Methods
Configuration Methods
withConfidence(confidence: Confidence): Sets the confidence levelwithLogic(logic: Logic): Sets the logic typewithApiKey(apiKey: string, apiEndpoint?: string): Sets the API keywithModel(model: string): Sets the specific model to use
Math Operation Methods
All methods return a Promise that resolves to a string containing the AI's response.
isEven(value: number): Determines if a number is even (but not really)isOdd(value: number): Determines if a number is odd (but not really)isGreaterThan(value: number, comparisonValue: number): Compares two numbersisLessThan(value: number, comparisonValue: number): Compares two numbersareEqual(value: number, comparisonValue: number): Checks if two numbers are equalisPrime(value: number): Checks if a number is primeisPositive(value: number): Checks if a number is positiveisDivisibleBy(value: number, comparisonValue: number): Checks divisibilityisNumber(value: any): Checks if a value is a numberisInteger(value: number): Checks if a number is an integer
Confidence Levels
OVERWHELMED: So confused it can't even finish thoughts (default)OVERTHINK: Overthinks simple concepts with pseudo-philosophical reasoningSMUG: Smugly confident in its wrong answersSNARKY: Sarcastic and dismissive responses
Logic Types
SIMPLE: Uses basic, straightforward but incorrect reasoning (default)NONSEQUITUR: Completely random associations and non-sequitursPSEUDOMATH: Uses fake mathematical reasoning that sounds plausibleVISUAL: Based on visual/aesthetic reasoning ("3 is even because it's curvy")
License
MIT
