Skip to main content

General library wrapping and calling LLMs for prompt engineering.

Project description

PREWL

Prompt Engineering Wrapper for LLMs (PREWL): A library for rapidly prototyping LLM-based applications via prompt engineering for NLU.

Usage

import prewl, json

# Load configuration for backend (e.g., GPT-3 credentials)
prewl.configure("config.json")

# Load the example prompts
examples =  prewl.load_promps("prompts.json")

PATTERN = """
Text: {text}
Sentiment: {sentiment}
"""

# Prompts objects
prompts = prewl.load_prompts(PATTERN, examples, output='sentiment')

# Build the backend-driven model that will be used
model = prewl.train(prompts) # Model object


# Use the model to build a prompt for the LLM, fetch the completion, and parse it
new_input = "This movie was off the hook!"
resp = model.infer(new_input)


print("\n New input: ", new_input)
print("Prediction: ", resp)
print()

More examples can be found in the examples/ directory.

Contributing

Coming soon...

Requirements

Setting up virtual environment

python -m venv .env
source .env/bin/activate

Installing torch

pip install torch --extra-index-url https://download.pytorch.org/whl/cu113

Citing This Work

Coming soon...

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

prewl-0.0.4.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

prewl-0.0.4-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file prewl-0.0.4.tar.gz.

File metadata

  • Download URL: prewl-0.0.4.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for prewl-0.0.4.tar.gz
Algorithm Hash digest
SHA256 b96c6de484de38384c1bc212bb7d39aaaaba13ac656bbd5cf29c8fc415f34510
MD5 376eb2b3381ad0cf64e798a1c57ed7bf
BLAKE2b-256 3b1c35cd88c73cea750168d8dafcb5ee3ebcaca3da5a900f341c594c7143c286

See more details on using hashes here.

File details

Details for the file prewl-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: prewl-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for prewl-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2005b6160d726c583c0972b786391434e023b71d19a949115af480c9fdc344f5
MD5 8baa886c7bb622fecbea972e1383cd97
BLAKE2b-256 e185dd63123f58593f49f787d14311db16a13826ad137948034373195c4fccfa

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