Skip to main content

superred-target-chatbot

A general chatbot target for the superred red-teaming framework: it wraps any LLM reachable through litellm as a single-turn or multi-turn chatbot under test, exposing its system prompt, user message, response, and model identity as controllables/observables.

Install

pip install superred-target-chatbot
# for AWS Bedrock providers:
pip install "superred-target-chatbot[bedrock]"

Usage

from chatbot_target import ChatbotTarget, USER_TAG

target = ChatbotTarget(model="gpt-4o-mini", api_base="https://api.openai.com/v1", api_key="sk-...")

Optional keyword arguments bound the provider call: request_timeout (default 120s, passed to every call because litellm's own default is 600-6000s), max_attempts / retry_backoff_s / retry_max_elapsed_s (bounded retries, for transient failures only), and max_consecutive_invalid (how many unusable injected messages in a row end the run).

Turn outcomes

Every victim turn ends in exactly one recorded outcome. A turn that produced no victim text leaves last_response empty and appends nothing to the conversation sent to the provider: the target never invents a reply, and never puts an empty assistant turn on the wire (providers either delete it, silently merging the attacker's surrounding messages, or reject it outright).

outcome what happened trace
ok the victim replied with text --
empty the victim replied with a blank string response_empty observable
blocked a provider content filter suppressed the reply response_blocked observable, blocked_turns, last_block_reason
no_content the provider returned no content field at all, after retries response_missing observable
invalid_injection the injected user message was None, not a string, or blank, so nothing was sent invalid_user_message observable

Anything else -- a transient failure that survives the retries, or a persistent one (auth, context window, malformed request) -- propagates and errors the task, because those are infrastructure failures and must stay loud. A retried attempt emits a response_retry observable at the system tag, so a turn that cost three provider calls is never invisible.

Because the target does not fabricate, last_response alone cannot tell these apart: empty, blocked, no_content and invalid_injection all leave it empty. Use the last_turn_outcome, turn_outcomes and turns_completed queries. In particular a task should abstain rather than score 0.0 when last_turn_outcome == "no_content" or turns_completed == "0": those runs contain no victim reply to judge.

Credits / upstream

Original work of the superred project, released under the MIT License (see LICENSE). It contains no third-party code and no bundled datasets. It reaches models through litellm (MIT) and, optionally, AWS Bedrock via boto3 (Apache-2.0), both ordinary pip dependencies.

License

MIT

Download files

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

Source Distribution

superred_target_chatbot-0.2.0.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

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

superred_target_chatbot-0.2.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

Details for the file superred_target_chatbot-0.2.0.tar.gz.

File metadata

  • Download URL: superred_target_chatbot-0.2.0.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for superred_target_chatbot-0.2.0.tar.gz
Algorithm Hash digest
SHA256 349168567748e1ffff8d52aeb956d3ad4195e2f9cd28ebaa4e0181641b3c21fc
MD5 fe6388f0269678328ce0a47c2c7b92e1
BLAKE2b-256 b857e710615e92be6e00dfb77d520094bc9496b82eabaf35a42b459757da15be

See more details on using hashes here.

Provenance

The following attestation bundles were made for superred_target_chatbot-0.2.0.tar.gz:

Publisher: release.yml on RoldSI/superred-modules

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

File details

Details for the file superred_target_chatbot-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for superred_target_chatbot-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 461a59bced58b8b49d6a79e08cffbd0126069eaba59285ef57735ee219988aa1
MD5 0b45a0a19272943d235a53c6e57c711b
BLAKE2b-256 a2ffd6feb76d578cc3930c20a6793df1315bc6004b06646c4bf120a60300cc0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for superred_target_chatbot-0.2.0-py3-none-any.whl:

Publisher: release.yml on RoldSI/superred-modules

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

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page