diff options
| author | joshualitt <[email protected]> | 2025-08-06 13:52:04 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-06 20:52:04 +0000 |
| commit | 43510ed212ea29b7bd752277de525f7821551b22 (patch) | |
| tree | b49f31ec75804e2b742b2651714066211421c3ab /packages/core/src/tools/read-many-files.ts | |
| parent | ad5d2af4e34fd23391bb6a0270cc320a0e56ba88 (diff) | |
bug(core): Prompt engineering for truncated read_file. (#5161)
Diffstat (limited to 'packages/core/src/tools/read-many-files.ts')
| -rw-r--r-- | packages/core/src/tools/read-many-files.ts | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/packages/core/src/tools/read-many-files.ts b/packages/core/src/tools/read-many-files.ts index 1fa2e15c..a380ea91 100644 --- a/packages/core/src/tools/read-many-files.ts +++ b/packages/core/src/tools/read-many-files.ts @@ -524,11 +524,15 @@ Use this tool when the user's query implies needing the content of several files '{filePath}', filePath, ); - contentParts.push( - `${separator}\n\n${fileReadResult.llmContent}\n\n`, - ); + let fileContentForLlm = ''; + if (fileReadResult.isTruncated) { + fileContentForLlm += `[WARNING: This file was truncated. To view the full content, use the 'read_file' tool on this specific file.]\n\n`; + } + fileContentForLlm += fileReadResult.llmContent; + contentParts.push(`${separator}\n\n${fileContentForLlm}\n\n`); } else { - contentParts.push(fileReadResult.llmContent); // This is a Part for image/pdf + // This is a Part for image/pdf, which we don't add the separator to. + contentParts.push(fileReadResult.llmContent); } processedFilesRelativePaths.push(relativePathForDisplay); |
