Skip to main content

An llm plugin that provides a matched-responses model for testing - returns configurable responses based on input patterns

Project description

llm-matched-responses

An llm plugin that provides a matched-responses model for testing. Returns configurable responses based on input patterns, so you can test LLM-based systems without real API keys.

Installation

llm install llm-matched-responses

Usage

# Default: echoes back the input
llm -m matched-responses "Hello world"
# Output: Echo: Hello world

# Static response for all inputs (via env var)
LLM_MATCHED_RESPONSE="Fixed reply" llm -m matched-responses "anything"
# Output: Fixed reply

# Substring-matched responses from a JSON file
echo '{"hello": "Hi there!", "help": "I can help."}' > responses.json
LLM_MATCHED_RESPONSES_FILE=responses.json llm -m matched-responses "hello world"
# Output: Hi there!

Response resolution order

  1. LLM_MATCHED_RESPONSE env var: if set, always return this exact string
  2. LLM_MATCHED_RESPONSES_FILE env var: path to a JSON file mapping input substrings to responses. The first matching key wins.
  3. Default: returns "Echo: <input>" (or "Echo: (empty message)" for empty input)

Responses file format

{
    "hello": "Hello! I am the test model.",
    "help": "I am a test model that returns matched responses.",
    "code": "Here is some code:\n```python\nprint('hello')\n```"
}

Keys are matched as substrings of the user's message. The first match wins.

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

llm_matched_responses-0.0.3.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

llm_matched_responses-0.0.3-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file llm_matched_responses-0.0.3.tar.gz.

File metadata

  • Download URL: llm_matched_responses-0.0.3.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for llm_matched_responses-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b43f62f1d61ee7d0347e4bcc8ff07437a31732846879c591d267d313b88fdca4
MD5 3991891be92d49c2410a3bca2c50553a
BLAKE2b-256 bddeb191b5e92e3032bbd704970a4084d2a9b244c7503a91ca771a9b45637fbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_matched_responses-0.0.3.tar.gz:

Publisher: publish.yml on imbue-ai/llm-matched-responses

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_matched_responses-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_matched_responses-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3f73712c38ef39e26382fc1eda1db212bc3cbf93af5911057a20d06ee4e1c82a
MD5 c8ff622b4a6396283407cec3f4579999
BLAKE2b-256 789ebaffde28a2515b5f44fd675bbf6bb08b482f0d7d04da533cebaa9cccc398

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_matched_responses-0.0.3-py3-none-any.whl:

Publisher: publish.yml on imbue-ai/llm-matched-responses

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