Automatically implements functions using ChatGPT.
Project description
auto_impl
Automatically implements functions using ChatGPT.
Install
pip install auto_impl --upgrade
Usage
Get ChatGPT API key and set it to your environment variable OPENAI_API_KEY
before run.
@auto
Syntax:
@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
- Idea originated from retrage/gpt-macro, which is under the MIT license.
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.1.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file auto_impl-0.1.1.tar.gz
.
File metadata
- Download URL: auto_impl-0.1.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e5774fc87bd632b5c280bd4cc56b7900b2fc420e33c6de3953b4ae7f5d3fb45 |
|
MD5 | 537531dc1213ce8ed10987b815993151 |
|
BLAKE2b-256 | 39aafd456ff3fb9f0f8fcd3ab3841422e8a2af7b3ec591bb5720750d73bd840b |
File details
Details for the file auto_impl-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: auto_impl-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61e067d1b9d811b3582215aab0e8688011ad5013d2ed559d9425398dbb154e7f |
|
MD5 | 100dea09129822769bc465d69c4ebc57 |
|
BLAKE2b-256 | 209494ea992a67c10f3ef89e380c8cb8b37c44a29b2462ae7c6208e94c4c096c |