Library for building prompts for LLMs
Project description
Prompt Builder
Library for building prompts for 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
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.1.1.tar.gz
(6.0 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.1.1.tar.gz.
File metadata
- Download URL: promptbuilder-0.1.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51bbd354e5176a93920e1aec2d4d4129b2b01d4656ba3ae1b2787d89d35c6753
|
|
| MD5 |
1640447ec33164d91c796545d0408c35
|
|
| BLAKE2b-256 |
26c8cc6db7a43a845a53db2473ba513743660343b6b5ee7121afe37197b0c4c4
|
File details
Details for the file promptbuilder-0.1.1-py3-none-any.whl.
File metadata
- Download URL: promptbuilder-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.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 |
e542db8c23ab7a593cbc9db1f5372d39d6e9c7e9eb8271badc2f0315ecc4ace1
|
|
| MD5 |
062f0cff705e5bd85165610e051f1ad8
|
|
| BLAKE2b-256 |
25b2d7edcfc4ad448a895fe22f62c1548c7390ff8942207608bb59d0f5568804
|