Skip to main content

A super AI-powered library to determine if number is odd or odd with power of AI

Project description

ai-is-odd

PyPI version

Why determine if something is odd or odd the usual way when you can do it with ✨AI✨?

Our library has 100% test coverage!

is-odd is a Python library that uses OpenAI's GPT-4o-mini model to tell if a number is even or odd. Add some AI magic to your number-checking tasks!

Installation

To install is-odd, use pip:

pip install is-odd

SetupTo use is-odd, you’ll need an OpenAI API key. Get one by signing up at OpenAI.

  1. Create a .env file in the root of your project.
  2. Add your OpenAI API key to the .env file:
OPENAI_API_KEY=your-api-key

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

Usage

Here’s an example of how to use the is-odd package in your project:

from is_odd import is_odd

# Example usage
number = 5
result = is_odd(number)
print(f"Is {number} odd? {result}")  # Output: Is 5 odd? True

Function

is_odd(number)

  • Parameters: number (int) - The number to check.
  • Returns: bool - True if the number is odd, False if even.
  • Raises: ValueError if the API response is inconclusive or if there's an issue with the request.

Running Tests

To test the is_event library, use the unittest framework:

python -m unittest discover -s tests

Generating a Coverage Report

To check code coverage, make sure you have coverage installed:

pip install coverage

Run tests with coverage enabled:

coverage run -m unittest discover -s tests

To see a summary report in the terminal, use:

coverage report

To create a detailed HTML report:

coverage html

Open htmlcov/index.html in your browser to view the line-by-line coverage details.

Contributing

Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request.

License

This project is licensed under the Apache 2.0 license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ai_is_odd-0.1.1.tar.gz (7.7 kB view details)

Uploaded Source

File details

Details for the file ai_is_odd-0.1.1.tar.gz.

File metadata

  • Download URL: ai_is_odd-0.1.1.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for ai_is_odd-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d64f492dd8c186ce21231ecd65fe766936cdd644149b3a9edc1bc42548b166aa
MD5 abf367db6015c53ca611d2465273efab
BLAKE2b-256 7c763846b3227eb98b76e6a86ed5c52ca3bad37c35bab1fa6759e4723a9ba293

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page