Skip to main content

Prompty is an asset class and format for LLM prompts designed to enhance observability, understandability, and portability for developers. The primary goal is to accelerate the developer inner loop of prompt engineering and prompt source management in a cross-language and cross-platform implementation.

The file format has a supporting toolchain with a VS Code extension and runtimes in multiple programming languages to simplify and accelerate your AI application development.

The tooling comes together in three ways: the prompty file asset, the VS Code extension tool, and runtimes in multiple programming languges.

The Prompty File Format

Prompty is a language agnostic prompt asset for creating prompts and engineering the responses. Learn more about the format here.

Examples prompty file:

---
name: Basic Prompt
description: A basic prompt that uses the GPT-3 chat API to answer questions
authors:
  - sethjuarez
  - jietong
model:
  api: chat
  configuration:
    azure_deployment: gpt-35-turbo
sample:
  firstName: Jane
  lastName: Doe
  question: What is the meaning of life?
---
system:
You are an AI assistant who helps people find information.
As the assistant, you answer questions briefly, succinctly, 
and in a personable manner using markdown and even add some personal flair with appropriate emojis.

# Customer
You are helping {{firstName}} {{lastName}} to find answers to their questions.
Use their name to address them in your responses.

user:
{{question}}

The Prompty VS Code Extension

Run Prompty files directly in VS Code. This Visual Studio Code extension offers an intuitive prompt playground within VS Code to streamline the prompt engineering process. You can find the Prompty extension in the Visual Studio Code Marketplace.

Download the VS Code extension here.

Using this Prompty Runtime

The Python runtime is a simple way to run your prompts in Python. The runtime is available as a Python package and can be installed using pip.

pip install prompty

Simple usage example:

import prompty

# execute the prompt
response = prompty.execute("path/to/prompty/file")

print(response)

Using Tracing in Prompty

Prompty supports tracing to help you understand the execution of your prompts. The built-in tracing dumps the execution of the prompt to a file.

import prompty
from prompty.tracer import Trace, PromptyTracer

# add default tracer
Trace.add_tracerTrace.add_tracer("prompty", PromptyTracer("path/to/trace/dir"))

# execute the prompt
response = prompty.execute("path/to/prompty/file")

print(response)

You can also bring your own tracer by creating a Tracer class. Simple example:

import prompty
from prompty.tracer import Tracer

class MyTracer(Tracer):

    def start(self, name: str) -> None:
        print(f"Starting {name}")

    def add(self, key: str, value: Any) -> None:
        print(f"Adding {key} with value {value}")

    def end(self) -> None:
        print("Ending")

# add your tracer
Trace.add_tracer("my_tracer", MyTracer())

# execute the prompt
response = prompty.execute("path/to/prompty/file")

To define your own tracer, you can subclass the Tracer class and implement the start, add, and end methods and then add it to the Trace instance. You can add as many tracers as you like - the will all of them will be called in order.

CLI

The Prompty runtime also comes with a CLI tool that allows you to run prompts from the command line. The CLI tool is installed with the Python package.

prompty -s path/to/prompty/file

This will execute the prompt and print the response to the console. It also has default tracing enabled.

Contributing

We welcome contributions to the Prompty project! This community led project is open to all contributors. The project cvan be found on GitHub.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prompty-0.1.9.tar.gz (198.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prompty-0.1.9-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file prompty-0.1.9.tar.gz.

File metadata

  • Download URL: prompty-0.1.9.tar.gz
  • Upload date:
  • Size: 198.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.17.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for prompty-0.1.9.tar.gz
Algorithm Hash digest
SHA256 7acbf59b40ff0479b4a07dd07cf5f54951d21399d595931881cfb3042b6efa7b
MD5 25d546083deb4ce19be708dce835b311
BLAKE2b-256 9340f6c3afb6d5cd49b79e9d4e1278fb2875836720333e4647c84d2e428a1374

See more details on using hashes here.

File details

Details for the file prompty-0.1.9-py3-none-any.whl.

File metadata

  • Download URL: prompty-0.1.9-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.17.3 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for prompty-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1d15b133007c231d44ae41d54b81290e6842bdb0bb5b443ea729d356b3bc4f86
MD5 afb9910a1b67c058648b98fd74ac6cd9
BLAKE2b-256 61d138a7b8273fe7fc751014be02a765001b43576bd73f5f7c115b202a8536af

See more details on using hashes here.

Supported by

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