Skip to main content

A tool for caching prompts and compleation based on embedding

Reason this release was yanked:

critical bug

Project description

PromptCache

A simple-to-use prompt caching optmized for simplicity and speed.

Installation

pip install promptcache

Quickstart

from promptcache import RedisCache

>>> cache = RedisCache()
>>> cache.set("this is a prompt", "this is the completion")
>>> cache.search("this is a prompt")
{'completion': 'this is the completion', 'prompt': 'this is a prompt', 'distance': 0}

>>> cache.search("this is a prompt prompt prompt")
{'completion': 'this is the completion', 'prompt': 'this is a prompt', 'distance': 0.1254}

>>> cache.get("this is a prompt")
'this is the completion'

>>> cache.delete("this is a prompt")
>>> cache.get("this is a prompt")
None 

Features

  1. Simplicity, speed and scalability using redis
  2. Fast embedding base on fastembed
  3. Insturction embedding based on InstructorEmbedding

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

promptcache-0.0.1a1.tar.gz (9.6 kB view hashes)

Uploaded Source

Built Distribution

promptcache-0.0.1a1-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page