Python
PromptDesk Python SDK
Install PromptDesk
To install PromptDesk, use pip:
pip install promptdesk
Initialization
You can call the prompt you build in the application by using the generate method.
from promptdesk import PromptDesk
pd = PromptDesk(
api_key = "API_KEY",
service_url = "http://localhost"
)
You can find your API key in the application under Organization Information > API Key.
You can test out the service by pinging it:
pd.ping()
A successful ping will return "pong".
Python SDK Walkthrough (10 minutes)
Usage
No variables
yoda_response = pd.generate("yoda-test")
print(yoda_response)
With variables
short_story = pd.generate("short-story-test", {
"setting":"an old stone home",
"plot":"knock on door",
"character":"and old farmer and his wife"
})
print(short_story)
Logs
You can view the logs of your prompt calls in the PromptDesk OS -> Logs. If you are having trouble, check the logs to see if there are any errors.