freshcrate
Skin:/
Home > RAG & Memory > banks

banks

A prompt programming language

Why this rank:Strong adoptionRecent releaseHealthy release cadence

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

Release History

VersionChangesUrgencyDate
main@2026-07-07Latest activity on main branchHigh7/7/2026
2.4.1Imported from PyPI (2.4.1)Low4/21/2026
main@2026-03-09Latest activity on main branchLow3/9/2026
main@2026-03-09Latest activity on main branchLow3/9/2026
main@2026-03-09Latest activity on main branchLow3/9/2026
v2.4.1## 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.1Low2/17/2026
v2.4.0## 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.0Low2/6/2026
v2.3.0## 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 Low1/21/2026
v2.2.0## 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.0Low7/18/2025
v2.1.3## 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.3Low6/27/2025
v2.1.2## What's Changed * fix: fix unknown role error message + other small fixes by @anakin87 in https://github.com/masci/banks/pull/52 * chore: update Chat example in README by @anakin87 in https://github.com/masci/banks/pull/53 * fix: detect multiline text blocks interleaved with image blocks by @masci in https://github.com/masci/banks/pull/55 ## New Contributors * @anakin87 made their first contribution in https://github.com/masci/banks/pull/52 **Full Changelog**: https://github.com/masci/banks/Low4/20/2025
v2.1.1## What's Changed * Update URLs by @fabaff in https://github.com/masci/banks/pull/48 * fix: add platformdirs as dependency by @masci in https://github.com/masci/banks/pull/49 ## New Contributors * @fabaff made their first contribution in https://github.com/masci/banks/pull/48 **Full Changelog**: https://github.com/masci/banks/compare/v2.1.0...v2.1.1Low3/31/2025
v2.1.0## What's Changed * Support string as input for DirectoryPromptRegistry and FilePromptRegistry and documentation correction by @AstraBert in https://github.com/masci/banks/pull/44 * improve content block regex by @logan-markewich in https://github.com/masci/banks/pull/47 ## New Contributors * @AstraBert made their first contribution in https://github.com/masci/banks/pull/44 **Full Changelog**: https://github.com/masci/banks/compare/v2.0.0...v2.1.0Low3/29/2025
v2.0.0## What's Changed * feat: add `variables` property to the Prompt class by @masci in https://github.com/masci/banks/pull/39 * fix: make image filter work outside `{% chat %}` blocks by @masci in https://github.com/masci/banks/pull/38 * [breaking] fix deps again by @logan-markewich in https://github.com/masci/banks/pull/40 * feat: add audio block to chat messages by @masci in https://github.com/masci/banks/pull/41 * feat: add audio filter by @masci in https://github.com/masci/banks/pull/42 Low3/22/2025
v1.8.0## What's Changed * feat: re-introduce support for Python 3.9 by @masci in https://github.com/masci/banks/pull/37 * feat: Make litellm and redis optional dependencies, adding `minimal` extra install option by @logan-markewich in https://github.com/masci/banks/pull/33 ## New Contributors * @logan-markewich made their first contribution in https://github.com/masci/banks/pull/33 **Full Changelog**: https://github.com/masci/banks/compare/v1.7.1...v1.8.0Low3/14/2025
v1.7.1## What's Changed * fix: fix interleaved blocks in chat messages by @masci in https://github.com/masci/banks/pull/32 **Full Changelog**: https://github.com/masci/banks/compare/v1.7.0...v1.7.1Low3/1/2025
v1.7.0## What's Changed * Added assistant support to banks for few shot learning by @ArmykOliva in https://github.com/masci/banks/pull/31 ## New Contributors * @ArmykOliva made their first contribution in https://github.com/masci/banks/pull/31 **Full Changelog**: https://github.com/masci/banks/compare/v1.6.1...v1.7.0Low2/3/2025
v1.6.1## What's Changed * fix: support xml tags inside chat messages by @masci in https://github.com/masci/banks/pull/30 **Full Changelog**: https://github.com/masci/banks/compare/v1.6.0...v1.6.1Low12/31/2024
v1.6.0## What's Changed * chore: remove deprecated 'generate' and 'run_prompt' by @masci in https://github.com/masci/banks/pull/28 * fix: fix function calling with the latest litellm version by @masci in https://github.com/masci/banks/pull/29 **Full Changelog**: https://github.com/masci/banks/compare/v1.5.0...v1.6.0Low12/1/2024
v1.5.0## What's Changed * feat: Add Redis prompt registry by @masci in https://github.com/masci/banks/pull/21 * feat: Add `image` tag filter to support images within a prompt for vision models by @masci in https://github.com/masci/banks/pull/22 * feat: remove deprecated extension `HFInferenceEndpointsExtension` by @masci in https://github.com/masci/banks/pull/23 * fix: adjust to latest litellm changes by @masci in https://github.com/masci/banks/pull/26 * fix colab link in recipe by @masci in httpLow11/25/2024
v1.4.0## What's Changed * feat: Add function calling from `{% completion %}` by @masci in https://github.com/masci/banks/pull/20 **Full Changelog**: https://github.com/masci/banks/compare/v1.3.0...v1.4.0Low10/17/2024
v1.3.0## What's Changed * feat: add completion extension by @masci in https://github.com/masci/banks/pull/19 **Full Changelog**: https://github.com/masci/banks/compare/v1.2.1...v1.3.0Low10/12/2024
v1.2.1## What's Changed * fix: return a single chat message instead of an empty list when template has no `{% chat %}` tags by @masci in https://github.com/masci/banks/pull/18 **Full Changelog**: https://github.com/masci/banks/compare/v1.2.0...v1.2.1Low10/7/2024
v1.2.0## What's Changed * fix: re-add Python 3.10 support by @masci in https://github.com/masci/banks/pull/17 **Full Changelog**: https://github.com/masci/banks/compare/v1.1.0...v1.2.0Low10/6/2024
v1.1.0## What's Changed * feat: add `cache_control` filter to support prompt caching in Anthropic by @masci in https://github.com/masci/banks/pull/16 **Full Changelog**: https://github.com/masci/banks/compare/v1.0.0...v1.1.0Low10/6/2024
v1.0.0## What's Changed * feat: add meta and version to the Prompt class by @masci in https://github.com/masci/banks/pull/12 * feat: add `name` field to Prompt by @masci in https://github.com/masci/banks/pull/13 * refact: new registry api by @masci in https://github.com/masci/banks/pull/14 * feat: Add support for chat messages via custom tag `{% chat %}` by @masci in https://github.com/masci/banks/pull/15 **Full Changelog**: https://github.com/masci/banks/compare/v0.6.0...v1.0.0Low10/3/2024
v0.6.0## What's Changed * feat & bugfix: Added metadata features and fixed naming bug by @mayankjobanputra in https://github.com/masci/banks/pull/11 **Full Changelog**: https://github.com/masci/banks/compare/v0.5.0...v0.6.0Low9/7/2024
v0.5.0## What's Changed * feat: cache prompt rendering by @masci in https://github.com/masci/banks/pull/4 * Added CITATION.cff by @mayankjobanputra in https://github.com/masci/banks/pull/5 * feat: Introduce prompt registry, support versioning in `Prompt.from_template` by @masci in https://github.com/masci/banks/pull/6 * fix python supported versions and added a check for : in template name by @mayankjobanputra in https://github.com/masci/banks/pull/7 * Create a global config object by @masci in Low8/15/2024
v0.4.1## What's Changed * fix: Fix a regression in the `generate` extension. by @masci in https://github.com/masci/banks/pull/3 **Full Changelog**: https://github.com/masci/banks/compare/v0.4.0...v0.4.1Low5/3/2024
v0.4.0## What's Changed * feat: Add canary word support by @masci in https://github.com/masci/banks/pull/2 ## New Contributors * @masci made their first contribution in https://github.com/masci/banks/pull/2 **Full Changelog**: https://github.com/masci/banks/compare/v0.3.1...v0.4.0Low5/2/2024
v0.3.1- Remove debug `print`sLow4/27/2024
v0.3.0- Add `asyncio` supportLow4/27/2024
v0.2.0**Full Changelog**: https://github.com/masci/banks/compare/v0.1.1...v0.2.0Low4/12/2024

Dependencies & License Audit

Loading dependencies...

Similar Packages

ghapiA python client for the GitHub API2.0.3
diff-coverRun coverage and linting reports on diffsv10.4.0
biopythonFreely available tools for computational molecular biology.master@2026-07-20
azure-search-documentsMicrosoft Azure Cognitive Search Client Library for Pythonazure-mgmt-consumption_11.0.0
xgrammarEfficient, Flexible and Portable Structured Generationv0.2.4

More from pypi

markitdownUtility tool for converting various files to Markdown
fastapiFastAPI framework, high performance, easy to learn, fast to code, ready for production
djangoA high-level Python web framework that encourages rapid development and clean, pragmatic design.
flaskA simple framework for building complex web applications.

More in RAG & Memory

edgequakeEdegQuake 🌋 High-performance GraphRAG inspired from LightRag written in Rust; Transform documents into intelligent knowledge graphs for superior retrieval and generation
vllmA high-throughput and memory-efficient inference and serving engine for LLMs
awesome-opensource-aiCurated list of the best truly open-source AI projects, models, tools, and infrastructure.
rust-sdkThe official Rust SDK for the Model Context Protocol