Lib for prompt engineering using OpenAI
Project description
cannoli
Install
!pip install cannoli
Usage Instructions:
Basic Usage:
This example demonstrates how to retrieve the API key from an environment variable named OPENAI_API_KEY
. It also shows how to use default parameters defined in default_settings.json
.
# Create an instance of the Cannoli class
cnl = Cannoli()
# Ask a question with the quick_question method and store the response in 'ans'
ans = cnl.quick_question("What's the boiling point of water?")
Customizing Parameters:
In this example, the Cannoli class instance is created with a user-provided API key and custom settings, including the choice of engine, custom prompt, token limits, and temperature settings.
# Instantiate the Cannoli class with a custom API key and setup parameters
api_key = 'your_api_key_here'
setup = {
"engine": "gpt-3.5-turbo-instruct",
"prompt": "You are my personal assistant. Please provide the best answer you can.",
"max_tokens": 300,
"temperature": 0.7
}
cnl = Cannoli(api_key=api_key, setup=setup)
# Use the quick_question method to ask a question and store the answer in 'ans'
ans = cnl.quick_question("What's the boiling point of water?")
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
cannoli-0.1.27.tar.gz
(17.7 kB
view details)
Built Distribution
cannoli-0.1.27-py3-none-any.whl
(18.5 kB
view details)
File details
Details for the file cannoli-0.1.27.tar.gz
.
File metadata
- Download URL: cannoli-0.1.27.tar.gz
- Upload date:
- Size: 17.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7022d73ae952c65485a3ce13dcc671404a99f4b7e7d5ad60dc1835b86414f13 |
|
MD5 | 178c0475b5cd21668a450460c1991cc2 |
|
BLAKE2b-256 | e9300dec1408afb550a0d97f87c29670ec377ff2cc98b1d0fff896f2d9ac08ab |
File details
Details for the file cannoli-0.1.27-py3-none-any.whl
.
File metadata
- Download URL: cannoli-0.1.27-py3-none-any.whl
- Upload date:
- Size: 18.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd18dfd85b95b1fdae5b82f25093f99b47ff540248ba95f4215d4d59c334a6a6 |
|
MD5 | 214204d7d575199bc58acf5cff5b7583 |
|
BLAKE2b-256 | 1e58e49537d6ed7dc9df0afc5ad5c2c3ab8563f4ec9def10276fe187289f25c5 |