Catalog PyPI
PACKAGE EXPLORERView in registry

aibreaker

PyPI

Official Python SDK for AI Breaker Lab

adversarialaievaluationllmtesting
Versions collected1
Direct dependencies6From release 0.1.0
Last observed21 Oct, 10:03 UTC

README

Version 0.1.0 documentation

aibreaker

Official Python SDK for AI Breaker Lab.

Install

pip install aibreaker

Quick start

from aibreaker import BreakerClient

client = BreakerClient(
    api_key="client_key",
    groq_api_key="gsk_...",   # forwarded to backend for test generation + judging
)

report = client.break_model(
    target={
        "type":       "openai",
        "base_url":   "https://api.openai.com",
        "api_key":    "sk-...",
        "model_name": "gpt-4o-mini",
    },
    description="Customer-support chatbot for an e-commerce platform",
    num_tests=20,
    fail_threshold=5.0,
)

print(report)
# Report a3f8b2c1  ✓ PASSED
#   Score         : 7.40 / 10
#   Failures      : 3 / 20
#   Hallucinations: 1
#   Agreement     : 100%
#   Red flags     : 0

if not report.passed:
    for f in report.failures:
        print(f"  ✗ [{f.test_type}] score={f.score}  {f.question}")
    raise SystemExit(1)

Supported target types

TypeRequired fields
openaibase_url, api_key, model_name
huggingfacerepo_id, api_token
webhookendpoint_url, payload_template
langchainchain_import_path, invoke_key

Works with any OpenAI-compatible endpoint: Groq, Gemini, vLLM, Ollama, etc.

LangChain example

target = {
    "type": "langchain",
    "chain_import_path": "my_module.my_chain",  # must be importable by the backend
    "invoke_key": "question",
}

Report object

AttributeTypeDescription
report.scorefloatAverage weighted score (0–10)
report.passedboolTrue when score >= fail_threshold
report.failurestuple[FailedTest]Tests the model failed
report.failure_countintNumber of failed tests
report.hallucination_countintHallucinations detected
report.metricsMetricsFull metrics object
report.metrics.judges_agreementfloatJudge agreement rate 0–1
report.metrics.red_flagstuple[str]Auto-detected issues
report.html_report_urlstr | NoneURL to HTML report

Error handling

All SDK calls raise BreakerError when the backend returns a non-2xx response (e.g. 401/429/5xx) or when polling fails (timeouts, network errors).

from aibreaker import BreakerClient, BreakerError

client = BreakerClient(
    api_key="client_key",
    endpoint="https://llm-eval-engine-production.up.railway.app",
    poll_interval=5,  # seconds between GET /report/{id}
    timeout=600,      # total seconds to wait before giving up
)

try:
    report = client.break_model(
        target={
            "type": "openai",
            "base_url": "https://api.openai.com",
            "api_key": "sk-...",
            "model_name": "gpt-4o-mini",
        },
        description="Customer-support chatbot for an e-commerce platform",
        num_tests=20,
    )
except BreakerError as e:
    print(f"BreakerError: {e}")
    raise

print(report.score, report.passed)
SituationExceptionHow to handle
Invalid API keyBreakerError (401)Check your api_key
Rate limitedBreakerError (429)Reduce num_tests or wait
Job timed outBreakerErrorIncrease timeout= param
Backend unreachableBreakerErrorCheck endpoint= URL

timeout and poll_interval are set on BreakerClient(...). Increase timeout for long-running jobs (large num_tests, slow target, heavy load). Decrease poll_interval if you want more frequent status checks, but keep it reasonable to avoid extra load and 429s.

CI / CD

See the aibreaker GitHub Action for one-step CI integration.

- uses: your-org/aibreaker-action@v1
  with:
    api_key: ${{ secrets.BREAKER_API_KEY }}
    groq_api_key: ${{ secrets.GROQ_API_KEY }}
    endpoint: https://llm-eval-engine-production.up.railway.app
    description: "Customer support chatbot"
    fail_threshold: "5.0"

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.013 Mar 20266

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
eslampaysky/llm-eval-engine

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 10:03 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:f0e8546057f9f91e8c8a8949b68827f49d7808ff2e091d9bba0d006bc72ac0f3