Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions doc/_toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ chapters:
sections:
- file: code/registry/1_class_registry
- file: code/registry/2_instance_registry
- file: code/gui/0_gui
- file: code/front_end/0_front_end
sections:
- file: code/front_end/1_pyrit_scan
Expand Down
3 changes: 3 additions & 0 deletions doc/code/converters/7_human_converter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"id": "0",
"metadata": {},
"source": [
"> ⚠️ **Deprecated:** The `HumanInTheLoopConverter` is deprecated and will be removed in PyRIT v0.13.0.\n",
"> Use the React-based GUI (CoPyRIT) instead. See the [GUI documentation](../gui/0_gui.md) for details.\n",
"\n",
"# 7. Human in the Loop Converter\n",
"\n",
"The Human in the Loop Converter allows a user to review each prompt before sending it to a target, allowing for closer moderation of multi-turn conversations.\n",
Expand Down
3 changes: 3 additions & 0 deletions doc/code/converters/7_human_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
# ---

# %% [markdown]
# > ⚠️ **Deprecated:** The `HumanInTheLoopConverter` is deprecated and will be removed in PyRIT v0.13.0.
# > Use the React-based GUI (CoPyRIT) instead. See the [GUI documentation](../gui/0_gui.md) for details.
#
# # 7. Human in the Loop Converter
#
# The Human in the Loop Converter allows a user to review each prompt before sending it to a target, allowing for closer moderation of multi-turn conversations.
Expand Down
27 changes: 27 additions & 0 deletions doc/code/gui/0_gui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# PyRIT GUI (CoPyRIT)

CoPyRIT is a web-based graphical interface for PyRIT built with React and Fluent UI. It provides an interactive way to run attacks, configure targets and converters, and view results — all from a browser.

> **Note:** The older Gradio-based GUI (`HumanInTheLoopScorerGradio`) and the `HumanInTheLoopConverter` are deprecated and will be removed in v0.13.0. CoPyRIT covers a much broader part of the user journey — from attack creation and converter configuration to attack history and result analysis — making these limited interactive components obsolete.

## Getting Started

There are several ways to run CoPyRIT:

### PyRIT Backend CLI

If you have PyRIT installed, use the `pyrit_backend` command to start the server. The bundled frontend is served automatically.

```bash
pyrit_backend
```

Then open `http://localhost:8000` in your browser.

### Docker

CoPyRIT is also available as a Docker container. See the [Docker setup](https://github.com/Azure/PyRIT/blob/main/docker/) for details.

### Azure Deployment

Azure-hosted deployment is planned for the near future.
3 changes: 3 additions & 0 deletions doc/code/scoring/5_human_in_the_loop_scorer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"id": "0",
"metadata": {},
"source": [
"> ⚠️ **Deprecated:** The `HumanInTheLoopScorerGradio` is deprecated and will be removed in PyRIT v0.13.0.\n",
"> Use the React-based GUI (CoPyRIT) instead. See the [GUI documentation](../gui/0_gui.md) for details.\n",
"\n",
"# 5. Human in the Loop Scoring with Gradio\n",
"This example shows how to use the Gradio UI to perform human-in-the-loop scoring. This is in beta but will be extended."
]
Expand Down
3 changes: 3 additions & 0 deletions doc/code/scoring/5_human_in_the_loop_scorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# ---

# %% [markdown]
# > ⚠️ **Deprecated:** The `HumanInTheLoopScorerGradio` is deprecated and will be removed in PyRIT v0.13.0.
# > Use the React-based GUI (CoPyRIT) instead. See the [GUI documentation](../gui/0_gui.md) for details.
#
# # 5. Human in the Loop Scoring with Gradio
# This example shows how to use the Gradio UI to perform human-in-the-loop scoring. This is in beta but will be extended.

Expand Down
11 changes: 11 additions & 0 deletions pyrit/prompt_converter/human_in_the_loop_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import logging
from typing import Optional

from pyrit.common.deprecation import print_deprecation_message
from pyrit.identifiers import ComponentIdentifier
from pyrit.models import PromptDataType
from pyrit.prompt_converter.prompt_converter import ConverterResult, PromptConverter
Expand All @@ -17,6 +18,10 @@ class HumanInTheLoopConverter(PromptConverter):

Users can choose to send the prompt as is, modify the prompt,
or run the prompt through one of the passed-in converters before sending it.

.. deprecated::
This converter is deprecated and will be removed in v0.13.0.
Use the React-based GUI (CoPyRIT) instead.
"""

SUPPORTED_INPUT_TYPES = ("text",)
Expand All @@ -32,6 +37,12 @@ def __init__(
Args:
converters (List[PromptConverter], Optional): List of possible converters to run input through.
"""
print_deprecation_message(
old_item="HumanInTheLoopConverter",
new_item="the React-based GUI (CoPyRIT); see https://azure.github.io/PyRIT/code/gui/0_gui.html",
removed_in="0.13.0",
)

self._converters = converters or []

def _build_identifier(self) -> ComponentIdentifier:
Expand Down
11 changes: 11 additions & 0 deletions pyrit/score/human/human_in_the_loop_gradio.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import asyncio
from typing import Optional

from pyrit.common.deprecation import print_deprecation_message
from pyrit.identifiers import ComponentIdentifier
from pyrit.models import MessagePiece, Score
from pyrit.score.scorer_prompt_validator import ScorerPromptValidator
Expand All @@ -19,6 +20,10 @@ class HumanInTheLoopScorerGradio(TrueFalseScorer):
Create scores from manual human input using Gradio and adds them to the database.

In the future this will not be a TrueFalseScorer. However, it is all that is supported currently.

.. deprecated::
This Gradio-based scorer is deprecated and will be removed in v0.13.0.
Use the React-based GUI instead.
"""

_DEFAULT_VALIDATOR: ScorerPromptValidator = ScorerPromptValidator(supported_data_types=["text"])
Expand All @@ -40,6 +45,12 @@ def __init__(
score_aggregator (TrueFalseAggregatorFunc): Aggregator for combining scores. Defaults to
TrueFalseScoreAggregator.OR.
"""
print_deprecation_message(
old_item="HumanInTheLoopScorerGradio (Gradio-based GUI)",
new_item="the React-based GUI (CoPyRIT); see https://azure.github.io/PyRIT/code/gui/0_gui.html",
removed_in="0.13.0",
)

# Import here to avoid importing rpyc in the main module that might not be installed
from pyrit.ui.rpc import AppRPCServer

Expand Down
8 changes: 8 additions & 0 deletions pyrit/ui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.

from pyrit.common.deprecation import print_deprecation_message

print_deprecation_message(
old_item="pyrit.ui module (Gradio-based GUI)",
new_item="the React-based GUI (CoPyRIT); see https://azure.github.io/PyRIT/code/gui/0_gui.html",
removed_in="0.13.0",
)
2 changes: 1 addition & 1 deletion tests/unit/docs/test_converter_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_converters_mentioned_in_notebooks():
if notebook_file.name.startswith("_"):
continue

content = notebook_file.read_text()
content = notebook_file.read_text(encoding="utf-8")

# Look for converter imports and class names
# Pattern 1: from pyrit.prompt_converter import ConverterName
Expand Down