File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
packages/core/src/codewhispererChat Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ import {
8888} from '../../constants'
8989import { ChatSession } from '../../clients/chat/v0/chat'
9090import { amazonQTabSuffix } from '../../../shared/constants'
91- import { OutputKind } from '../../tools/toolShared'
91+ import { maxToolOutputCharacterLength , OutputKind } from '../../tools/toolShared'
9292import { ToolUtils , Tool , ToolType } from '../../tools/toolUtils'
9393import { ChatStream } from '../../tools/chatStream'
9494import { ChatHistoryStorage } from '../../storages/chatHistoryStorage'
@@ -667,6 +667,11 @@ export class ChatController {
667667 requiresAcceptance : false ,
668668 } )
669669 const output = await ToolUtils . invoke ( tool , chatStream )
670+ if ( output . output . content . length > maxToolOutputCharacterLength ) {
671+ throw Error (
672+ `Tool output exceeds maximum character limit of ${ maxToolOutputCharacterLength } `
673+ )
674+ }
670675
671676 toolResults . push ( {
672677 content : [
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import path from 'path'
77import fs from '../../shared/fs/fs'
88
99export const maxToolResponseSize = 30720 // 30KB
10+ export const maxToolOutputCharacterLength = 800_000
1011
1112export enum OutputKind {
1213 Text = 'text' ,
You can’t perform that action at this time.
0 commit comments