# GPTClass
**GPTClass** is a Python class that uses OpenAI's GPT to generated the code that does what you need with minimal information.
[![version](https://img.shields.io/pypi/v/gptclass?logo=pypi&logoColor=white)](https://pypi.org/project/gptclass/)
[![codecov](https://codecov.io/gh/jaume-ferrarons/GPTClass/branch/main/graph/badge.svg?token=IDN30YYHQ8)](https://codecov.io/gh/jaume-ferrarons/GPTClass)
### 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
```bash
pip install gptclass
```
## Usage
Do whatever you need:
```python
>>> 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:
```python
>>> 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](https://github.com/odashi/davinci-functions/tree/main)
## Warning
- The code produced may not be reliable and should be validated before executing it.
Raw data
{
"_id": null,
"home_page": "https://github.com/jaume-ferrarons/GPTClass",
"name": "gptclass",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8.1,<4.0",
"maintainer_email": "",
"keywords": "gpt,openai,code-generations",
"author": "Jaume Ferrarons",
"author_email": "jaume.ferrarons@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/b6/10/d1f92c0a0434148e1a3090a457d87c82656f5ad103a2317b8a9c85498147/gptclass-0.4.0.tar.gz",
"platform": null,
"description": "# GPTClass\n**GPTClass** is a Python class that uses OpenAI's GPT to generated the code that does what you need with minimal information.\n\n[![version](https://img.shields.io/pypi/v/gptclass?logo=pypi&logoColor=white)](https://pypi.org/project/gptclass/)\n[![codecov](https://codecov.io/gh/jaume-ferrarons/GPTClass/branch/main/graph/badge.svg?token=IDN30YYHQ8)](https://codecov.io/gh/jaume-ferrarons/GPTClass)\n\n### How it works?\nIt uses the method's name and information about the parameters used to build the source code using ChatGPT and then executes it locally.\n\n## Installation\n```bash\npip install gptclass\n```\n\n## Usage\nDo whatever you need: \n```python\n>>> import openai\n>>> openai.api_key = \"...\"\n\n>>> from gptclass import GPTClass\n>>> gpt = GPTClass()\n\n>>> gpt.add(1, 2)\n3\n>>> gpt.n_unique([1, 2, 5, 5])\n3\n>>> gpt.prime_numbers_below(10)\n[2, 3, 5, 7]\n>>> gpt.count_vowels(\"Today I had a nice coffee!\")\n10\n>>> gpt.from_celsius_to_fahrenheit(25)\n77.0\n>>> gpt.random_plate_number(seed=123)\nBIC6410\n```\n\n## Show me the generated code\nAdding explain before invoking the method will print the code:\n\n```python\n>>> gpt.explain.from_celsius_to_fahrenheit(25)\ndef from_celsius_to_fahrenheit(celsius):\n return (celsius * 1.8) + 32\n\n>>> gpt.explain.factorial(15)\ndef factorial(n):\n if n == 0:\n return 1\n else:\n return n * factorial(n-1)\n```\n\n## Notes\n- Inspired on: [davinci-functions](https://github.com/odashi/davinci-functions/tree/main)\n\n## Warning\n- The code produced may not be reliable and should be validated before executing it.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python class that does what you need",
"version": "0.4.0",
"split_keywords": [
"gpt",
"openai",
"code-generations"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "bb8643af5948166862fa415d8fab45840c035c9cb848dcf0982084e484e5e631",
"md5": "298a81a2dddaa1813d73f0c8fe2a3ffb",
"sha256": "6af07f648f75260673adc7ce5d697b66b2bd86aed4895f1a975532e948638312"
},
"downloads": -1,
"filename": "gptclass-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "298a81a2dddaa1813d73f0c8fe2a3ffb",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1,<4.0",
"size": 4216,
"upload_time": "2023-03-12T13:59:28",
"upload_time_iso_8601": "2023-03-12T13:59:28.066738Z",
"url": "https://files.pythonhosted.org/packages/bb/86/43af5948166862fa415d8fab45840c035c9cb848dcf0982084e484e5e631/gptclass-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b610d1f92c0a0434148e1a3090a457d87c82656f5ad103a2317b8a9c85498147",
"md5": "653f27ff30d3aa00c5d5289ace4c4aaa",
"sha256": "792c0ba77e272759038e143ce432c726fc226ec810007447c5b6c52b90fbaa98"
},
"downloads": -1,
"filename": "gptclass-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "653f27ff30d3aa00c5d5289ace4c4aaa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1,<4.0",
"size": 3443,
"upload_time": "2023-03-12T13:59:29",
"upload_time_iso_8601": "2023-03-12T13:59:29.578964Z",
"url": "https://files.pythonhosted.org/packages/b6/10/d1f92c0a0434148e1a3090a457d87c82656f5ad103a2317b8a9c85498147/gptclass-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-12 13:59:29",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "jaume-ferrarons",
"github_project": "GPTClass",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "gptclass"
}