Banks (version 2.4.1) is a Python library designed as a prompt programming language for Large Language Models (LLMs). It simplifies the creation, templating, versioning, and management of LLM prompts, offering an intuitive alternative to f-strings for complex prompt engineering. The library maintains an active and frequent release cadence, continuously adding features and improvements.
pip install banksVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to define a multi-turn chat prompt using Banks' templating syntax and then render it into a list of chat messages suitable for Large Language Model (LLM) APIs.
Upgrade to Banks v2.4.1 or later if using Python 3.9. Consider using Python 3.10+ for broader compatibility.
Modify your installation command to `pip install "banks[all]"` or install specific extras like `"banks[litellm]"` if only certain optional features are needed.
Set `os.environ['BANKS_ASYNC_ENABLED'] = 'true'` before initializing your application, and ensure you are importing and using `AsyncPrompt` where async functionality is desired.
Review the Banks v2.0.0 changelog and your project's dependency resolution. It might be necessary to recreate virtual environments or manually update/pin specific dependency versions.
Install the library using pip: `pip install banks`
Review the template string for syntax errors, ensuring variables names are valid Python identifiers and Jinja2 syntax is correctly applied. For example, `{{ cyl number }}` should be `{{ cyl_number }}`.Ensure all variables used in the template are passed as keyword arguments to the `prompt.render()` method, or that the objects they are attributes of exist and are correctly passed.