# banks

> A prompt programming language

- **URL**: https://www.freshcrate.ai/projects/banks
- **Author**: pypi
- **Category**: RAG & Memory
- **Latest version**: `main@2026-04-27` (2026-04-27)
- **License**: Unknown
- **Source**: https://github.com/masci/banks#readme
- **Homepage**: https://pypi.org/project/banks/
- **Language**: Python
- **GitHub**: 125 stars, 20 forks
- **Registry**: pypi (`banks`)
- **Tags**: `pypi`

## Description

# banks

[![PyPI - Version](https://img.shields.io/pypi/v/banks.svg)](https://pypi.org/project/banks)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/banks.svg)](https://pypi.org/project/banks)
[![Coverage Status](https://coveralls.io/repos/github/masci/banks/badge.svg?branch=main)](https://coveralls.io/github/masci/banks?branch=main)

[![PyPI Release](https://github.com/masci/banks/actions/workflows/release.yml/badge.svg)](https://github.com/masci/banks/actions/workflows/release.yml)
[![test](https://github.com/masci/banks/actions/workflows/test.yml/badge.svg)](https://github.com/masci/banks/actions/workflows/test.yml)
[![docs](https://github.com/masci/banks/actions/workflows/docs.yml/badge.svg)](https://github.com/masci/banks/actions/workflows/docs.yml)

[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![License - MIT](https://img.shields.io/badge/license-MIT-9400d3.svg)](https://spdx.org/licenses/)

[Banks](https://en.wikipedia.org/wiki/Arrival_(film)) is the linguist professor who will help you generate meaningful
LLM prompts using a template language that makes sense. If you're still using `f-strings` for the job, keep reading.

Docs are available [here](https://masci.github.io/banks/).

![Banks Logo](./assets/banks.png)

-----

**Table of Contents**

- [banks](#banks)
  - [Installation](#installation)
  - [Features](#features)
  - [Cookbook](#cookbook)
  - [Examples](#examples)
    - [:point\_right: Render a prompt template as chat messages](#point_right-render-a-prompt-template-as-chat-messages)
    - [:point\_right: Add images to the prompt for vision models](#point_right-add-images-to-the-prompt-for-vision-models)
    - [:point\_right: Use a LLM to generate a text while rendering a prompt](#point_right-use-a-llm-to-generate-a-text-while-rendering-a-prompt)
    - [:point\_right: Function calling directly from the prompt](#point_right-function-calling-directly-from-the-prompt)
    - [:point\_right: Use prompt caching from Anthropic](#point_right-use-prompt-caching-from-anthropic)
  - [Reuse templates from registries](#reuse-templates-from-registries)
  - [Async support](#async-support)
  - [Contributing](#contributing)
  - [License](#license)

## Installation

```console
pip install banks

# install optional deps; litellm, redis
pip install "banks[all]"
```

## Features

Prompts are instrumental for the success of any LLM application, and Banks focuses around specific areas of their
lifecycle:
- :orange_book: **Templating**: Banks provides tools and functions to build prompts text and chat messages from generic blueprints.
- :tickets: **Versioning and metadata**: Banks supports attaching metadata to prompts to ease their management, and versioning is
first-class citizen.
- :file_cabinet: **Management**: Banks provides ways to store prompts on disk along with their metadata.

## Cookbook

- :blue_book: [In-prompt chat completion](./cookbook/in_prompt_completion.ipynb)
- :blue_book: [Prompt caching with Anthropic](./cookbook/Prompt_Caching_with_Anthropic.ipynb)
- :blue_book: [Prompt versioning](./cookbook/Prompt_Versioning.ipynb)

## Examples

For a more extensive set of code examples, [see the documentation page](https://masci.github.io/banks/examples/).

### :point_right: Render a prompt template as chat messages

You'll find yourself feeding an LLM a list of chat messages instead of plain text
more often than not. Banks will help you remove the boilerplate by defining the
messages already at the prompt level.

```py
from banks import Prompt


prompt_template = """
{% chat role="system" %}
You are a {{ persona }}.
{% endchat %}

{% chat role="user" %}
Hello, how are you?
{% endchat %}
"""

p = Prompt(prompt_template)
print(p.chat_messages({"persona": "helpful assistant"}))

# Output:
# [
#   ChatMessage(role='system', content=[
#      ContentBlock(type=<ContentBlockType.text: 'text'>, cache_control=None, text='You are a helpful assistant.', 
#                  image_url=None, input_audio=None, input_video=None, input_document=None)
#   ], tool_call_id=None, name=None), 
#   ChatMessage(role='user', content=[
#      ContentBlock(type=<ContentBlockType.text: 'text'>, cache_control=None, text='Hello, how are you?', 
#                  image_url=None, input_audio=None, input_video=None, input_document=None)
#   ], tool_call_id=None, name=None)
# ]
```

### :point_right: Add images to the prompt for vision models

If you're working with a multimodal model, you can include images directly in the prompt,
and Banks will do the job needed to upload them when rendering the chat messages:

```py
import litellm

from banks import Prompt

prompt_template = """
{% chat role="user" %}
Gues

## Recent releases

| Version | Date | Urgency | Changes |
| --- | --- | --- | --- |
| `main@2026-04-27` | 2026-04-27 | High | Latest activity on main branch |
| `2.4.1` | 2026-04-21 | Low | Imported from PyPI (2.4.1) |
| `main@2026-03-09` | 2026-03-09 | Low | Latest activity on main branch |
| `main@2026-03-09` | 2026-03-09 | Low | Latest activity on main branch |
| `main@2026-03-09` | 2026-03-09 | Low | Latest activity on main branch |
| `v2.4.1` | 2026-02-17 | Low | ## What's Changed * CI: explicitly ignore missing stubs for griffe by @masci in https://github.com/masci/banks/pull/72 * fix: add back support for Python 3.9 by @yuqi1129 in https://github.com/masci/banks/pull/71  ## New Contributors * @yuqi1129 made their first contribution in https://github.com/masci/banks/pull/71  **Full Changelog**: https://github.com/masci/banks/compare/v2.4.0...v2.4.1 |
| `v2.4.0` | 2026-02-06 | Low | ## What's Changed * Support binary inputs to Image, Audio, Video, and Document types by @bschloss in https://github.com/masci/banks/pull/67 * docs: move AI guidance to AGENTS.md for tool-agnostic access by @masci in https://github.com/masci/banks/pull/69   **Full Changelog**: https://github.com/masci/banks/compare/v2.3.0...v2.4.0 |
| `v2.3.0` | 2026-01-21 | Low | ## What's Changed * fix typing and linting with latest Python by @masci in https://github.com/masci/banks/pull/62 * add support for audio URL by @masci in https://github.com/masci/banks/pull/63 * Stop testing on Python 3.9, introduce Python 3.14 by @masci in https://github.com/masci/banks/pull/64 * feat: Support Documents by @bschloss in https://github.com/masci/banks/pull/66 * feat: Support Video by @bschloss in https://github.com/masci/banks/pull/65  ## New Contributors * @bschloss made their |
| `v2.2.0` | 2025-07-18 | Low | ## What's Changed * feat: implement XML filter for Pydantic/dictionary/deserializable string by @AstraBert in https://github.com/masci/banks/pull/59 * fix: add support for base64 URLs to the image filter by @masci in https://github.com/masci/banks/pull/60   **Full Changelog**: https://github.com/masci/banks/compare/v2.1.3...v2.2.0 |
| `v2.1.3` | 2025-06-27 | Low | ## What's Changed * fix: populate template path when reading the directory index by @masci in https://github.com/masci/banks/pull/57   **Full Changelog**: https://github.com/masci/banks/compare/v2.1.2...v2.1.3 |

## Dependency audit

- **Score**: 77/100
- **Total deps**: 9
- **Resolved**: 3
- **Unresolved**: 6
- **License conflicts**: 0
- **Warnings**: 5
- **Scanned**: 2026-05-25

## Citation

- HTML: https://www.freshcrate.ai/projects/banks
- Markdown: https://www.freshcrate.ai/projects/banks.md
- Dependencies JSON: https://www.freshcrate.ai/api/projects/banks/deps

_Generated by freshcrate.ai. Indexes pypi releases for AI-agent ecosystem packages._
