diff --git a/packages/vertexai/test-utils/mock-response.ts b/packages/vertexai/test-utils/mock-response.ts index 8332d9eb36e..9b42c93427b 100644 --- a/packages/vertexai/test-utils/mock-response.ts +++ b/packages/vertexai/test-utils/mock-response.ts @@ -49,6 +49,9 @@ export function getMockResponseStreaming( filename: string, chunkLength: number = 20 ): Partial { + if (!(filename in mocksLookup)) { + throw Error(`Mock response file '${filename}' not found.`); + } const fullText = mocksLookup[filename]; return { @@ -57,6 +60,9 @@ export function getMockResponseStreaming( } export function getMockResponse(filename: string): Partial { + if (!(filename in mocksLookup)) { + throw Error(`Mock response file '${filename}' not found.`); + } const fullText = mocksLookup[filename]; return { ok: true,