Skip to main content

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


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.8.tar.gz (3.2 kB view hashes)

Uploaded Source

Built Distribution

promptdesk-0.1.8-py3-none-any.whl (3.7 kB view hashes)

Uploaded Python 3

Supported by

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