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.0.tar.gz
(6.1 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.0.tar.gz.
File metadata
- Download URL: promptbuilder-0.2.0.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e859921789bdd6040c43cb15f82ec22037c1b05fd254c6d32da5e228aada938
|
|
| MD5 |
07ebed7d055a2425940063d95795afc2
|
|
| BLAKE2b-256 |
a1d9d7b9d4fba3a3f834e526b42e54253a1d494221d8e13eef7ba5a2ba81ae8d
|
File details
Details for the file promptbuilder-0.2.0-py3-none-any.whl.
File metadata
- Download URL: promptbuilder-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.4 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 |
fed7b893740aa6f68ab6625128f935d77361a6412ea314f2d30697e5e45e8499
|
|
| MD5 |
7a739502c8f7d231faa55129bf0a8dbc
|
|
| BLAKE2b-256 |
4b89e05febc02507e0195909476d6a2fdffcc77f29808eb842b5ff4a6a5857d2
|