Update prompt to include code surrounding the diff (full file)
Background
We want to add more context to the prompt for review so the model has a fuller picture of the code a change was made to.
Feedback: #493890 (comment 2266321734)
MR: !176190 (comment 2266216697)
this is a great suggestion but that exact condition is actually a few lines above where the suggestion is in the same file. yet that line is not getting updated in the MR so i guess Duo are not taking those into context.
Proposal
Experiment in Langsmith with adding various combinations of the following pieces of context:
- Full content of the file being changed (start with this, try the rest below if this doesn't work out)
- Limited window of code lines before/after the change (based on token limits and diff size?)
- LLM-generated summary of what the entire file does? (explain this code)
- Structured data representing the file being changed - e.g. list of function names, function definitions, variables, etc (LSIF? SCIP?)
Use the following sample MRs as dataset to manually evaluate whether the extra context improves the comments:
Edited by François Rosé