Skip to main content

Dynamically convert your prompts into Python functions, with template variables as function parameters for each prompt. Get visibility into your prompts through intellisense, without cluttering your python code with long running f-strings.

Installation

pip install prompt-compiler

Usage

  1. Create prompt templates with .mdx extension:
# Example prompt

System: {{ system }}
User: {{ user }}
  1. Compile prompts:
# One-time build
prompt-compiler build ./templates

# Watch mode
prompt-compiler watch ./templates
  1. Use in your code:
from templates.__prompts__ import example

result = example(
    system="You are a helpful assistant",
    user="Hello!"
)

Release files for prompt-compiler 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for prompt-compiler 0.1.1
File Size Uploaded
prompt_compiler-0.1.1.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for prompt-compiler 0.1.1
File Interpreter ABI Platform
prompt_compiler-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.6 kB

Release files / prompt_compiler-0.1.1.tar.gz

Download URL prompt_compiler-0.1.1.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6a839481c336dfa045f4214f36207b55b4925a49db11fafb4715cde01543a8be
BLAKE2b-256 checksum
How to use checksums
b86f400c7390c52dd2a4c00b49e2f803bba1293090f7879c1b0b50f006f6fd79
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.10.6 Linux/5.15.153.1-microsoft-standard-WSL2

Release files / prompt_compiler-0.1.1-py3-none-any.whl

Download URL prompt_compiler-0.1.1-py3-none-any.whl
Size 6.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4459de273247e4cb9444c9e85792ea6da6d785f25dafd2d4424d6d819103a86
BLAKE2b-256 checksum
How to use checksums
21967159ca2cf032a8e7e567276cfb96395e02c9e26efc492a9ab6cc2e87b171
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.0.1 CPython/3.10.6 Linux/5.15.153.1-microsoft-standard-WSL2

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page