From 3c81a6e88b79b6ce6bbea8144f7e7e9d3c9d2ace Mon Sep 17 00:00:00 2001 From: Trayan Azarov Date: Fri, 10 May 2024 08:56:59 +0300 Subject: [PATCH] chore: Removing unnecessary re-throw of exception - this time in the correct place :) --- clients/js/src/embeddings/OpenAIEmbeddingFunction.ts | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/clients/js/src/embeddings/OpenAIEmbeddingFunction.ts b/clients/js/src/embeddings/OpenAIEmbeddingFunction.ts index 6a52bfeaa06..ebf6c074640 100644 --- a/clients/js/src/embeddings/OpenAIEmbeddingFunction.ts +++ b/clients/js/src/embeddings/OpenAIEmbeddingFunction.ts @@ -88,14 +88,10 @@ export class OpenAIEmbeddingFunction implements IEmbeddingFunction { public async generate(texts: string[]): Promise { const openaiApi = await this.getOpenAIClient(); - return await openaiApi - .createEmbedding({ - model: this.model, - input: texts, - }) - .catch((error: any) => { - throw error; - }); + return await openaiApi.createEmbedding({ + model: this.model, + input: texts, + }); } private async getOpenAIClient(): Promise { if (this.openaiApi) return this.openaiApi;