pixie-prompts
Code-first, type-checked prompt management. Manage prompt locally in your codebase, with Jinja rendering, variable type-hint and validations.
Setup
In your project folder, install pixie-prompts[server] Python package:
pip install pixie-prompts[server]
Note: you can install pixie-prompts without the server extras for your production build.
Start the local dev server and open the web UI by running:
pp
Note: The web-browser would automatically open http://localhost:8000. You can also access the web UI at gopixie.ai.
To test prompts, create .env file with LLM API key(s):
# .env
OPENAI_API_KEY=...
GEMINI_API_KEY=...
Register Prompt
In your code, create a new prompt using create_prompt:
# prompts.py
from pixie.prompts import create_prompt
simple_prompt = create_prompt('simple_prompt')
Your prompt would automatically appear in the web UI after your code is saved.
Manage Prompt
You can create new version(s) of a prompt in the web UI.
Once saved from web UI, it will be assigned a new version id, and the content would be saved in your codebase at /.pixie/prompts/<prompt_name>/<version_id>.jinja.
Note: it's recommended to only edit your prompts via the web UI to get type-hint and validation.
Define Variables
For prompt that has variable(s) in it, define a class extending pixie.prompts.Variables (which extends pydantic.BaseModel. Then use the class type when registering your prompt.
# prompts.py
from pixie.prompts import Variables, create_prompt
class Person(Variables):
name: str
age: int
# Create a prompt with variables
typed_prompt = create_prompt('typed_prompt', Person)
Other than using dict, you can define your variable class in anyway that's permissible in Pydantic. I.e. you can define your field as basic types such as str, int, bool, you can have a list of permissible items, you can use Union type, and you can have nested Variable field.
The web UI will parse your variable definitions and use it to decide input fields, type-hints and validations.
Use Prompt
Compile your prompt into string with the compile function on the prompt object. Pass in the Variables object (if defined) for your prompt as argument.
# demo.py
from pixie.prompts import Variables, create_prompt
simple_prompt = create_prompt('simple_prompt')
class Person(Variables):
name: str
age: int
# Create a prompt with variables
typed_prompt = create_prompt('typed_prompt', Person)
simple_prompt_str = simple_prompt.compile()
typed_prompt_str = typed_prompt.compile(Person(name="Jane", age=30))
Check out more examples.
Metadata
Release files for pixie-prompts 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pixie_prompts-0.1.15.tar.gz | 25.6 kB | Without provenance | Details for pixie_prompts-0.1.15.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pixie_prompts-0.1.15-py3-none-any.whl | Python 3 | none | any | Details for pixie_prompts-0.1.15-py3-none-any.whl |
Total release size: 53.5 kB
Release files / pixie_prompts-0.1.15.tar.gz
| Download URL | pixie_prompts-0.1.15.tar.gz |
|---|---|
| Size | 25.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
784f00286abd2d0bc05693b01efd0b6ae60d906cf6464172065b5a26ac55296c
|
|
BLAKE2b-256 checksum How to use checksums |
b69ecd863a8b6c7644b3d3f4731d8c26bc48d1524a7cd0509a2a216fbb3239c5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.12.12 Linux/6.11.0-1018-azure
|
Release files / pixie_prompts-0.1.15-py3-none-any.whl
| Download URL | pixie_prompts-0.1.15-py3-none-any.whl |
|---|---|
| Size | 27.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
403a37422635730319d4e2a5e64d8a0ac197361aa89908902af580af1053fa91
|
|
BLAKE2b-256 checksum How to use checksums |
4a565b3bc5f7a7b3092adffd72e5715ed829b3e1c2184bf1c2f654dd956502a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.12.12 Linux/6.11.0-1018-azure
|
Security for pixie-prompts 0.1.15
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.