Skip to content

Commit

Permalink
cody bench chat-context-v2: adjust overlap threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
beyang committed Sep 23, 2024
1 parent 67ddd79 commit 358360a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions agent/src/cli/command-bench/strategy-chat-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ async function runContextCommand(examples: Example[], outputFile: string): Promi
await writeExamplesToCSV(outputFile, exampleOutputs)
}

function contextOverlaps(parentStr: string, childStr: string, threshold = 0.2): boolean {
function contextOverlaps(
parentStr: string,
childStr: string,
threshold = { lines: 3, fraction: 0.2 }
): boolean {
const parent = contextItemFromString(parentStr)
const child = contextItemFromString(childStr)
if (!parent || !child) {
Expand All @@ -123,7 +127,7 @@ function contextOverlaps(parentStr: string, childStr: string, threshold = 0.2):
const overlapLength = overlapEnd - overlapStart + 1
const parentLength = parent.endLine - parent.startLine + 1

return overlapLength / parentLength >= threshold
return overlapLength / parentLength >= threshold.fraction || overlapLength >= threshold.lines
}

function computeRecall(
Expand Down

0 comments on commit 358360a

Please sign in to comment.