[go: up one dir, main page]

Skip to content

Extract logic for extracting diffs for prompt

Background

As of this writing, we are extracting diffs in 3 different places:

  • Llm::MergeRequests::SummarizeDiffService
  • Gitlab::Llm::Templates::GenerateCommitMessage
  • Gitlab::Llm::Templates::FillInMergeRequestTemplate

It is also possible to have a MR with huge diffs and we won't be able to send them to AI provider in a single request as we can hit a token limit.

Proposal

Create a new module/class to encapsulate the logic of extracting diffs that can be re-used by different classes.

Regarding the token limit issue, it still needs to be discussed.


The following discussion from !121233 (merged) should be addressed:

  • @patrickbajao started a discussion: (+4 comments)

    This is borrowed from Llm::MergeRequests::SummarizeDiffService. We can extract this in a separate module/class in a follow up so it can be re-usable.