Skip to main content

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


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.2.tar.gz (14.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cannoli-0.1.2-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file cannoli-0.1.2.tar.gz.

File metadata

  • Download URL: cannoli-0.1.2.tar.gz
  • Upload date:
  • Size: 14.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for cannoli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 1a028e7786f9e25b05d172cb0033324d2596cad2e3280706c3c7f77c39cae9c5
MD5 2e21c017ad5703857abe30b747648401
BLAKE2b-256 fb18b2046c1d5d69662f6fc2a49a3b888b4ffae6ca0500a2ac42b4c2d3632f5a

See more details on using hashes here.

File details

Details for the file cannoli-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: cannoli-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.6

File hashes

Hashes for cannoli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6217add7636d3d25b365a4b7c964efb7a3eec308488deffc8d3fcbfc69804b79
MD5 8ccd3622537a626f7fc00f8a16f9d471
BLAKE2b-256 1565592ac52191b4f2b6ffa2cf0a0706087e309a8331da24255f261ed3f26693

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page