PromptBook is a powerful and flexible prompt management library designed for AI-driven workflows
Project description
📚 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
- Clone the repository:
git clone https://github.com/yourusername/promptbook.git cd promptbook
- Install dependencies:
pip install -e .
- Run tests:
pytest tests/
📜 License
This project is licensed under the MIT License.
✨ Credits
Developed by Sharfuddin Shawon.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file promptbook-0.5.0.tar.gz.
File metadata
- Download URL: promptbook-0.5.0.tar.gz
- Upload date:
- Size: 8.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a8b02ec7edaebdccd3365bd9a6ca585ca4d767d3ea46e304f5b2001fc3bc3ea8
|
|
| MD5 |
0d4ae9b1f54783cfd0ad06c910fd4163
|
|
| BLAKE2b-256 |
f80b1b2f46deec6a7f5eaa159e663ae1daf264ef43a777f6a7ae7295aa7ab766
|
File details
Details for the file promptbook-0.5.0-py3-none-any.whl.
File metadata
- Download URL: promptbook-0.5.0-py3-none-any.whl
- Upload date:
- Size: 10.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
60975c581e22622dea4ceaeec75448ab3644f4f673d3b07a97457f23102aa248
|
|
| MD5 |
2e9dc7184e2d78897518a88bbcaa1d47
|
|
| BLAKE2b-256 |
d4c5837cb41a5b10efcf58a3bd28c971822cf48297676c151025cad345e026c4
|