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.
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:
gpt_instance = nicegpt.GPT(model=nicegpt.Model.GPT4)
Now you can obtain context-driven responses using the response function:
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:
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:
gpt_instance.change_model(nicegpt.Model.GPT3_5)
To access the message history, use the get_messages function:
message_history = gpt_instance.get_messages()
print(message_history)
License
This project is released under the MIT License.
Release files for nicegpt 0.0.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nicegpt-0.0.7.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nicegpt-0.0.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.7 kB
Release files / nicegpt-0.0.7.tar.gz
| Download URL | nicegpt-0.0.7.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b3ca708af4ce3d2a0be06f96ef95d6ff17c1891bd6f62d943011daa9a143a7a0
|
|
BLAKE2b-256 checksum How to use checksums |
c49b6dfee6a4371e838d469800cf9a3802dbe0e14a4916fc5f694b6dc659dd28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.5
|
Release files / nicegpt-0.0.7-py3-none-any.whl
| Download URL | nicegpt-0.0.7-py3-none-any.whl |
|---|---|
| Size | 5.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c1afb85e9ae63f80a9ae12f4ad4bd5b9c9177d4184297830d030b795e99423d7
|
|
BLAKE2b-256 checksum How to use checksums |
79bded889d33e99808402b0b6ca381192efb7901ad1fe7437bb56dc434fc1a52
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.5
|