From a26ff1a9759d104ec07b014c5cb53a79f53d56df Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 29 Apr 2025 16:15:35 -0700 Subject: [PATCH] fix type err --- core/llm/llms/VertexAI.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/llm/llms/VertexAI.ts b/core/llm/llms/VertexAI.ts index 97cb40e25..cc1b70b19 100644 --- a/core/llm/llms/VertexAI.ts +++ b/core/llm/llms/VertexAI.ts @@ -64,8 +64,8 @@ class VertexAI extends BaseLLM { async fetch(url: RequestInfo | URL, init?: RequestInit) { const client = await this.clientPromise; - const { token } = await client.getAccessToken(); - if (!token) { + const result = await client?.getAccessToken(); + if (!result?.token) { throw new Error( "Could not get an access token. Set up your Google Application Default Credentials.", ); @@ -74,7 +74,7 @@ class VertexAI extends BaseLLM { ...init, headers: { "Content-Type": "application/json", - Authorization: `Bearer ${token}`, + Authorization: `Bearer ${result.token}`, ...init?.headers, }, }); @@ -374,8 +374,8 @@ class VertexAI extends BaseLLM { protected async _embed(chunks: string[]): Promise { const client = await this.clientPromise; - const { token } = await client.getAccessToken(); - if (!token) { + const result = await client?.getAccessToken(); + if (!result?.token) { throw new Error( "Could not get an access token. Set up your Google Application Default Credentials.", ); @@ -390,7 +390,7 @@ class VertexAI extends BaseLLM { }), headers: { "Content-Type": "application/json", - Authorization: `Bearer ${token}`, + Authorization: `Bearer ${result.token}`, }, }, );