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
- Simplicity, speed and scalability using redis
- Fast embedding base on fastembed
- Insturction embedding based on InstructorEmbedding
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a285080b9e9aafff29a50a36529f78dde8a9e66ba9de99cdea0f01decc3b16ec
|
|
| MD5 |
e6f2192f76ce70ebfc764fad5c764ba5
|
|
| BLAKE2b-256 |
83c3164473d9e2595e42e12a117f49dff29724ea150ff3817b2cf9174b99ffe5
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3d95bed856d7bd4b89e2eaf36a6fc3dce5c53ee7ca9dfbfb2c0c2aa4dfe1ef1
|
|
| MD5 |
f67d0ed9cc01dc057d05bf58d3eaa81b
|
|
| BLAKE2b-256 |
a3a1af9fde47028778b71816fcef161a48b40656ec5abf091243f350dc567f44
|