Skip to main content

prompt management for llms

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

blockflow-0.0.1.tar.gz (1.3 MB view details)

Uploaded Source

Built Distribution

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

blockflow-0.0.1-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file blockflow-0.0.1.tar.gz.

File metadata

  • Download URL: blockflow-0.0.1.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/6.8.0-76060800daily20240311-generic

File hashes

Hashes for blockflow-0.0.1.tar.gz
Algorithm Hash digest
SHA256 cd24d18253dd2de99ede16cd7a4974817529c77be7f93032c1ac89c383859392
MD5 7b8c77eaebb9f64ea890d002fcc50de4
BLAKE2b-256 43266952666360bd73446f3d19081b97879d29325d039b53fef0c282b44811cb

See more details on using hashes here.

File details

Details for the file blockflow-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: blockflow-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/6.8.0-76060800daily20240311-generic

File hashes

Hashes for blockflow-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8bb61725798d28d941f994c3dc59d56bbbc112165b4be477f6456314e464b2e0
MD5 ccef755d86b3c981da71ca7d26c857fa
BLAKE2b-256 48e3763a545f7136a15ebf6dde2d081c9effb976581f06c9bdc8664a864d9487

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