Synthesizers
Generate test sets for evaluating LLM applications. Synthesizers use an LLM to create test cases from prompts, configurations, or source documents.
All synthesizers accept a model parameter to customize the LLM used for generation. See Models for available options and configuration.
Quick Start
Adversarial-only generation
Set harmful=True when you want the synthesizer prompt to generate adversarial attack tests only. This removes the default harmless category mix and asks the model to focus on harmful, manipulative, or policy-violating inputs.
OWASPSynthesizer enables adversarial-only generation by default. For general-purpose synthesizers, pass harmful=True explicitly.
Available Synthesizers
PromptSynthesizer
The simplest option. Provide a prompt describing what to test. When no model is provided, the default Rhesis model is used.
Synthesizer
Full control over generation with requirements, categories, and topics.
ConfigSynthesizer
Use a configuration object for reusable test generation settings.
ContextSynthesizer
Generate tests grounded in specific context provided at runtime.
OWASPSynthesizer
Generate red-team tests aligned with the OWASP LLM Top 10. Use this when you want security-focused prompts tailored to the purpose of your application instead of a generic adversarial prompt list.
OWASPSynthesizer always creates harmful single-turn tests. It spreads num_tests
across the selected OWASP categories and tags each test with
metadata["owasp_category"] and metadata["owasp_name"].
The synthesizer downloads the selected report when generate() first runs, splits
the PDF into risk sections, and uses the official section text as generation
context. It does not use a hardcoded attack list.
| Parameter | Default | Description |
|---|---|---|
purpose | Required | What the system under test does; used to tailor every attack |
report_url | OWASP LLM Top 10 v2025 PDF | Direct URL to a compatible OWASP Top 10 report |
categories | All report sections | Section IDs to include, such as ["llm01", "llm07"] |
subsection_exclusions | DEFAULT_SUBSECTION_EXCLUSIONS | Headings to remove from each section; pass an empty collection to retain all subsections |
batch_size | 10 | Maximum attacks generated per model call for each section |
model | Default Rhesis model | Model name or BaseLLM used for generation |
requirement | "OWASP LLM Top 10" | Requirement label stored on generated tests for analytics |
Use the Agentic Top 10 report by changing both the report and the requirement label:
| Category ID | OWASP category |
|---|---|
llm01 | Prompt Injection |
llm02 | Sensitive Information Disclosure |
llm03 | Supply Chain Vulnerabilities |
llm04 | Data and Model Poisoning |
llm05 | Improper Output Handling |
llm06 | Excessive Agency |
llm07 | System Prompt Leakage |
llm08 | Vector and Embedding Weaknesses |
llm09 | Misinformation |
llm10 | Unbounded Consumption |
OWASP generation uses an LLM to create fresh attacks for each run. For high-risk adversarial testing, pair these tests with a suitable generation model and review outputs before running them against production systems.
Using Source Documents
Synthesizers can extract content from documents, websites, text snippets, and images to generate contextually relevant tests.
Image sources
SourceType.IMAGE supports local image paths and image URLs. Without a vision-capable model, extraction falls back to metadata available through MarkItDown. Pass a model to enable vision-based image descriptions.
For uploaded test attachments, images are extracted first, documents use their text layer first, and image-heavy documents fall back to a vision model when one is configured.
Chunking strategies for source-based generation
When you pass sources to a synthesizer, Rhesis chunks extracted content before generation.
Chunking defaults to RecursiveChunker(chunk_size=1500) when no custom strategy is provided.
Choose a chunking strategy
| Strategy | Best for | Key behavior |
|---|---|---|
TokenChunker | Uniform chunk sizes and strict token budgets | Splits by token count with optional overlap |
SentenceChunker | Readability-focused chunks | Preserves sentence boundaries while respecting token limits |
RecursiveChunker | Long structured content (docs, markdown, policies) | Splits on large-to-small delimiters recursively |
Example: pass a custom chunker
Recipe-based recursive chunking
RecursiveChunker also supports recipe presets:
SemanticChunker is deprecated and now aliases RecursiveChunker for backward compatibility.
Prefer RecursiveChunker for new code.
Pushing Test Sets to Rhesis
Push generated test sets to the Rhesis platform for analysis, tracking, and collaboration.
Requirements: A Rhesis account and API key. Set your credentials via environment variables or configuration.
Call test_set.push() to upload. Your test set will appear in Testing → Test Sets.