You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using HTTPTarget class as the target LLM during multi-turn orchestration, the http_request attribute is overwritten during the first turn. On subsequent turns, the http_request attribute is never changed because it no longer contains the {PROMPT} marker which is required for the regex.
The issue occurs on line 64 of http_target.py, where self.http_request is assigned a new value. The issue is fixed by using self._http_request instead. Line 114 within parse_raw_http_request() also needs to be changed to self._http_request.
Steps/Code to Reproduce
There are 2 ways to see the issue caused by below code:
Proxy HTTP traffic so it can be inspected
Insert the following print statement on line 77 of http_target.py: print(http_body). The output will be the same on each turn.
Note that below code is copy pasted from https://azure.github.io/PyRIT/code/targets/7_http_target.html. Appropriate environmental variables must be set up to initialize targets. Can change the adversarial LLM target and use different endpoint/request body for HTTP target.
The text was updated successfully, but these errors were encountered:
kmarsh77
changed the title
HTTPTarget sending same prompt repeatedly in multi-turn orchestration
BUG: HTTPTarget sending same prompt repeatedly in multi-turn orchestration
Jan 31, 2025
Describe the bug
When using HTTPTarget class as the target LLM during multi-turn orchestration, the http_request attribute is overwritten during the first turn. On subsequent turns, the http_request attribute is never changed because it no longer contains the {PROMPT} marker which is required for the regex.
The issue occurs on line 64 of http_target.py, where self.http_request is assigned a new value. The issue is fixed by using self._http_request instead. Line 114 within parse_raw_http_request() also needs to be changed to self._http_request.
Steps/Code to Reproduce
There are 2 ways to see the issue caused by below code:
Note that below code is copy pasted from https://azure.github.io/PyRIT/code/targets/7_http_target.html. Appropriate environmental variables must be set up to initialize targets. Can change the adversarial LLM target and use different endpoint/request body for HTTP target.
Expected Results
A different prompt is sent to the HTTP target on each turn.
Actual Results
The same prompt is sent to the HTTP target on each turn.
Screenshots
n/a
Versions
pyrit: 0.5.2
Cython: None
numpy: 1.26.4
openai: 1.60.2
pip: 24.0
scikit-learn: 1.6.1
scipy: 1.15.1
setuptools: 75.8.0
tensorflow: None
torch: 2.2.2
transformers: 4.48.1
The text was updated successfully, but these errors were encountered: