Skip to content
Open
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 src/reviewer/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ def _build_paper_json(
"explanation": c.explanation,
"comment_type": c.comment_type,
"paragraph_index": c.paragraph_index,
"severity": c.severity,
})

model_short = _model_short_name(result.model) if result.model else ""
Expand Down
5 changes: 5 additions & 0 deletions src/reviewer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

from dataclasses import dataclass, field

SEVERITY_VALUES = ("minor", "moderate", "major")


@dataclass
class Comment:
Expand All @@ -11,6 +13,7 @@ class Comment:
explanation: str # reviewer's explanation
comment_type: str # "technical" or "logical"
paragraph_index: int | None = None # 0-based index in split paragraphs
severity: str | None = None # one of SEVERITY_VALUES, or None when unknown

def to_dict(self) -> dict:
d = {
Expand All @@ -21,6 +24,8 @@ def to_dict(self) -> dict:
}
if self.paragraph_index is not None:
d["paragraph_index"] = self.paragraph_index
if self.severity:
d["severity"] = self.severity
return d


Expand Down
19 changes: 17 additions & 2 deletions src/reviewer/prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
DO_NOT_FLAG_CHUNKED = DO_NOT_FLAG_BASE.rstrip() + """
- Incomplete text at passage boundaries"""

SEVERITY_RUBRIC = """\
For each issue, assign a "severity" tier:
- "major": undermines a key claim, methodology, or comparison; affects conclusions
- "moderate": real error or gap, but localized and fixable
- "minor": framing concern, mild overclaim, or ambiguity resolvable from context"""

DO_NOT_FLAG_PROGRESSIVE = DO_NOT_FLAG_CHUNKED.rstrip() + """
- Notation not yet in the summary — it may be introduced later"""

Expand All @@ -57,6 +63,7 @@
- "quote": the exact verbatim text (preserving LaTeX)
- "explanation": deep reasoning — what you initially thought, whether context resolves it, and what specifically remains problematic
- "type": "technical" or "logical"
- "severity": "minor", "moderate", or "major"
"""

JSON_OBJECT_OUTPUT = """\
Expand Down Expand Up @@ -99,6 +106,8 @@

{DO_NOT_FLAG_CHUNKED}

{SEVERITY_RUBRIC}

{JSON_ARRAY_OUTPUT}"""

DEEP_CHECK_PROGRESSIVE_PROMPT = f"""{REVIEWER_PREAMBLE}
Expand Down Expand Up @@ -149,6 +158,8 @@

{DO_NOT_FLAG_BASE}

{SEVERITY_RUBRIC}

Return a JSON object with this structure:
{{{{
"overall_feedback": "One paragraph high-level assessment of the paper's quality and main issues",
Expand All @@ -157,7 +168,8 @@
"title": "short descriptive title of the issue",
"quote": "the exact verbatim text from the paper containing the issue (copy it exactly, preserving LaTeX)",
"explanation": "deep reasoning — what you initially thought, whether context resolves it, and what specifically remains problematic",
"type": "technical" or "logical"
"type": "technical" or "logical",
"severity": "minor" or "moderate" or "major"
}}}}
]
}}}}
Expand Down Expand Up @@ -194,6 +206,8 @@

{DO_NOT_FLAG_CHUNKED}

{SEVERITY_RUBRIC}

Return a JSON object:
{{{{
"overall_feedback": "brief assessment of this section",
Expand All @@ -202,7 +216,8 @@
"title": "short descriptive title of the issue",
"quote": "the exact verbatim text from the paper containing the issue (copy it exactly, preserving LaTeX)",
"explanation": "deep reasoning — what you initially thought, whether context resolves it, and what specifically remains problematic",
"type": "technical" or "logical"
"type": "technical" or "logical",
"severity": "minor" or "moderate" or "major"
}}}}
]
}}}}
Expand Down
8 changes: 7 additions & 1 deletion src/reviewer/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import tiktoken

from .models import Comment
from .models import Comment, SEVERITY_VALUES


def _get_encoding():
Expand Down Expand Up @@ -205,12 +205,18 @@ def parse_comments_from_list(items: list[dict]) -> list[Comment]:
paragraph_index = item.get("paragraph_index", None)
if paragraph_index is not None:
paragraph_index = int(paragraph_index)
severity = item.get("severity")
if isinstance(severity, str):
severity = severity.strip().lower()
if severity not in SEVERITY_VALUES:
severity = "moderate"
comments.append(Comment(
title=title,
quote=quote,
explanation=explanation,
comment_type=comment_type,
paragraph_index=paragraph_index,
severity=severity,
))
return comments

Expand Down