From 94296d7e70fcb70c3812c516867187cb8a16b8f0 Mon Sep 17 00:00:00 2001 From: Andrew <34192400+AndrewAndrewsen@users.noreply.github.com> Date: Wed, 29 Jan 2025 13:57:00 +0100 Subject: [PATCH 1/2] fix: use request.cachedContent instead of this.cachedContent on generateContent --- src/models/generative_models.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/models/generative_models.ts b/src/models/generative_models.ts index 1e2820e9..0ec3c8f7 100644 --- a/src/models/generative_models.ts +++ b/src/models/generative_models.ts @@ -367,7 +367,7 @@ export class GenerativeModelPreview { request, this.systemInstruction ), - cachedContent: this.cachedContent?.name, + cachedContent: request.cachedContent?.name, }; return generateContent( this.location, From 1fc980bdccd199a07dc5067a75cbcdec60e0f780 Mon Sep 17 00:00:00 2001 From: Andrew <34192400+AndrewAndrewsen@users.noreply.github.com> Date: Wed, 29 Jan 2025 13:58:41 +0100 Subject: [PATCH 2/2] fix: pass cachedContent when calling getGenerativeModel --- src/vertex_ai.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/vertex_ai.ts b/src/vertex_ai.ts index 21a67447..122f443c 100644 --- a/src/vertex_ai.ts +++ b/src/vertex_ai.ts @@ -215,6 +215,7 @@ class VertexAIPreview { toolConfig: modelParams.toolConfig, requestOptions: requestOptions, systemInstruction: modelParams.systemInstruction, + cachedContent: modelParams.cachedContent, }; return new GenerativeModelPreview(getGenerativeModelParams); }