promptcache


Namepromptcache JSON
Version 0.0.1a1 PyPI version JSON
download
home_page
SummaryA tool for caching prompts and compleation based on embedding
upload_time2024-01-12 10:09:51
maintainer
docs_urlNone
authorxdssio
requires_python>=3.9,<4.0
licenseBSD-3-Clause
keywords machine-learning llm embedding prompt redis
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PromptCache

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

## Installation

```bash
pip install promptcache
```

## Quickstart

```python
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](https://redis.io)
2. Fast embedding base on [fastembed](https://github.com/qdrant/fastembed)
3. Insturction embedding based on [InstructorEmbedding](https://github.com/xlang-ai/instructor-embedding) 

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "promptcache",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9,<4.0",
    "maintainer_email": "",
    "keywords": "machine-learning,llm,embedding,prompt,redis",
    "author": "xdssio",
    "author_email": "yonatana@lasso.security",
    "download_url": "https://files.pythonhosted.org/packages/83/c3/164473d9e2595e42e12a117f49dff29724ea150ff3817b2cf9174b99ffe5/promptcache-0.0.1a1.tar.gz",
    "platform": null,
    "description": "# PromptCache\n\nA simple-to-use prompt caching optmized for simplicity and speed.\n\n## Installation\n\n```bash\npip install promptcache\n```\n\n## Quickstart\n\n```python\nfrom promptcache import RedisCache\n\n>>> cache = RedisCache()\n>>> cache.set(\"this is a prompt\", \"this is the completion\")\n>>> cache.search(\"this is a prompt\")\n{'completion': 'this is the completion', 'prompt': 'this is a prompt', 'distance': 0}\n\n>>> cache.search(\"this is a prompt prompt prompt\")\n{'completion': 'this is the completion', 'prompt': 'this is a prompt', 'distance': 0.1254}\n\n>>> cache.get(\"this is a prompt\")\n'this is the completion'\n\n>>> cache.delete(\"this is a prompt\")\n>>> cache.get(\"this is a prompt\")\nNone \n\n```\n\n# Features\n1. Simplicity, speed and scalability using [redis](https://redis.io)\n2. Fast embedding base on [fastembed](https://github.com/qdrant/fastembed)\n3. Insturction embedding based on [InstructorEmbedding](https://github.com/xlang-ai/instructor-embedding) \n",
    "bugtrack_url": null,
    "license": "BSD-3-Clause",
    "summary": "A tool for caching prompts and compleation based on embedding",
    "version": "0.0.1a1",
    "project_urls": null,
    "split_keywords": [
        "machine-learning",
        "llm",
        "embedding",
        "prompt",
        "redis"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a3a1af9fde47028778b71816fcef161a48b40656ec5abf091243f350dc567f44",
                "md5": "f67d0ed9cc01dc057d05bf58d3eaa81b",
                "sha256": "e3d95bed856d7bd4b89e2eaf36a6fc3dce5c53ee7ca9dfbfb2c0c2aa4dfe1ef1"
            },
            "downloads": -1,
            "filename": "promptcache-0.0.1a1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f67d0ed9cc01dc057d05bf58d3eaa81b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9,<4.0",
            "size": 10749,
            "upload_time": "2024-01-12T10:09:49",
            "upload_time_iso_8601": "2024-01-12T10:09:49.734648Z",
            "url": "https://files.pythonhosted.org/packages/a3/a1/af9fde47028778b71816fcef161a48b40656ec5abf091243f350dc567f44/promptcache-0.0.1a1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "83c3164473d9e2595e42e12a117f49dff29724ea150ff3817b2cf9174b99ffe5",
                "md5": "e6f2192f76ce70ebfc764fad5c764ba5",
                "sha256": "a285080b9e9aafff29a50a36529f78dde8a9e66ba9de99cdea0f01decc3b16ec"
            },
            "downloads": -1,
            "filename": "promptcache-0.0.1a1.tar.gz",
            "has_sig": false,
            "md5_digest": "e6f2192f76ce70ebfc764fad5c764ba5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9,<4.0",
            "size": 9581,
            "upload_time": "2024-01-12T10:09:51",
            "upload_time_iso_8601": "2024-01-12T10:09:51.601248Z",
            "url": "https://files.pythonhosted.org/packages/83/c3/164473d9e2595e42e12a117f49dff29724ea150ff3817b2cf9174b99ffe5/promptcache-0.0.1a1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-12 10:09:51",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "promptcache"
}
        
Elapsed time: 2.92111s