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.

Project description

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!"
)

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

prompt_compiler-0.1.1.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

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

prompt_compiler-0.1.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file prompt_compiler-0.1.1.tar.gz.

File metadata

  • Download URL: prompt_compiler-0.1.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.6 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for prompt_compiler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6a839481c336dfa045f4214f36207b55b4925a49db11fafb4715cde01543a8be
MD5 9117abf0a0dd2a92086066a71259687c
BLAKE2b-256 b86f400c7390c52dd2a4c00b49e2f803bba1293090f7879c1b0b50f006f6fd79

See more details on using hashes here.

File details

Details for the file prompt_compiler-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: prompt_compiler-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.10.6 Linux/5.15.153.1-microsoft-standard-WSL2

File hashes

Hashes for prompt_compiler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4459de273247e4cb9444c9e85792ea6da6d785f25dafd2d4424d6d819103a86
MD5 955825c44b3aad711867dc4bd079608c
BLAKE2b-256 21967159ca2cf032a8e7e567276cfb96395e02c9e26efc492a9ab6cc2e87b171

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