Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,7 @@ def get_details(self, index: int = 0, position: dict = None, old_details: dict =
"answer_tokens": self.data.get("answer_tokens"),
"history_message": self.get_context("history_message"),
"messages": messages,
"system": self.data.get("system"),
}
)
return details

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here’s a review of the provided diff:

Code

@@ -798,6 +798,7 @@ def get_details(self, index: int = 0, position: dict = None, old_details: dict =
             "answer_tokens": self.data.get("answer_tokens"),
             "history_message": self.get_context("history_message"),
             "messages": messages,
+            "system": self.data.get("system"),
         }
     )
     return details

Observations

  1. Consistency is good — Using self.data.get("system") matches the pattern used for "answer_tokens", so no style issue there.

  2. Redundancy risk — If get_context() already includes the system prompt (or if messages embeds it), adding "system" separately may duplicate data downstream. Verify whether consumers of details expect a separate system key or rely on messages.

  3. Downstream impact — Adding a new key to the returned details dict can break strict schema validators, snapshot tests, or serializers that don't allow unexpected fields. Check callers of get_details().

  4. Key ordering / diff hygiene — Placing "system" after "messages" is fine functionally, but consider grouping related fields together (e.g., put "system" before "messages" for readability), since the system prompt semantically precedes the message list.

  5. Default-argument issue (pre-existing) — position: dict = None uses a mutable-default anti-pattern signal. It's None, so it's safe, but typing could be improved to Optional[dict] = None.

  6. Missing type/Optional annotation — Minor; not introduced by this change.

  7. No test shown — Add/extend a unit test asserting that "system" is present and populated when self.data["system"] is set, and None otherwise.

  8. Performance — Negligible; one extra dict lookup.

Recommendation

The change itself is low-risk syntactically. The main things to confirm:

  • Consumers of details tolerate the new "system" key.
  • No duplication with messages / history_message.
  • A test covers both the present and absent (None) cases.

If those hold, the diff is fine as-is.

Loading