No project description provided
Project description
# Call OpenAI GPT, OpenAI GPT Python Wrapper
用 Python 以 API 的方式呼叫 OpenAI 的 GPT 服務。
## 前置需求
1. Python 3.6 或以上
2. `requests` 套件
3. `python-dotenv` 套件
4. OPENAI_API_KEY,在 `.env` 檔案中設定
## 安裝
使用 pip 從 GitHub 安裝:
```bash
python3 -m pip install call-openai-gpt
call_openai_gpt 參數
1. `prompt` (必需): 這是模型的輸入,模型會根據這個輸入來進行生成。你可以給任何的提示、問題,或甚至是故事的開盤等。
2. `model` (預設值: "gpt-4"): 這是你希望使用的模型。
3. `temperature` (預設值: 0): 此參數表示生成的隨機性。若將此參數設為高值,將造成生成結果更多變化和創新,但可能較不相關或不合理。若設為較低的值,則生成的輸出較確定且一致,但可能較缺乏創新。
4. `max_tokens` (預設值: 無): 這個參數可以設定生成的最大字數。如果你有特定的長度需求,可以考慮設定此參數。請注意,設定此參數的數值太高或太低都可能導致生成結果品質下降。
from call_openai_gpt import call_openai_gpt
prompt = "你好!用繁體中文打招呼吧~"
response = call_openai_gpt(prompt)
print(response)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
call-openai-gpt-1.0.0.tar.gz
(2.5 kB
view details)
Built Distribution
File details
Details for the file call-openai-gpt-1.0.0.tar.gz
.
File metadata
- Download URL: call-openai-gpt-1.0.0.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f38d547f4b999400b410c644e34940d1e2a8edfeb21855d9311efb260db85f50 |
|
MD5 | 250004a54a480395a193f0888afa84f7 |
|
BLAKE2b-256 | 1a86a51bfd5b09caa293e22b9d75171c4204f28a23a1e6f4b3ddbbdfb915a6da |
File details
Details for the file call_openai_gpt-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: call_openai_gpt-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8386545e00adfb9e364ff4d1804c594e9ddb6813df785916cfb8f155aca60d3 |
|
MD5 | 3e66140189199e6c40bbecb6b3e09a0c |
|
BLAKE2b-256 | 19efc6c840222e5bc1463d5c78f2257d18350e5571781e7473572a5d8b535b7d |