A Python class that does what you need
Project description
GPTClass
GPTClass is a Python class that uses OpenAI's GPT to generated the code that does what you need with minimal information.
How it works?
It uses the method's name and information about the parameters used to build the source code using ChatGPT and then executes it locally.
Installation
pip install gptclass
Usage
Do whatever you need:
>>> import openai
>>> openai.api_key = "..."
>>> from gptclass import GPTClass
>>> gpt = GPTClass()
>>> gpt.add(1, 2)
3
>>> gpt.n_unique([1, 2, 5, 5])
3
>>> gpt.prime_numbers_below(10)
[2, 3, 5, 7]
>>> gpt.count_vowels("Today I had a nice coffee!")
10
>>> gpt.from_celsius_to_fahrenheit(25)
77.0
>>> gpt.random_plate_number(seed=123)
BIC6410
Show me the generated code
Adding explain before invoking the method will print the code:
>>> gpt.explain.from_celsius_to_fahrenheit(25)
def from_celsius_to_fahrenheit(celsius):
return (celsius * 1.8) + 32
>>> gpt.explain.factorial(15)
def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n-1)
Notes
- Inspired on: davinci-functions
Warning
- The code produced may not be reliable and should be validated before executing it.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gptclass-0.4.0.tar.gz.
File metadata
- Download URL: gptclass-0.4.0.tar.gz
- Upload date:
- Size: 3.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
792c0ba77e272759038e143ce432c726fc226ec810007447c5b6c52b90fbaa98
|
|
| MD5 |
653f27ff30d3aa00c5d5289ace4c4aaa
|
|
| BLAKE2b-256 |
b610d1f92c0a0434148e1a3090a457d87c82656f5ad103a2317b8a9c85498147
|
File details
Details for the file gptclass-0.4.0-py3-none-any.whl.
File metadata
- Download URL: gptclass-0.4.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6af07f648f75260673adc7ce5d697b66b2bd86aed4895f1a975532e948638312
|
|
| MD5 |
298a81a2dddaa1813d73f0c8fe2a3ffb
|
|
| BLAKE2b-256 |
bb8643af5948166862fa415d8fab45840c035c9cb848dcf0982084e484e5e631
|