Skip to main content

blockflow

What problem does this solve?

It can be hard to manage prompts and control what happens when you have too many tokens for your context size. This library is designed to help you have more fine grained control over how your prompts change / adapt to different context sizes.

It works similar to how HTML / CSS work together to layout a webpage. CSS styles control what happens when content overflows and control how large elements are within the page. Similarly we might want to control how large each named section of a prompt is within the LLM context.

Let's say you have 3 sections to your prompt.

[ Context ][ Question ][ Answer Prompt]

If you only have a small context window to work with, your prompt will be truncated. The vertical line indicates where truncation happens.

[ LLM Context Size ] [ Context ][ Question ][ Answer| Prompt ]

But in reality you might want to control what content is lost when you need to truncate, e.g. to make sure the answer prompt stays untouched by truncating the right hand side of the context.

[ LLM Context Size ] [ Context| ][ Question ][ Answer Prompt ]

As another example: if you have 10 sections of context, you might want to choose between decreasing each sections size equally or opting to drop a section all together. With blockflow it's easy to experiment with different strategies to make sure you get the behavior you want.

Goals:

  • Make it easy to experiment with how you manage LLM memory
  • Queue Block
  • Compression via LLM summarization
  • Make it easy to control how your prompt is truncated
  • Make it easy to visualize your prompts
  • Make it easy to edit individual sections of your prompt indepedently
  • Make it easy to control where valid truncation points are (chars, tokens, words, sentences, paragraphs, newlines, etc.)
  • Truncation that appends ellipses to indicate content was truncated

Release files for blockflow 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for blockflow 0.0.1
File Size Uploaded
blockflow-0.0.1.tar.gz 1.3 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for blockflow 0.0.1
File Interpreter ABI Platform
blockflow-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.6 MB

Release files / blockflow-0.0.1.tar.gz

Download URL blockflow-0.0.1.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
cd24d18253dd2de99ede16cd7a4974817529c77be7f93032c1ac89c383859392
BLAKE2b-256 checksum
How to use checksums
43266952666360bd73446f3d19081b97879d29325d039b53fef0c282b44811cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.6 Linux/6.8.0-76060800daily20240311-generic

Release files / blockflow-0.0.1-py3-none-any.whl

Download URL blockflow-0.0.1-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
8bb61725798d28d941f994c3dc59d56bbbc112165b4be477f6456314e464b2e0
BLAKE2b-256 checksum
How to use checksums
48e3763a545f7136a15ebf6dde2d081c9effb976581f06c9bdc8664a864d9487
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.10.6 Linux/6.8.0-76060800daily20240311-generic

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page