Skip to content

Commit 11b30d5

Browse files
rlundeen2Copilot
andcommitted
MAINT: address second round of PR feedback
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent aab5401 commit 11b30d5

3 files changed

Lines changed: 9 additions & 5 deletions

File tree

pyrit/memory/memory_models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,8 @@ class AttackResultEntry(Base):
723723
String, nullable=False, default="undetermined"
724724
)
725725
outcome_reason = mapped_column(String, nullable=True)
726-
attack_metadata: Mapped[dict[str, str | int | float | bool]] = mapped_column(JSON, nullable=True)
727-
labels: Mapped[dict[str, str]] = mapped_column(JSON, nullable=True)
726+
attack_metadata: Mapped[dict[str, str | int | float | bool] | None] = mapped_column(JSON, nullable=True)
727+
labels: Mapped[dict[str, str] | None] = mapped_column(JSON, nullable=True)
728728
pruned_conversation_ids: Mapped[list[str] | None] = mapped_column(JSON, nullable=True)
729729
adversarial_chat_conversation_ids: Mapped[list[str] | None] = mapped_column(JSON, nullable=True)
730730
timestamp = mapped_column(DateTime, nullable=False)

pyrit/models/scenario_result.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def to_dict(self) -> dict[str, Any]:
5858
return {
5959
"name": self.name,
6060
"description": self.description,
61-
"version": self.version,
61+
"scenario_version": self.version,
6262
"pyrit_version": self.pyrit_version,
6363
"init_data": self.init_data,
6464
}
@@ -77,7 +77,7 @@ def from_dict(cls, data: dict[str, Any]) -> ScenarioIdentifier:
7777
return cls(
7878
name=data["name"],
7979
description=data.get("description", ""),
80-
scenario_version=data.get("version", 1),
80+
scenario_version=data.get("scenario_version", 1),
8181
init_data=data.get("init_data"),
8282
pyrit_version=data.get("pyrit_version"),
8383
)

pyrit/models/score.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,11 @@ def from_dict(cls, data: dict[str, Any]) -> Score:
215215
score_category=data.get("score_category"),
216216
score_rationale=data["score_rationale"],
217217
score_metadata=data.get("score_metadata"),
218-
scorer_class_identifier=ComponentIdentifier.from_dict(data["scorer_class_identifier"]),
218+
scorer_class_identifier=( # type: ignore[ty:invalid-argument-type]
219+
ComponentIdentifier.from_dict(data["scorer_class_identifier"])
220+
if data.get("scorer_class_identifier")
221+
else None
222+
),
219223
message_piece_id=data["message_piece_id"],
220224
timestamp=datetime.fromisoformat(data["timestamp"]) if data.get("timestamp") else None,
221225
objective=data.get("objective"),

0 commit comments

Comments
 (0)