From 03d51fa8db43695aba38e63e24e80a488acacdda Mon Sep 17 00:00:00 2001 From: Sean Sundberg Date: Thu, 26 Oct 2023 20:03:54 -0500 Subject: [PATCH] Handle errors from relevant passage api call (#122) Signed-off-by: Sean Sundberg --- src/services/data-extraction/data-extraction.impl.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/services/data-extraction/data-extraction.impl.ts b/src/services/data-extraction/data-extraction.impl.ts index b19ab04..0103b4e 100644 --- a/src/services/data-extraction/data-extraction.impl.ts +++ b/src/services/data-extraction/data-extraction.impl.ts @@ -11,10 +11,9 @@ import {DataExtractionConfig, DataExtractionCsv} from "./data-extraction.csv"; import {kycCaseSummaryApi, KycCaseSummaryApi} from "../kyc-case-summary"; import {DataExtractionResultModel} from "../../models"; import {first, GenAiModel, GenerativeResponse} from "../../utils"; -import pQueue from '../../utils/p-queue' import PQueue from "../../utils/p-queue"; -const queue = new PQueue({concurrency: 2}); +const queue = new PQueue({concurrency: 1}); export interface DataExtractionBackendConfig { identityUrl: string; @@ -202,6 +201,11 @@ export class DataExtractionImpl extends DataExtractionCsv axios .post<{relevant_passage: string}>(url, {question, passages}) .then(response => response.data.relevant_passage) + .catch(err => { + console.error('Error getting relevant passages: ', {err}) + + return passages.join('\n') + }) ) as string }