Skip to main content

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

This version

0.1.3

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.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

promptbuilder-0.1.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file promptbuilder-0.1.3.tar.gz.

File metadata

  • Download URL: promptbuilder-0.1.3.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

Hashes for promptbuilder-0.1.3.tar.gz
Algorithm Hash digest
SHA256 35f52a10c6a91ef5467f1adb9fa14a0b2479ff3d5bfa633d00e20f0d2797ce0d
MD5 634b9b827a7a5f66828507088c2b454a
BLAKE2b-256 de8f79a7556fb466abbf03330890b5172664e7b08da78bb33379f7a673846527

See more details on using hashes here.

File details

Details for the file promptbuilder-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: promptbuilder-0.1.3-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

Hashes for promptbuilder-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f5bd3225364e3bacb60dc8040a6629e0f70cd49ceca3380b32796d8327a538cb
MD5 45e52fdd4b0d874c994366556ecd468c
BLAKE2b-256 37b3d28f43143964fd22d04cef81e65582957580d91ecd8240bd58db86b2d4fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page