1.0.1 • Published 10 months ago

ai-is-even v1.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 months ago

ai-is-even

Uses the power of artificial intelligence to return true if the given number is even.

This package leverages the is-odd-ai package for its operation, which in turn utilises OpenAI's API, so you will need to provide an API key.

Installation

npm install ai-is-even

Usage

You'll need to create a .env file in your project's root directory and specify your OpenAI API key.

Setup the .env file

In your project folder, create a .env file with the following content:

OPENAI_API_KEY=your-api-key

Replace your-api-key with your actual OpenAI API key.

Example

const isEvenAI = require('ai-is-even');

async function checkNumber() {
  const number = 4;
  const result = await isEvenAI(number);

  if (result) {
    console.log(`${number} is even!`);
  } else {
    console.log(`${number} is odd!`);
  }
}

checkNumber();

API

ai-is-even(i)

  • i: A number you want to check for evenness.
  • Returns: A Promise that resolves to true if the number is even, or false if it's odd.

License

This project is licensed under the Apache 2.0 License.

1.0.1

10 months ago

1.0.0

10 months ago