Library for building prompts for LLMs
Project description
Prompt Builder
Library for building prompts for LLMs.
Installation
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.0.tar.gz
(5.9 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.0.tar.gz.
File metadata
- Download URL: promptbuilder-0.1.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8d116166d81d134b35307ab2269531bfa4b873019790b56eeb14242302a1976
|
|
| MD5 |
52200f902a2f8cd937046eb8af3a494d
|
|
| BLAKE2b-256 |
a61ec2972f9d15721fe953aa4cf56f56014c95c8c520a97123ee6151d1ad6d62
|
File details
Details for the file promptbuilder-0.1.0-py3-none-any.whl.
File metadata
- Download URL: promptbuilder-0.1.0-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 |
ff638911e5d5e214f8a15da48f85a7e81b679da887a0d2c517cbe118a5cc974e
|
|
| MD5 |
6b8bbe541abf78e62ab839ef160e9abe
|
|
| BLAKE2b-256 |
7db245eb89e74d561281d31996a7338106534483dc7177634602652269db676a
|