PromptDesk python SDK.
Project description
PromptDesk Python SDK
Overview
PromptDesk Python SDK is a pip package designed to facilitate the dynamic integration, development, optimization, and assessment of prompts and large language models (LLMs) within your Python applications.
Installation
To install PromptDesk, use pip:
pip install promptdesk
Usage
Pinging the Service
Make sure the PromptDesk service is running by pinging it:
import promptdesk
promptdesk.SERVICE_URL = "http://localhost:4000"
pong = promptdesk.ping()
print(pong) # Should print "pong"
The SERVICE_URL defaults to "http://localhost:4000", so you can omit this line if you are running the service locally.
Generating Text
You can generate text by using the generate method.
import promptdesk
yoda_response = promptdesk.generate("yoda-test")
print(yoda_response)
Sample output:
Hmm, hello there, I am. Fine, I am. And you?
Generating Text with Variables
You can generate text with variables by passing a dictionary of variables as the second argument to the generate method.
import promptdesk
story = promptdesk.generate("short-story-generator", {
"setting": "A dark and stormy night",
"character": "A lonely farmer",
"plot": "A farmer is visited by a stranger"
})
print(story)
Sample output:
On a dark and stormy night, a lonely farmer was tending to his crops, the sound of thunder echoing through the desolate fields. As lightning flashed, illuminating the eerie landscape, a mysterious stranger knocked on the farmers door seeking refuge from the tempestuous night. The farmer, wary but compassionate, welcomed the stranger, unknowingly inviting a twist of fate into his secluded existence.
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
Built Distribution
Hashes for promptdesk-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e862a18191a7ef7d30aa73113516d0026603c3d622346500470f441c59f6fa8 |
|
MD5 | 158a6714a05cd1e6736f8716d840ce10 |
|
BLAKE2b-256 | 1455925bbbaec697812f2f27a08376051df9367b316b90d8ead5130ddac9c53f |