lazy-gpt


Namelazy-gpt JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryA simple package to make GPT API usage easier
upload_time2023-05-09 21:44:16
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) 2023 Samuel Reeder Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords gpt openai chatbot nlp ai natural language processing gpt-3 gpt-4
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lazy-gpt

A Python package that simplifies the usage of the GPT API by providing a convenient class to manage context-driven instances of GPT models. With lazy-gpt, you can create instances, change models, and obtain context-driven responses from the GPT model.

## Usage

First, make sure you have run the `config` function to set up your API key and optionally the organization. If you don't have environment variables set up for the key, you need to run this function.

```python
lazygpt.config("your_api_key", "your_organization")
```

Next, create a GPT instance using the LazyGPT class. You can choose the GPT model by accessing the Model enum:

```python
gpt_instance = lazygpt.EasyGPT(model=lazygpt.Model.GPT4)
```

Now you can obtain context-driven responses using the response function:

```python
response = gpt_instance.response("What is the capital of France?")
```

Set the `just_reply` parameter to obtain the raw JSON instead of the message. You can also pass additional kwargs to the response function, which will be forwarded to the GPT API:

```python
json_response = gpt_instance.response("What is the capital of France?", just_reply=False, max_tokens=50, temperature=0.8)
```

To change the GPT model, use the change_model function:

```python
gpt_instance.change_model(lazygpt.Model.GPT3_5)
```

To access the message history, use the get_messages function:

```python
message_history = gpt_instance.get_messages()
print(message_history)
```


## License

This project is released under the MIT License.






            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "lazy-gpt",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "gpt, openai, chatbot, nlp, ai, natural language processing, gpt-3, gpt-4",
    "author": "",
    "author_email": "Samuel Reeder <samuel.reeder@mail.utoronto.ca>",
    "download_url": "https://files.pythonhosted.org/packages/f0/4b/947d8aa4fc3d7d48cbac2225d2ff7b5fe98bb1eed86c71f6b7b06bf981a8/lazy-gpt-0.0.2.tar.gz",
    "platform": null,
    "description": "# lazy-gpt\r\n\r\nA Python package that simplifies the usage of the GPT API by providing a convenient class to manage context-driven instances of GPT models. With lazy-gpt, you can create instances, change models, and obtain context-driven responses from the GPT model.\r\n\r\n## Usage\r\n\r\nFirst, make sure you have run the `config` function to set up your API key and optionally the organization. If you don't have environment variables set up for the key, you need to run this function.\r\n\r\n```python\r\nlazygpt.config(\"your_api_key\", \"your_organization\")\r\n```\r\n\r\nNext, create a GPT instance using the LazyGPT class. You can choose the GPT model by accessing the Model enum:\r\n\r\n```python\r\ngpt_instance = lazygpt.EasyGPT(model=lazygpt.Model.GPT4)\r\n```\r\n\r\nNow you can obtain context-driven responses using the response function:\r\n\r\n```python\r\nresponse = gpt_instance.response(\"What is the capital of France?\")\r\n```\r\n\r\nSet the `just_reply` parameter to obtain the raw JSON instead of the message. You can also pass additional kwargs to the response function, which will be forwarded to the GPT API:\r\n\r\n```python\r\njson_response = gpt_instance.response(\"What is the capital of France?\", just_reply=False, max_tokens=50, temperature=0.8)\r\n```\r\n\r\nTo change the GPT model, use the change_model function:\r\n\r\n```python\r\ngpt_instance.change_model(lazygpt.Model.GPT3_5)\r\n```\r\n\r\nTo access the message history, use the get_messages function:\r\n\r\n```python\r\nmessage_history = gpt_instance.get_messages()\r\nprint(message_history)\r\n```\r\n\r\n\r\n## License\r\n\r\nThis project is released under the MIT License.\r\n\r\n\r\n\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Samuel Reeder  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A simple package to make GPT API usage easier",
    "version": "0.0.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/SamuelReeder/easy-gpt/issues",
        "Homepage": "https://github.com/SamuelReeder/easy-gpt"
    },
    "split_keywords": [
        "gpt",
        " openai",
        " chatbot",
        " nlp",
        " ai",
        " natural language processing",
        " gpt-3",
        " gpt-4"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2a0d12c4f140c5d47c2f12468759df2f02f74304b21f8d2a8132960dbab63e59",
                "md5": "77c5281f7e6be59ce5d979de3d96c196",
                "sha256": "98771dfc40fafe3238a7342d96476148487c3313c47a6e283be680ed3abc8e56"
            },
            "downloads": -1,
            "filename": "lazy_gpt-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "77c5281f7e6be59ce5d979de3d96c196",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 3380,
            "upload_time": "2023-05-09T21:44:13",
            "upload_time_iso_8601": "2023-05-09T21:44:13.554071Z",
            "url": "https://files.pythonhosted.org/packages/2a/0d/12c4f140c5d47c2f12468759df2f02f74304b21f8d2a8132960dbab63e59/lazy_gpt-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f04b947d8aa4fc3d7d48cbac2225d2ff7b5fe98bb1eed86c71f6b7b06bf981a8",
                "md5": "5e814f25c0a096ca1a2428a1a170889a",
                "sha256": "469f7333f8e7249b80869a6251ec1dfc1e88f60c3f21c9f21a0af4ec566ba1ce"
            },
            "downloads": -1,
            "filename": "lazy-gpt-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5e814f25c0a096ca1a2428a1a170889a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 2811,
            "upload_time": "2023-05-09T21:44:16",
            "upload_time_iso_8601": "2023-05-09T21:44:16.416016Z",
            "url": "https://files.pythonhosted.org/packages/f0/4b/947d8aa4fc3d7d48cbac2225d2ff7b5fe98bb1eed86c71f6b7b06bf981a8/lazy-gpt-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-09 21:44:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SamuelReeder",
    "github_project": "easy-gpt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "lazy-gpt"
}
        
Elapsed time: 0.45365s