Mock LLM Target (targets/mock.py)

AI-Infra-Guard · Research/pikit/pikit/targets/mock.py · python · Apache-2.0
testing, ai, tag:embed-classified, tag:offline, tag:target

An offline echo target used as a deterministic test fixture for LLM integrations, avoiding network calls, API keys, and token costs.

# Source: https://github.com/Tencent/AI-Infra-Guard | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
"""An offline echo target — a **test fixture**, not a demo backend.

This target only echoes its input and never executes an injection, so it
**cannot demonstrate whether an attack works** — using it to "show" an attack
would misrepresent results. Its sole purpose is the offline test suite:
deterministic, no API key, no network, no token cost. To actually observe an
attack against an agent, use a real model via :func:`~pikit.targets.get_target`
(``openai:`` / ``anthropic:`` / ``hf:``); see ``demos/live_matrix``.

The :meth:`chat` method supports two offline modes so the function-call

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key