If you are using python you should use the pip package prompt-wrangler.

Installation

Install the package using pip:

pip install prompt-wrangler

Environment Variables

Before using the package you need to set environment variables.

If you want to use private prompts from your workspace you should set the PROMPT_WRANGLER_API_KEY:

PROMPT_WRANGLER_API_KEY=<your_api_key>

If you want to use public prompts from the community you should set the OPENAI_API_KEY:

OPENAI_API_KEY=<open_ai_api_key>

Note that if you set your PROMPT_WRANGLER_API_KEY you don’t need to set OPENAI_API_KEY as it will be used as a fallback.

Usage

from prompt_wrangler import PromptWrangler

# Create a PromptWrangler instance
pw = PromptWrangler()

# Get a prompt
prompt_path = "my-workspace/my-prompt-slug"
prompt = pw.prompt(prompt_path)

# Run the prompt
args = {'input_text': 'some input'}
result = prompt.run(args=args)
prediction = result.prediction