Synthesizers
Generate test sets for evaluating LLM applications. Synthesizers use LLMs to create diverse, targeted test cases based on 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
With a specified model:
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 behaviors, 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. The generator spreads
num_tests as evenly as possible across the selected OWASP categories and tags
each generated test with metadata["owasp_category"] and metadata["owasp_name"].
| Category ID | OWASP category | Rhesis behavior |
|---|---|---|
llm01 | Prompt Injection | Robustness |
llm02 | Sensitive Information Disclosure | Compliance |
llm03 | Supply Chain Vulnerabilities | Reliability |
llm04 | Data and Model Poisoning | Reliability |
llm05 | Improper Output Handling | Compliance |
llm06 | Excessive Agency | Robustness |
llm07 | System Prompt Leakage | Compliance |
llm08 | Vector and Embedding Weaknesses | Reliability |
llm09 | Misinformation | Reliability |
llm10 | Unbounded Consumption | Robustness |
You can inspect the registry programmatically with OWASP_LLM_TOP_10:
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, the execution pipeline uses the shared extract_with_vision_fallback path: images go through image extraction first, documents use their text layer first, and image-heavy documents can fall back to a vision model when one is configured.
Chunking strategies for source-based generation (v0.6.11)
When you pass sources to a synthesizer, Rhesis chunks extracted content before generation. In
v0.6.11, chunking is powered by chonkie and 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.