Skip to main content

📚 PromptBook

📝 Overview

PromptBook is a powerful and flexible prompt management library designed for AI-driven workflows. It allows users to create, manage, and execute prompts efficiently, including pre-prompts and post-prompts. The library integrates seamlessly with Ollama, enabling contextual AI conversations across multiple prompts.

🚀 Features

  • Create & Manage Prompt Books: Organize prompts in structured prompt books.
  • Pre & Post-Prompt Execution: Automatically process dependent prompts before and after the main prompt.
  • Variable Substitution: Dynamically replace placeholders with user-defined or default values.
  • Ollama Integration: Run prompts in AI models while maintaining context across multiple prompts.
  • Git-Based Prompt Cloning: Clone prompt books from Git repositories for shared collaboration.
  • Customizable Configuration: Modify API settings, debugging options, and more via config.yaml.

📥 Installation

pip install promptbook

🔧 Configuration

After installation, a config.yaml file can be created in the project root to customize settings:

ollama:
  model: "llama3:2b"
  stream: true
  debug: false
  api_url: "http://localhost:11434/api/chat"
  tags_url: "http://localhost:11434/api/tags"

📖 Usage

1️⃣ Running a Prompt

To execute a prompt from a prompt book:

promptbook run test-prompt

2️⃣ Creating a New Prompt Book

To create a new prompt book:

promptbook create-book

The CLI will guide you through setting up the book structure and an initial prompt file.

3️⃣ Cloning a Prompt Book from GitHub

promptbook clone https://github.com/username/promptbook-repo.git

4️⃣ Debugging API Calls

Enable debug mode in config.yaml:

debug: true

5️⃣ Running a Prompt with Ollama

Each item in a prompt list will be executed sequentially while maintaining conversation context.

promptbook run my-prompt

Example output:

💬 Sending: What is the capital of France?
🧠 Ollama Response: The capital of France is Paris.

📂 File Structure

my-promptbook/
├── prompt-book.yaml  # Book metadata
├── prompts/
│   ├── test-prompt.prompt
│   ├── another-prompt.prompt

🛠 Development & Contribution

  1. Clone the repository:
    git clone https://github.com/yourusername/promptbook.git
    cd promptbook
    
  2. Install dependencies:
    pip install -e .
    
  3. Run tests:
    pytest tests/
    

📜 License

This project is licensed under the MIT License.

✨ Credits

Developed by Sharfuddin Shawon.

Metadata

Release files for promptbook 0.5.0

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

Source distribution (sdist)

Source distribution for promptbook 0.5.0
File Size Uploaded
promptbook-0.5.0.tar.gz 8.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for promptbook 0.5.0
File Interpreter ABI Platform
promptbook-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 18.7 kB

Release files / promptbook-0.5.0.tar.gz

Download URL promptbook-0.5.0.tar.gz
Size 8.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a8b02ec7edaebdccd3365bd9a6ca585ca4d767d3ea46e304f5b2001fc3bc3ea8
BLAKE2b-256 checksum
How to use checksums
f80b1b2f46deec6a7f5eaa159e663ae1daf264ef43a777f6a7ae7295aa7ab766
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / promptbook-0.5.0-py3-none-any.whl

Download URL promptbook-0.5.0-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
60975c581e22622dea4ceaeec75448ab3644f4f673d3b07a97457f23102aa248
BLAKE2b-256 checksum
How to use checksums
d4c5837cb41a5b10efcf58a3bd28c971822cf48297676c151025cad345e026c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

1 release file

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