Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions docs/howtos.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,26 +104,29 @@ print(test_result_dict)

## Helper Functions

### `print_preset_tests_params_example`
### `print_test_preset`
Prints example configuration for presets to the console.

Available presets: `all`, `eng`, `llm`, `owasp:llm01`, `owasp:llm07`, `owasp:llm09`, `rus`, `vlm`

**Usage:**

```python
from llamator import print_preset_tests_params_example
from llamator import print_test_preset

# Print configuration for all available tests
print_preset_tests_params_example("all")
print_test_preset("all")
```

### `get_preset_tests_params_example`
### `get_test_preset`
Returns a string containing example configurations for presets.

**Usage:**
```python
from llamator import get_preset_tests_params_example
from llamator import get_test_preset

# Get example for all available tests
all_tests_preset = get_preset_tests_params_example("all")
all_tests_preset = get_test_preset("all")
print(all_tests_preset)
```

Expand Down
46 changes: 23 additions & 23 deletions examples/llamator-api.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
]
},
{
"cell_type": "code",
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-29T09:44:45.903323Z",
"start_time": "2025-05-29T09:44:44.049249Z"
"end_time": "2025-07-06T13:58:57.453098Z",
"start_time": "2025-07-06T13:58:57.059519Z"
}
},
"cell_type": "code",
"source": [
"%pip install llamator python-dotenv requests --upgrade --quiet\n",
"%pip show llamator"
Expand All @@ -26,12 +26,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n",
"Name: llamator\r\n",
"Version: 3.2.0\r\n",
"Version: 3.3.0\r\n",
"Summary: Framework for testing vulnerabilities of GenAI systems.\r\n",
"Home-page: \r\n",
"Author: \r\n",
"Home-page: https://github.com/LLAMATOR-Core/llamator\r\n",
"Author: Roman Neronov, Timur Nizamov, Nikita Ivanov\r\n",
"Author-email: \r\n",
"License: Attribution 4.0 International\r\n",
"Location: /Users/roman/Projects/PycharmProjects/LLAMATORS/llamator/src\r\n",
Expand All @@ -41,19 +40,17 @@
]
}
],
"execution_count": 6
"execution_count": 1
},
{
"cell_type": "code",
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-29T10:23:28.569845Z",
"start_time": "2025-05-29T10:23:22.843545Z"
"end_time": "2025-07-06T13:59:05.673837Z",
"start_time": "2025-07-06T13:59:05.671992Z"
}
},
"source": [
"import llamator"
],
"cell_type": "code",
"source": "import llamator",
"outputs": [],
"execution_count": 3
},
Expand Down Expand Up @@ -181,8 +178,8 @@
]
},
{
"cell_type": "markdown",
"metadata": {},
"cell_type": "markdown",
"source": [
"## Start testing\n",
"\n",
Expand All @@ -192,20 +189,18 @@
"\n",
"### Available Attacks\n",
"\n",
"Check out the `llamator.print_preset_tests_params_example(\"all\")` and [documentation](https://LLAMATOR-Core.github.io/llamator/attack_descriptions.html)."
"Check out the `llamator.print_test_preset(\"all\")` and [documentation](https://LLAMATOR-Core.github.io/llamator/attack_descriptions.html)."
]
},
{
"cell_type": "code",
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-29T10:23:31.662181Z",
"start_time": "2025-05-29T10:23:31.655940Z"
"end_time": "2025-07-06T13:59:18.036651Z",
"start_time": "2025-07-06T13:59:18.032180Z"
}
},
"source": [
"llamator.print_preset_tests_params_example(\"all\")"
],
"cell_type": "code",
"source": "llamator.print_test_preset(\"all\")",
"outputs": [
{
"name": "stdout",
Expand Down Expand Up @@ -244,7 +239,6 @@
" (\"harmbench\", { \"custom_dataset\": None, \"language\": \"any\", \"num_attempts\": 0 }),\n",
" (\"linguistic_evasion\", { \"num_attempts\": 0 }),\n",
" (\"logical_inconsistencies\", { \"multistage_depth\": 20, \"num_attempts\": 0 }),\n",
" (\"past_tense\", { \"num_attempts\": 0 }),\n",
" (\"pair\", {\n",
" \"custom_dataset\": None,\n",
" \"language\": \"any\",\n",
Expand All @@ -259,6 +253,12 @@
" }),\n",
" (\"sycophancy\", { \"multistage_depth\": 20, \"num_attempts\": 0 }),\n",
" (\"system_prompt_leakage\", { \"custom_dataset\": None, \"multistage_depth\": 20, \"num_attempts\": 0 }),\n",
" (\"time_machine\", {\n",
" \"custom_dataset\": None,\n",
" \"language\": \"any\",\n",
" \"num_attempts\": 0,\n",
" \"time_context\": \"any\"\n",
" }),\n",
" (\"ucar\", { \"language\": \"any\", \"num_attempts\": 0 }),\n",
" (\"vlm_lowres_docs\", {\n",
" \"custom_pdf_dir\": None,\n",
Expand Down
118 changes: 18 additions & 100 deletions examples/llamator-langchain-custom-attack.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
]
},
{
"cell_type": "code",
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-29T09:49:52.411435Z",
"start_time": "2025-05-29T09:49:51.206995Z"
"end_time": "2025-07-06T13:59:29.416433Z",
"start_time": "2025-07-06T13:59:29.025054Z"
}
},
"cell_type": "code",
"source": [
"%pip install llamator python-dotenv --upgrade --quiet\n",
"%pip show llamator"
Expand All @@ -26,12 +26,11 @@
"name": "stdout",
"output_type": "stream",
"text": [
"Note: you may need to restart the kernel to use updated packages.\n",
"Name: llamator\r\n",
"Version: 3.2.0\r\n",
"Version: 3.3.0\r\n",
"Summary: Framework for testing vulnerabilities of GenAI systems.\r\n",
"Home-page: \r\n",
"Author: \r\n",
"Home-page: https://github.com/LLAMATOR-Core/llamator\r\n",
"Author: Roman Neronov, Timur Nizamov, Nikita Ivanov\r\n",
"Author-email: \r\n",
"License: Attribution 4.0 International\r\n",
"Location: /Users/roman/Projects/PycharmProjects/LLAMATORS/llamator/src\r\n",
Expand All @@ -41,21 +40,19 @@
]
}
],
"execution_count": 7
"execution_count": 1
},
{
"cell_type": "code",
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-29T10:24:22.519124Z",
"start_time": "2025-05-29T10:24:16.999210Z"
"end_time": "2025-07-06T13:59:41.243222Z",
"start_time": "2025-07-06T13:59:41.240928Z"
}
},
"source": [
"import llamator"
],
"cell_type": "code",
"source": "import llamator",
"outputs": [],
"execution_count": 1
"execution_count": 3
},
{
"cell_type": "code",
Expand Down Expand Up @@ -1184,8 +1181,8 @@
"execution_count": 16
},
{
"cell_type": "markdown",
"metadata": {},
"cell_type": "markdown",
"source": [
"## Start testing\n",
"\n",
Expand All @@ -1195,94 +1192,15 @@
"\n",
"### Available Attacks\n",
"\n",
"Check out the `llamator.print_preset_tests_params_example(\"all\")` and [documentation](https://LLAMATOR-Core.github.io/llamator/attack_descriptions.html)."
"Check out the `llamator.print_test_preset(\"all\")` and [documentation](https://LLAMATOR-Core.github.io/llamator/attack_descriptions.html)."
]
},
{
"metadata": {},
"cell_type": "code",
"metadata": {
"ExecuteTime": {
"end_time": "2025-05-29T10:24:23.256008Z",
"start_time": "2025-05-29T10:24:23.251225Z"
}
},
"source": [
"llamator.print_preset_tests_params_example(\"all\")"
],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"# Example configuration for preset 'all':\n",
"basic_tests_params = [\n",
" (\"suffix\", { \"custom_dataset\": None, \"num_attempts\": 0 }),\n",
" (\"aim_jailbreak\", { \"num_attempts\": 0 }),\n",
" (\"autodan_turbo\", {\n",
" \"custom_dataset\": None,\n",
" \"language\": \"any\",\n",
" \"multistage_depth\": 10,\n",
" \"num_attempts\": 0,\n",
" \"strategy_library_size\": 10\n",
" }),\n",
" (\"base64_injection\", { \"custom_dataset\": None, \"num_attempts\": 0 }),\n",
" (\"bon\", {\n",
" \"custom_dataset\": None,\n",
" \"language\": \"any\",\n",
" \"num_attempts\": 0,\n",
" \"num_transformations\": 5,\n",
" \"sigma\": 0.4\n",
" }),\n",
" (\"crescendo\", {\n",
" \"custom_dataset\": None,\n",
" \"language\": \"any\",\n",
" \"multistage_depth\": 5,\n",
" \"num_attempts\": 0\n",
" }),\n",
" (\"deceptive_delight\", { \"custom_dataset\": None, \"num_attempts\": 0 }),\n",
" (\"dialogue_injection_continuation\", { \"custom_dataset\": None, \"language\": \"any\", \"num_attempts\": 0 }),\n",
" (\"dialogue_injection_devmode\", { \"custom_dataset\": None, \"num_attempts\": 0 }),\n",
" (\"dan\", { \"language\": \"any\", \"num_attempts\": 0 }),\n",
" (\"ethical_compliance\", { \"custom_dataset\": None, \"num_attempts\": 0 }),\n",
" (\"harmbench\", { \"custom_dataset\": None, \"language\": \"any\", \"num_attempts\": 0 }),\n",
" (\"linguistic_evasion\", { \"num_attempts\": 0 }),\n",
" (\"logical_inconsistencies\", { \"multistage_depth\": 20, \"num_attempts\": 0 }),\n",
" (\"past_tense\", { \"num_attempts\": 0 }),\n",
" (\"pair\", {\n",
" \"custom_dataset\": None,\n",
" \"language\": \"any\",\n",
" \"multistage_depth\": 20,\n",
" \"num_attempts\": 0\n",
" }),\n",
" (\"shuffle\", {\n",
" \"custom_dataset\": None,\n",
" \"language\": \"any\",\n",
" \"num_attempts\": 0,\n",
" \"num_transformations\": 5\n",
" }),\n",
" (\"sycophancy\", { \"multistage_depth\": 20, \"num_attempts\": 0 }),\n",
" (\"system_prompt_leakage\", { \"custom_dataset\": None, \"multistage_depth\": 20, \"num_attempts\": 0 }),\n",
" (\"ucar\", { \"language\": \"any\", \"num_attempts\": 0 }),\n",
" (\"vlm_lowres_docs\", {\n",
" \"custom_pdf_dir\": None,\n",
" \"is_long_pdf\": False,\n",
" \"num_attempts\": 0,\n",
" \"overwrite_existing_pdfs\": False,\n",
" \"rescale\": 0.25\n",
" }),\n",
" (\"vlm_m_attack\", {\n",
" \"attack_data_base\": None,\n",
" \"attack_source\": \"parquet\",\n",
" \"dataset\": \"bigscale_100\",\n",
" \"dataset_variations\": None,\n",
" \"num_attempts\": 0\n",
" }),\n",
" (\"vlm_text_hallucination\", { \"attack_types\": None, \"num_attempts\": 0 }),\n",
"]\n"
]
}
],
"execution_count": 2
"source": "llamator.print_test_preset(\"all\")",
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
Expand Down
Loading
Loading