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
- 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.3.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file auto_impl-0.1.3.tar.gz
.
File metadata
- Download URL: auto_impl-0.1.3.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 | 6110f8d572e15bb7a27ad39d496004d1b5a58b7f91439b00ecd82368bdc5710d |
|
MD5 | 8d2358b401efcf181e3920e38e78aa65 |
|
BLAKE2b-256 | 962f9659912064c875640264f9b32cd383166899956cd1f9bdcf261d414aaebe |
File details
Details for the file auto_impl-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: auto_impl-0.1.3-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 | 43ce933679a08b78b71b5919108802c817ece678335a5623e6b77ffe81938783 |
|
MD5 | dc8cc0049c6876161064f626364699d4 |
|
BLAKE2b-256 | 6aa84a99b62f650cf779c3dc1683ef43c76362aa276838cee907118ea9b6b013 |