Skip to content

Resolve "Exclude binary files from diffs we send to LLM"

What does this MR do and why?

When creating the prompt for the LLM model to summarize the merge request diffs, when a diff is binary, we are currently sending the binary message, which does not give any information to the model, and can lead to confusion, or take away space in the prompt away from other potentially helpful diffs.

To Test:

  • Be on Master
  • Create a MR
  • Add an image to the MR
  • Open up rails console
  • mr = MergeRequestDiff.last.merge_request
  • mr_diff = MergeRequestDiff.last
  • Gitlab::Llm::Templates::SummarizeMergeRequest.new(mr, mr_diff).to_prompt
  • It will contain "Binary Files .." in the prompt
  • Switch to this branch, rerun, and ensure that the "Binary Files" is now, not in the prompt

Initial Discussion: !136297 (comment 1639310319)

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Related to #431544 (closed)

Edited by Marc Shaw

Merge request reports