Skip to main content

GPT-OSS red-teaming pipeline and harness (OpenAI-compatible)

Project description

GPT-OSS Tool-Call Harness (HF Inference)

This repo runs prompts against openai/gpt-oss-20b:groq (or any OpenAI-compatible HF model), supplies a set of fake tools, captures when the model attempts tool-calls, then simulates tool failures and logs the follow-up response.

Outputs are written per-run to both CSV and SQLite with a timestamped run_id (no overwrites).

What it does

  • Fake tools (subset): email_send, web_search, payroll_update, calendar_schedule_meeting, slack_post_message, github_create_issue, jira_create_ticket, db_sql_query, filesystem_read_file, payment_process, wiki_search, fetch_url, feature_flag_toggle, s3_list_objects, notion_update_page, twilio_send_sms, zoom_create_meeting, drive_search_files in src/tool_schemas.py.
  • Initial turn: Sends your prompt with tools=... and records any tool calls.
  • Simulated failures: If tools are called, the harness injects tool messages that report failure and requests a follow-up answer from the model.
  • Logging:
    • CSV files: data/logs/run_<run_id>_interactions.csv, data/logs/run_<run_id>_tool_calls.csv
    • SQLite DB: data/logs/run_<run_id>.db (tables: runs, interactions, tool_calls)

Setup

  1. Python 3.10+
  2. Install deps
    python -m venv .venv
    # Windows PowerShell activation: .venv\\Scripts\\Activate.ps1
    pip install -r requirements.txt
    
  3. Add your HF Inference token
    • Copy .env.example to .env
    • Set HF_TOKEN=...

Run

  • Using sample prompts (console script):

    ossrt-harness --prompts-file prompts/examples.jsonl \
        --model openai/gpt-oss-20b:groq \
        --base-url https://router.huggingface.co/v1 \
        --temperature 0.2 --top-p 1.0 \
        --notes "smoke"
    
  • Override system prompt with a local file:

    ossrt-harness --system-prompt-file prompts/system.txt
    
  • Note: --cot is deprecated (no-op). GPT-OSS emits reasoning via Harmony channels automatically.

Inspect outputs

  • CSVs in data/logs/
  • SQLite database data/logs/run_<run_id>.db with tables:
    • runs(run_id, created_at, model, base_url, tools_json, prompts_file, notes, temperature, top_p)
    • interactions(run_id, prompt_idx, phase, role, content, tool_calls_json, raw_json, finish_reason, prompt_tokens, completion_tokens)
    • tool_calls(run_id, prompt_idx, call_idx, tool_call_id, name, arguments_json)

Notes

  • This harness does not execute tools. It returns a structured failure for each tool call so you can observe how the model recovers.
  • Some providers return old-style function_call instead of tool_calls. The harness supports both.
  • Chain-of-thought flags (--cot) are deprecated and have no effect. GPT-OSS emits reasoning via Harmony channels (analysis/final).

Customization

  • Add/edit tools in src/tool_schemas.py.
  • Provide your own prompts via .jsonl, .json, or .txt.
  • Extend logging or add new export formats as needed.

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

oss_redteam-0.1.1.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

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

oss_redteam-0.1.1-py3-none-any.whl (18.3 kB view details)

Uploaded Python 3

File details

Details for the file oss_redteam-0.1.1.tar.gz.

File metadata

  • Download URL: oss_redteam-0.1.1.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for oss_redteam-0.1.1.tar.gz
Algorithm Hash digest
SHA256 30a3b4c8e2c02216a8dbe340c5b6ed66565828155f1e1482803d928a8cbdc63d
MD5 85fee23736be21bdd1ce605aecae9f28
BLAKE2b-256 7d6de6ae4ae47fa795cd6e3d05b2006dc9e8b31d207e544699666a0fb3d2fed1

See more details on using hashes here.

File details

Details for the file oss_redteam-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: oss_redteam-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 18.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for oss_redteam-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a92755c916cf672e6bd037e478b202921537a72715b030145523be6552162d37
MD5 42f53d557b1e7e1e5487a08a3b40debc
BLAKE2b-256 e161fc4316820403db0ee6524c676f885f759bc17ce123e95e96405b8d24b558

See more details on using hashes here.

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