FEAT: add reasoning_effort and reasoning_summary to OpenAIResponseTarget#1385
Open
romanlutz wants to merge 7 commits intoAzure:mainfrom
Open
FEAT: add reasoning_effort and reasoning_summary to OpenAIResponseTarget#1385romanlutz wants to merge 7 commits intoAzure:mainfrom
romanlutz wants to merge 7 commits intoAzure:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds first-class support for OpenAI's reasoning parameters to the OpenAIResponseTarget class, enabling users to control the depth of reasoning and request reasoning summaries for compatible models (o1, o3, o4-mini, GPT-5).
Changes:
- Added
reasoning_effortandreasoning_summaryparameters toOpenAIResponseTarget.__init__(), supporting values from the OpenAI Responses API - Implemented
_build_reasoning_config()helper method to construct the reasoning configuration for API requests - Enhanced console printer to display reasoning summaries when
include_reasoning_trace=True - Added comprehensive unit and integration tests covering all reasoning parameter combinations
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
pyrit/prompt_target/openai/openai_response_target.py |
Added reasoning parameters to constructor, request body building, and target identifier; improved defensive checks in _find_last_pending_tool_call() |
tests/unit/target/test_openai_response_target.py |
Added 8 new unit tests covering initialization and request body construction with reasoning parameters |
tests/integration/targets/test_openai_responses_gpt5.py |
Added integration tests for reasoning parameters; fixed role → api_role for consistency |
tests/integration/targets/test_entra_auth_targets.py |
Added integration tests for reasoning parameters with Entra authentication |
pyrit/executor/attack/printer/console_printer.py |
Added _extract_reasoning_summary() method and logic to display reasoning summaries in console output |
doc/code/targets/2_openai_responses_target.py |
Added documentation section explaining reasoning configuration with usage example |
doc/code/targets/2_openai_responses_target.ipynb |
Jupyter notebook version of documentation with executed example output |
Adds first-class support for the OpenAI Responses API reasoning parameter. Users can now control reasoning effort (minimal/low/medium/high) and optionally request reasoning summaries (auto/concise/detailed). Uses ReasoningEffort type from the OpenAI SDK directly. Closes Azure#1384 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… type, add Entra integration tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…notebook Adds a new section demonstrating reasoning_effort and reasoning_summary parameters with a working example. Regenerated .ipynb from .py. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Console printer now shows reasoning summaries (with 💭 emoji) when available, and silently skips reasoning pieces with empty summaries. - Updated notebook to use high reasoning_effort + detailed summary with a thinking-heavy prompt to demonstrate reasoning output. - Removed gpt-4.1 from reasoning Entra tests (not a reasoning model). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Reasoning with summary: always shown - Reasoning without summary + include_reasoning_trace=True: show raw trace - Reasoning without summary + include_reasoning_trace=False: skip (default) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Gate reasoning summary display on include_reasoning_trace flag - Use blank line + color contrast (cyan vs yellow) to distinguish reasoning summary from text response (no separator line that could be confused with turn boundaries) - Notebook passes include_reasoning_trace=True to show summaries Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ion tests Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
74ff735 to
3482fbe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds first-class support for the OpenAI Responses API reasoning parameter. Users can now control reasoning effort (minimal/low/medium/high) and optionally request reasoning summaries (auto/concise/detailed).
Uses ReasoningEffort type from the OpenAI SDK directly.
Closes #1384