Skip to content

Commit

Permalink
Handle errors from relevant passage api call (#122)
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Sundberg <[email protected]>
  • Loading branch information
seansund authored Oct 27, 2023
1 parent 665be3d commit 03d51fa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/services/data-extraction/data-extraction.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -202,6 +201,11 @@ export class DataExtractionImpl extends DataExtractionCsv<WatsonBackends, Contex
.add(() => 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
}

Expand Down

0 comments on commit 03d51fa

Please sign in to comment.