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.4.tar.gz (7.3 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.4-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_matched_responses-0.0.4.tar.gz
  • Upload date:
  • Size: 7.3 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.4.tar.gz
Algorithm Hash digest
SHA256 6d0c60b6123924209d9ff10d26cc396d9fb8d3356d086e6129cd4a5e0e348975
MD5 45b83f1334cc1019d982a3e8e14045cd
BLAKE2b-256 4fab2951a9513999a87933971b65883197b3db1ec6dbed2e37bb9f887505766b

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_matched_responses-0.0.4.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.4-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_matched_responses-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 8ea5e38f88c6050ad9f0ee6af4bd6ea47d5877e1e48d7192ebb5a9efbaf0848b
MD5 1ac12de94d20b18088762df24df13bba
BLAKE2b-256 d40283608286f4c043be1769888bcb75f4570c9179235e0ec216354c3076db37

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_matched_responses-0.0.4-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