{"id":28423043,"url":"https://github.com/mldangelo/redteam-chatbot","last_synced_at":"2025-06-24T13:30:32.063Z","repository":{"id":296295005,"uuid":"992901323","full_name":"mldangelo/redteam-chatbot","owner":"mldangelo","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-29T23:06:58.000Z","size":101,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-16T23:53:16.698Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mldangelo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-29T22:26:14.000Z","updated_at":"2025-05-30T15:37:34.000Z","dependencies_parsed_at":"2025-05-29T23:40:18.061Z","dependency_job_id":null,"html_url":"https://github.com/mldangelo/redteam-chatbot","commit_stats":null,"previous_names":["mldangelo/redteam-chatbot"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mldangelo/redteam-chatbot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mldangelo%2Fredteam-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mldangelo%2Fredteam-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mldangelo%2Fredteam-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mldangelo%2Fredteam-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mldangelo","download_url":"https://codeload.github.com/mldangelo/redteam-chatbot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mldangelo%2Fredteam-chatbot/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261685201,"owners_count":23194070,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-05T07:39:26.155Z","updated_at":"2025-06-24T13:30:32.044Z","avatar_url":"https://github.com/mldangelo.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# redteam-chatbot (Red teaming a Multi-turn Chatbot)\n\nYou can run this example with:\n\n```bash\nnpx promptfoo@latest init --example redteam-chatbot\n```\n\n## Introduction\n\nThis example demonstrates how to test a stateless chatbot for security vulnerabilities using promptfoo's multi-turn strategies. It includes a Node.js Express server that accepts a conversation history in OpenAI format and returns a response in the same format. It leverages promptfoo's [goat](https://www.promptfoo.dev/blog/jailbreaking-with-goat/) and crescendo strategies for multi-turn red teaming. You can learn more about configuring these strategies [here](https://www.promptfoo.dev/docs/red-team/strategies/multi-turn/).\n\n## Setup\n\n### Installation\n\n1. Install dependencies:\n\n```bash\nnpm install\n```\n\n2. Set your OpenAI API key:\n\n```bash\nexport OPENAI_API_KEY=your-api-key-here\n```\n\n3. Start the server:\n\n```bash\nnpm start\n```\n\n## Running Tests\n\n```bash\n# Generate test cases\npromptfoo redteam generate\n\n# Execute evaluation\npromptfoo redteam eval\n\n# View results\npromptfoo view\n```\n\n## Node.js Webserver Example Usage\n\n### Single Message Request\n\n```bash\ncurl -X POST http://localhost:2345/chat \\\n    -H \"Content-Type: application/json\" \\\n    -H \"Authorization: Bearer your-token-here\" \\\n    -d '{\n        \"api_provider\": \"openai\",\n        \"chat_history\": [\n            {\"role\": \"user\", \"content\": \"Tell me about your turboencabulator models\"}\n        ]\n    }'\n```\n\n### Multi-turn Conversation\n\n```bash\ncurl -X POST http://localhost:2345/chat \\\n    -H \"Content-Type: application/json\" \\\n    -H \"Authorization: Bearer your-token-here\" \\\n    -d '{\n        \"api_provider\": \"openai\",\n        \"chat_history\": [\n            {\"role\": \"user\", \"content\": \"Tell me about your turboencabulator models\"},\n            {\"role\": \"assistant\", \"content\": \"TurboTech offers several turboencabulator models...\"},\n            {\"role\": \"user\", \"content\": \"What maintenance does it require?\"}\n        ]\n    }'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmldangelo%2Fredteam-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmldangelo%2Fredteam-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmldangelo%2Fredteam-chatbot/lists"}