A Python library for making API requests to your GPT servers.
Project description
akgpt
A simple Python library for interacting with your custom GPT API.
Installation
pip install akgpt
Usage
import os
from akgpt import AKGPT
# Set your API key as an environment variable (recommended)
# export AKGPT_API_KEY="your_secret_api_key"
# Or pass it directly (less secure)
# client = AKGPT(api_key="your_secret_api_key")
client = AKGPT()
response = client.query("text-davinci-003", "What is the capital of France?")
print(response)
response = client.query("gpt-4", "Write a short story about a robot.", temperature=0.8, max_tokens=100)
print(response)
API Key
Your API key can be provided in two ways:
- Environment Variable (Recommended): Set the
AKGPT_API_KEYenvironment variable.export AKGPT_API_KEY="your_secret_api_key"
- Directly in Code: Pass the
api_keyargument when initializing theAKGPTclass.client = AKGPT(api_key="your_secret_api_key")
Models
Specify the model you want to use in the query method. Available models depend on your backend API.
Parameters
Additional parameters can be passed as keyword arguments to the query method. These will be forwarded to your backend API. Common parameters include temperature, max_tokens, etc.
Contributing
Feel free to contribute to this project by opening issues or pull requests on GitHub.
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 akgpt-0.0.1.tar.gz.
File metadata
- Download URL: akgpt-0.0.1.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24ebdf700b621fd531a63d944090f8cc0955cfbf5fc234ec7fda0be2d74cffba
|
|
| MD5 |
b565a47cb72d3cc8efb2c6123fc9bd47
|
|
| BLAKE2b-256 |
11b6283e74bc84b3e495d21d804f44f731f4fa7c9e8563e4bf9c57c9c5ba5408
|
File details
Details for the file akgpt-0.0.1-py3-none-any.whl.
File metadata
- Download URL: akgpt-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4300bf2299c99a4927009fff98c27e64005327f56dec9b718d0afb5ce654a301
|
|
| MD5 |
63b189f7232ff021ab359ff236a76382
|
|
| BLAKE2b-256 |
03a1359b406c6192577c55461febe3962ec8012a877c988091954a574a5de3b1
|