Skip to main content

Automatically implements functions using ChatGPT.

Project description

auto_impl

Automatically implements functions using the llm toolkit.

Install

pip install auto_impl --upgrade

Usage

First install llm. Follow the instructions from the llm site to set it up. For example, use llm keys set openai to set up a ChatGPT API key and llm "Ten fun names for a pet pelican" to test it.

@auto

Usage:

@auto($prompt)
$function

where $prompt is a prompt string literal, and $function is the target function.

Example:

from auto_impl import auto


@auto("Return fizz if the number is divisible by 3, buzz if the number is divisible by 5, and fizzbuzz if the number is divisible by both 3 and 5.")
def fizzbuzz(n: int) -> str:
    pass


def test_fizzbuzz():
    assert fizzbuzz(3) == "fizz"
    assert fizzbuzz(5) == "buzz"
    assert fizzbuzz(15) == "fizzbuzz"
    assert fizzbuzz(1) == "1"


test_fizzbuzz() # Doesn't raise exceptions

Acknowledgement

License

auto_impl is released under the MIT 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

auto_impl-0.1.3.tar.gz (3.9 kB view hashes)

Uploaded Source

Built Distribution

auto_impl-0.1.3-py3-none-any.whl (4.6 kB view hashes)

Uploaded Python 3

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