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
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?
Pinging the Service
Make sure the PromptDesk service is running by pinging it:
import promptdesk
pong = promptdesk.ping()
print(pong) # Should print "pong"
The service defaults to the PromptDesk API, if you are running your own server, you can specify the URL:
import promptdesk
promptdesk.SERVICE_URL = "http://localhost:4000"
pong = promptdesk.ping()
print(pong) # Should print "pong"
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
promptdesk-0.1.7.tar.gz
(3.1 kB
view hashes)
Built Distribution
Close
Hashes for promptdesk-0.1.7-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4d2dd1fc82f6f10c39f8e16a346f863ac7d68976a9ae36de4259a87fec50066 |
|
MD5 | e8ed3191a78e6186cc5567c9caddc0c6 |
|
BLAKE2b-256 | 9be82df10284a183198ce28e83f00ce090e1c6a557b1ebf71e7dccc657ced4f6 |