nicegpt


Namenicegpt JSON
Version 0.0.7 PyPI version JSON
download
home_page
SummaryA simple package to make GPT API usage easier
upload_time2023-05-23 03:44:06
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.
            # nicegpt

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 nicegpt, 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
import nicegpt 

nicegpt.config("your_api_key", "your_organization")
```

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

```python
gpt_instance = nicegpt.GPT(model=nicegpt.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(nicegpt.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": "nicegpt",
    "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/c4/9b/6dfee6a4371e838d469800cf9a3802dbe0e14a4916fc5f694b6dc659dd28/nicegpt-0.0.7.tar.gz",
    "platform": null,
    "description": "# nicegpt\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 nicegpt, 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\nimport nicegpt \r\n\r\nnicegpt.config(\"your_api_key\", \"your_organization\")\r\n```\r\n\r\nNext, create a GPT instance using the GPT class. You can choose the GPT model by accessing the Model enum:\r\n\r\n```python\r\ngpt_instance = nicegpt.GPT(model=nicegpt.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(nicegpt.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.7",
    "project_urls": {
        "Bug Tracker": "https://github.com/SamuelReeder/nicegpt/issues",
        "Homepage": "https://github.com/SamuelReeder/nicegpt"
    },
    "split_keywords": [
        "gpt",
        " openai",
        " chatbot",
        " nlp",
        " ai",
        " natural language processing",
        " gpt-3",
        " gpt-4"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "79bded889d33e99808402b0b6ca381192efb7901ad1fe7437bb56dc434fc1a52",
                "md5": "415637226bdad494fa035da556188aa6",
                "sha256": "c1afb85e9ae63f80a9ae12f4ad4bd5b9c9177d4184297830d030b795e99423d7"
            },
            "downloads": -1,
            "filename": "nicegpt-0.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "415637226bdad494fa035da556188aa6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 5259,
            "upload_time": "2023-05-23T03:44:05",
            "upload_time_iso_8601": "2023-05-23T03:44:05.298812Z",
            "url": "https://files.pythonhosted.org/packages/79/bd/ed889d33e99808402b0b6ca381192efb7901ad1fe7437bb56dc434fc1a52/nicegpt-0.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c49b6dfee6a4371e838d469800cf9a3802dbe0e14a4916fc5f694b6dc659dd28",
                "md5": "a3b7091e8a20fdd21d985c4dc0d63bad",
                "sha256": "b3ca708af4ce3d2a0be06f96ef95d6ff17c1891bd6f62d943011daa9a143a7a0"
            },
            "downloads": -1,
            "filename": "nicegpt-0.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "a3b7091e8a20fdd21d985c4dc0d63bad",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4414,
            "upload_time": "2023-05-23T03:44:06",
            "upload_time_iso_8601": "2023-05-23T03:44:06.783539Z",
            "url": "https://files.pythonhosted.org/packages/c4/9b/6dfee6a4371e838d469800cf9a3802dbe0e14a4916fc5f694b6dc659dd28/nicegpt-0.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-23 03:44:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SamuelReeder",
    "github_project": "nicegpt",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nicegpt"
}
        
Elapsed time: 0.10099s