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 details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file promptcache-0.0.1a1.tar.gz.

File metadata

  • Download URL: promptcache-0.0.1a1.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/23.0.0

File hashes

Hashes for promptcache-0.0.1a1.tar.gz
Algorithm Hash digest
SHA256 a285080b9e9aafff29a50a36529f78dde8a9e66ba9de99cdea0f01decc3b16ec
MD5 e6f2192f76ce70ebfc764fad5c764ba5
BLAKE2b-256 83c3164473d9e2595e42e12a117f49dff29724ea150ff3817b2cf9174b99ffe5

See more details on using hashes here.

File details

Details for the file promptcache-0.0.1a1-py3-none-any.whl.

File metadata

  • Download URL: promptcache-0.0.1a1-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.11.4 Darwin/23.0.0

File hashes

Hashes for promptcache-0.0.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 e3d95bed856d7bd4b89e2eaf36a6fc3dce5c53ee7ca9dfbfb2c0c2aa4dfe1ef1
MD5 f67d0ed9cc01dc057d05bf58d3eaa81b
BLAKE2b-256 a3a1af9fde47028778b71816fcef161a48b40656ec5abf091243f350dc567f44

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