Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle errors from relevant passage api call #122

Merged
merged 1 commit into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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