Library for building prompts for LLMs
Project description
Prompt Builder
Library for building prompts and agents with LLMs.
Installation
From PyPI:
pip install promptbuilder
From source:
git clone https://github.com/kapulkin/promptbuilder.git
cd promptbuilder
pip install -e .
Features
- Prompt templates with variables and content tags
- Structured output with TypeScript-like schema definition
- LLM client with native structured output support and caching option
- Integration with multiple LLM providers through aisuite
- Agents with routing based on tools
- Tools as agent for flexibility and scalability
Quick Start
from promptbuilder.llm_client import LLMClient
from promptbuilder.prompt_builder import PromptBuilder
# Build prompt template
prompt_template = PromptBuilder() \
.text("What is the capital of ").variable("country").text("?") \
.build()
# Use with LLM
llm_client = LLMClient(model="your-model", api_key="your-api-key")
response = llm_client.make_request(
prompt_template.render(country="France")
)
print(response)
See examples for more details.
License
MIT License - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a pull request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
promptbuilder-0.2.2.tar.gz
(8.5 kB
view details)
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 promptbuilder-0.2.2.tar.gz.
File metadata
- Download URL: promptbuilder-0.2.2.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3fe9004dfdeb2a3e2e8b00bbd1bf34b4ed899822d3dbbbd395e8ad94e66ce95b
|
|
| MD5 |
24dcd6254a9380b5f61637d3526cd546
|
|
| BLAKE2b-256 |
ec1f86f11bb89a38125bf6debc3857ebb2ef91b71f163630a1362410c346b4cb
|
File details
Details for the file promptbuilder-0.2.2-py3-none-any.whl.
File metadata
- Download URL: promptbuilder-0.2.2-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
510b2f7727b9e4ba9bc4c28c2e04e93073ed6c1eeb2450d5e0e594b7ac686e20
|
|
| MD5 |
0226509e346c917c7ea17aa4c7393eda
|
|
| BLAKE2b-256 |
d7325597b1fa23f1137208800d69be0dab39def730f156c48cccb9f8f05a7f92
|