Skip to main content

Check whether you've already run this prompt before calling the LLM

Project description

llm-cache

PyPI Changelog Tests License

Check whether you've already run this prompt before calling the LLM

Installation

Install this plugin in the same environment as LLM.

llm install llm-cache-plugin

Usage

This plugin add a --cache flag to llm prompt.

If --cache is specified, the plugin will search your llm database for a previously-saved response for this prompt-system-model combination. If it is found, it returns that text, saving you time and money. If not, it passes off to the regular llm prompt command.

llm 'How many rs are in strawberry? Think very hard.'
> There are 2 'R's in strawberry

Took 3.01s user 1.45s system 104% cpu 4.280 total

llm --cache 'How many rs are in strawberry? Think very hard.'
> There are 2 'R's in strawberry

Took 2.83s user 1.50s system 152% cpu 2.836 total

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-cache
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

llm install -e '.[test]'

To run the tests:

pytest

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

llm_cache_plugin-0.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

llm_cache_plugin-0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file llm_cache_plugin-0.1.tar.gz.

File metadata

  • Download URL: llm_cache_plugin-0.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_cache_plugin-0.1.tar.gz
Algorithm Hash digest
SHA256 6869ca12bd54ceb5016b9385faee41c775092039dcace8d2ae00fe88414b4996
MD5 f0ffe129eb3f6d64f8e56b44bc420870
BLAKE2b-256 1534169dbde5251933f896f3ce84d7346b3f6320e56d2c389209f675d05af5b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_cache_plugin-0.1.tar.gz:

Publisher: publish.yml on kevinschaul/llm-cache-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_cache_plugin-0.1-py3-none-any.whl.

File metadata

  • Download URL: llm_cache_plugin-0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_cache_plugin-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 71ce46667d100cdd1d3103141bd59f06fcdb6745ca66003087b211f595af357b
MD5 fc2f506d7f19532d25cb3109c39c8287
BLAKE2b-256 2c96ac8ef9aa2445b92c7e4a81b288438c80b9966cc87bb2c811045a2872db11

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_cache_plugin-0.1-py3-none-any.whl:

Publisher: publish.yml on kevinschaul/llm-cache-plugin

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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