From d7f56e357981396b7be662efc1ef1dfacbe392fd Mon Sep 17 00:00:00 2001 From: Abhinav Rau Date: Thu, 19 Sep 2024 12:21:49 -0400 Subject: [PATCH] Use appID for searching instead of datastoreId. Fixed alignment and formatting --- src/common.js | 7 +- src/excel/excel_create_tables.js | 2 +- src/excel/excel_search_runner.js | 14 ++- src/excel/excel_search_tables.js | 10 +- src/excel/excel_summarization_runner.js | 5 +- src/excel/excel_summarization_tables.js | 3 + src/excel/excel_synthetic_qa_runner.js | 6 +- src/vertex_ai.js | 99 ++++++++++++++++++- taskpane.html | 45 +++------ ..._vai_search_extractive_answer_request.json | 2 +- test/test_search_runner.js | 11 +-- test/test_vertex_ai.js | 35 +++---- 12 files changed, 160 insertions(+), 79 deletions(-) diff --git a/src/common.js b/src/common.js index 3c08589..f12bded 100644 --- a/src/common.js +++ b/src/common.js @@ -15,7 +15,7 @@ export const vertex_ai_search_configValues = [ ["GCP PARAMETERS", ""], ["Vertex AI Search Project Number", "384473000457"], - ["Vertex AI Search DataStore Name", "alphabet-pdfs_1695783402380"], + ["Vertex AI Search App ID", "l300-arau_1695783344117"], ["Vertex AI Project ID", "argolis-arau"], ["Vertex AI Location", "us-central1"], ["", ""], @@ -29,7 +29,10 @@ export const vertex_ai_search_configValues = [ ["", ""], ["SUMMARY GENERATION SETTINGS", ""], ["summaryResultCount (1-5)", "2"], //summaryResultCount - ["Preamble (Customized Summaries)", ""], + [ + "Preamble (Customized Summaries)", + `You are an expert financial analyst. Only use the data returned from documents. All finance numbers must be reported in billions, millions or thousands. Be brief. Answer should be no more than 2 sentences please.`, + ], ["Summarization Model", "gemini-1.0-pro-001/answer_gen/v1"], [ "SummaryMatchingAdditionalPrompt", diff --git a/src/excel/excel_create_tables.js b/src/excel/excel_create_tables.js index 1be0a1b..0ba6956 100644 --- a/src/excel/excel_create_tables.js +++ b/src/excel/excel_create_tables.js @@ -31,7 +31,7 @@ export async function createExcelTable( excelTable.name = `${worksheetName}.${tableType}`; excelTable.getRange().format.font.size = fontSize; - excelTable.getRange().format.wrapText = true; + //excelTable.getRange().format.wrapText = true; excelTable.showFilterButton = false; excelTable.getHeaderRowRange().values = [valuesArray[0]]; diff --git a/src/excel/excel_search_runner.js b/src/excel/excel_search_runner.js index 1700a23..2d1cbaa 100644 --- a/src/excel/excel_search_runner.js +++ b/src/excel/excel_search_runner.js @@ -43,12 +43,9 @@ export class ExcelSearchRunner extends TaskRunner { "Vertex AI Search Project Number", ) ][0], - vertexAISearchDataStoreName: + vertexAISearchAppId: valueColumn.values[ - findIndexByColumnsNameIn2DArray( - configColumn.values, - "Vertex AI Search DataStore Name", - ) + findIndexByColumnsNameIn2DArray(configColumn.values, "Vertex AI Search App ID") ][0], vertexAIProjectID: valueColumn.values[ @@ -232,8 +229,9 @@ export class ExcelSearchRunner extends TaskRunner { await this.processsAllRows(context, config, countRows, this.idColumn.values); // autofit the content - currentWorksheet.getUsedRange().format.autofitColumns(); - currentWorksheet.getUsedRange().format.autofitRows(); + //currentWorksheet.getUsedRange().format.autofitColumns(); + //currentWorksheet.getUsedRange().format.autofitRows(); + await context.sync(); } catch (error) { appendLog(`Caught Exception in executeSearchTests: ${error.message} `, error); @@ -281,7 +279,7 @@ export class ExcelSearchRunner extends TaskRunner { rowNum, response_json, ).then(async (callsSoFar) => { - appendLog(`testCaseID: ${rowNum} Processed Search Summary.`); + appendLog(`testCaseID: ${rowNum} Finished Check Grounding.`); }); this.searchTaskPromiseSet.add(checkGroundingPromise); diff --git a/src/excel/excel_search_tables.js b/src/excel/excel_search_tables.js index b087888..adcdfd7 100644 --- a/src/excel/excel_search_tables.js +++ b/src/excel/excel_search_tables.js @@ -18,11 +18,11 @@ export async function createVAIConfigTable() { sheetTitleFontSize, ); - await makeRowBold("A3:B3"); - await makeRowBold("A9:B9"); - await makeRowBold("A17:B17"); - await makeRowBold("A23:B23"); - await makeRowBold("A26:B26"); + await makeRowBold("A4:B4"); + await makeRowBold("A10:B10"); + await makeRowBold("A18:B18"); + await makeRowBold("A24:B24"); + await makeRowBold("A27:B27"); } export async function createVAIDataTable() { diff --git a/src/excel/excel_summarization_runner.js b/src/excel/excel_summarization_runner.js index cec25c3..1879857 100644 --- a/src/excel/excel_summarization_runner.js +++ b/src/excel/excel_summarization_runner.js @@ -120,8 +120,9 @@ export class SummarizationRunner extends TaskRunner { await this.processsAllRows(context, config, countRows, this.idColumn.values); // autofit the content - currentWorksheet.getUsedRange().format.autofitColumns(); - currentWorksheet.getUsedRange().format.autofitRows(); + //currentWorksheet.getUsedRange().format.autofitColumns(); + //currentWorksheet.getUsedRange().format.autofitRows(); + await context.sync(); } catch (error) { appendError(`Caught Exception in createSummarizationData `, error); diff --git a/src/excel/excel_summarization_tables.js b/src/excel/excel_summarization_tables.js index 042de24..c7498a8 100644 --- a/src/excel/excel_summarization_tables.js +++ b/src/excel/excel_summarization_tables.js @@ -30,6 +30,9 @@ export async function createSummarizationEvalDataTable() { sheet.getRange("E:E").format.columnWidth = 455; sheet.getRange("F:F").format.columnWidth = 455; + sheet.getRange("G:G").format.columnWidth = 455; + sheet.getRange("G:G").format.columnWidth = 455; + sheet.getRange("E:E").format.wrapText = true; sheet.getRange("F:F").format.wrapText = true; diff --git a/src/excel/excel_synthetic_qa_runner.js b/src/excel/excel_synthetic_qa_runner.js index 8752a06..edcb32f 100644 --- a/src/excel/excel_synthetic_qa_runner.js +++ b/src/excel/excel_synthetic_qa_runner.js @@ -129,8 +129,10 @@ export class SyntheticQARunner extends TaskRunner { await this.processsAllRows(context, config, countRows, this.idColumn.values); // autofit the content - currentWorksheet.getUsedRange().format.autofitColumns(); - currentWorksheet.getUsedRange().format.autofitRows(); + //currentWorksheet.getUsedRange().format.autofitColumns(); + //currentWorksheet.getUsedRange().format.autofitRows(); + + await context.sync(); } catch (error) { appendError(`Caught Exception in createSyntheticQAData `, error); diff --git a/src/vertex_ai.js b/src/vertex_ai.js index 3f6488b..2cca4ab 100644 --- a/src/vertex_ai.js +++ b/src/vertex_ai.js @@ -21,7 +21,7 @@ export async function callVertexAISearch(id, query, config) { const ignoreAdversarialQuery = config.ignoreAdversarialQuery; const ignoreNonSummarySeekingQuery = config.ignoreNonSummarySeekingQuery; const projectNumber = config.vertexAISearchProjectNumber; - const datastoreName = config.vertexAISearchDataStoreName; + const searchAppId = config.vertexAISearchAppId; var data = { query: query, @@ -45,7 +45,7 @@ export async function callVertexAISearch(id, query, config) { }, }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${projectNumber}/locations/global/collections/default_collection/dataStores/${datastoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${projectNumber}/locations/global/collections/default_collection/engines/${searchAppId}/servingConfigs/default_search:search`; const { status, json_output } = await callVertexAI(url, token, data, id); @@ -55,6 +55,8 @@ export async function callVertexAISearch(id, query, config) { } export async function calculateSimilarityUsingPalm2(id, sentence1, sentence2, config) { + appendLog(`testCaseID: ${id}: SummaryMatch Started `); + const token = config.accessToken; const projectId = config.vertexAIProjectID; const location = config.vertexAILocation; @@ -225,6 +227,99 @@ export async function callCheckGrounding(config, answerCandidate, factsArray, id return { id: id, status_code: status, output: json_output }; } + +export async function createSearchEvalSampleQuerySetId(config, querySetId, querySetDisplayName) { + const token = config.accessToken; + const projectId = config.vertexAIProjectID; + + var payload = { + displayName: `${querySetDisplayName}`, + }; + + const url = `https://discoveryengine.googleapis.com/v1beta/projects/${projectId}/locations/global/sampleQuerySets?sampleQuerySetId=${querySetId}`; + + const { status, json_output } = await callVertexAI(url, token, payload, id); + + appendLog(`createSearchEvalQuerySet: Finished Successfully.`); + + return { status_code: status, output: json_output }; +} + +export async function createSearchEvalImportSampleQueryDataset(config, querySetId, queryEntry) { + const token = config.accessToken; + const projectId = config.vertexAIProjectID; + + var payload = { + inlineSource: { + sampleQueries: [ + { + queryEntry, + }, + ], + }, + }; + + const url = `https://discoveryengine.googleapis.com/v1beta/projects/${projectId}/locations/global/sampleQuerySets/${querySetId}/sampleQueries:import`; + + const { status, json_output } = await callVertexAI(url, token, payload); + + appendLog(`createSearchEvalImportSampleQueryDataset: Finished Successfully.`); + + return { status_code: status, output: json_output }; +} + +export async function createSearchEvalSubmitEvalJob(config, querySetId, searchAppID) { + const token = config.accessToken; + const projectId = config.vertexAIProjectID; + + var payload = { + evaluationSpec: { + querySetSpec: { + sampleQuerySet: `projects/${projectId}/locations/global/sampleQuerySets/${querySetId}`, + }, + searchRequest: { + servingConfig: `projects/${projectId}/locations/global/collections/default_collection/engines/${searchAppID}/servingConfigs/default_search`, + }, + }, + }; + + const url = `https://discoveryengine.googleapis.com/v1beta/projects/${projectId}/locations/global/evaluations`; + + const { status, json_output } = await callVertexAI(url, token, payload); + + appendLog(`createSearchEvalRunEval: Finished Successfully.`); + + return { status_code: status, output: json_output }; +} + +export async function getSearchEvalResults(config, evaluationId, checkStatus) { + const token = config.accessToken; + const projectId = config.vertexAIProjectID; + + var payload = { + evaluationSpec: { + querySetSpec: { + sampleQuerySet: `projects/${projectId}/locations/global/sampleQuerySets/${querySetId}`, + }, + searchRequest: { + servingConfig: `projects/${projectId}/locations/global/collections/default_collection/engines/${searchAppID}/servingConfigs/default_search`, + }, + }, + }; + + var url = `https://discoveryengine.googleapis.com/v1beta/projects/${projectId}/locations/global/evaluations/${evaluationId}:listResults`; + + if (checkStatus) { + url = `https://discoveryengine.googleapis.com/v1beta/projects/${projectId}/locations/global/evaluations/${evaluationId}`; + } + + const { status, json_output } = await callVertexAI(url, token, payload); + + appendLog(`getSearchEvalResults: Finished Successfully.`); + + return { status_code: status, output: json_output }; +} + export async function callVertexAI(url, token, data, id) { try { const response = await fetch(url, { diff --git a/taskpane.html b/taskpane.html index 49e9fa9..2bb1f7d 100644 --- a/taskpane.html +++ b/taskpane.html @@ -66,24 +66,14 @@

How to use

- 2. Use the "Synthetic Q&A" Tab to generate Questions and Answers from documents stored in GCS. + 2. Use the "Synthetic Q&A" Tab to generate Questions and Answers OR - If you have your own test cases then put them in a seperate sheet. -

-

- 3. Reference the Questions and Answers in the "Query" and "Expected Summary" columns. And reference the expected link in the "Expected Link1" column. -

-

- 4. Fill in the ID column for all rows you want the tests to run on. + If you have your own test cases copy into the test case table.

- 5. Fill in Config Parameters for your GCP environment in the Config Table. - Adjust the different config parameters like "Preamble" etc. - for your use case. -

-

- 6. Click button below to run tests starting from first row. -

+ 3. Fill in Config Parameters for your GCP environment in the Config Table. + Adjust the Premable and other settings for your use case. +

Note: Tests will stop when it sees an empty ID value.

@@ -103,18 +93,13 @@

How to use

- 2. Fill in "FileUri" and "mimeType" columns you want questions and answers to be generated from. Valid mimeTypes for Gemini are documented here. -

-

- 3. Fill in the ID column for all rows you want the tests to run on. + 2. Fill in "FileUri" column with GCS doc link. Valid file types.

- 4. Fill in Config Parameters for your GCP environment in the Config Table. - Adjust the prompt and "System Instructions", "Prompt" and "Q&A Quality Prompt" + 3. Fill in Config Parameters for your GCP environment in the Config Table. + Adjust the Prompt and Q&A Quality Prompt for your use case. -

-

- 5. Click button below to generate Q&As starting from first row. +

Note: Generation will stop when it sees an empty ID value. @@ -137,18 +122,12 @@

How to use

- 2. Fill in "Text to Summarize" column with Text to summarize. + 2. Fill in "Context" column with Text to summarize.

- 3. Fill in the ID column for all rows you want the rows you want summarized. -

-

- 4. Fill in Config Parameters for your GCP environment in the Config Table. - Adjust the prompt and "System Instructions", "Prompt" and "Summarization Quality Prompt" + 3. Fill in Config Parameters for your GCP environment in the Config Table. + Adjust the Prompt and Summarization Quality Prompt for your use case. -

-

- 5. Click button below to generate summarizes starting from first row.

Note: Generation will stop when it sees an empty ID value. diff --git a/test/data/search/search_extractive_answer/test_vai_search_extractive_answer_request.json b/test/data/search/search_extractive_answer/test_vai_search_extractive_answer_request.json index 1db4b5f..2afebd5 100644 --- a/test/data/search/search_extractive_answer/test_vai_search_extractive_answer_request.json +++ b/test/data/search/search_extractive_answer/test_vai_search_extractive_answer_request.json @@ -13,7 +13,7 @@ "ignoreAdversarialQuery": "true", "ignoreNonSummarySeekingQuery": "true", "modelPromptSpec": { - "preamble": "" + "preamble": "You are an expert financial analyst. Only use the data returned from documents. All finance numbers must be reported in billions, millions or thousands. Be brief. Answer should be no more than 2 sentences please." }, "modelSpec": { "version": "gemini-1.0-pro-001/answer_gen/v1" diff --git a/test/test_search_runner.js b/test/test_search_runner.js index 9b70d67..57d76d5 100644 --- a/test/test_search_runner.js +++ b/test/test_search_runner.js @@ -35,7 +35,7 @@ export var testCaseRows = vertex_ai_search_testTableHeader.concat([ "link2", // Actual Link 2 "link3", // Actual Link 3 ], - [ + [ "2", // ID "What is Google's revenue for the year ending December 31, 2021", //Query "Revenue is $2.2 billion", //Expected Summary @@ -319,7 +319,7 @@ describe("When Search Run Tests is clicked ", () => { // Get the config parameters from the config table const config = await excelSearchRunner.getSearchConfig(); - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; // Prepare the request response mock the call to VertexAISearch const { requestJson, expectedResponse } = mockDiscoveryEngineRequestResponse( 1, @@ -338,7 +338,7 @@ describe("When Search Run Tests is clicked ", () => { const grouding_url = `https://discoveryengine.googleapis.com/v1/projects/${config.vertexAIProjectID}/locations/global/groundingConfigs/default_grounding_config:check`; // Prepare the request response mock the call to VertexAISearch - const { requestJson: grouding_requestJson, expectedResponse: grouding_expectedResponse } = + const { requestJson: grouding_requestJson, expectedResponse: grouding_expectedResponse } = mockDiscoveryEngineRequestResponse( 1, grouding_url, @@ -364,7 +364,7 @@ describe("When Search Run Tests is clicked ", () => { // check if vertex ai is called for summary match const callsToSummaryMatch = fetchMock.calls().filter((call) => call[0] === summaryMatchUrl); // Check if body is sent correctly to vertex ai search - expect(callsToSummaryMatch[0][1].body!==null).toBe(true); + expect(callsToSummaryMatch[0][1].body !== null).toBe(true); // check if vertex ai is called for check grounding match const callsToCheckGrounding = fetchMock.calls().filter((call) => call[0] === grouding_url); @@ -373,7 +373,6 @@ describe("When Search Run Tests is clicked ", () => { // Check if values get populated for each test case for (let i = 1; i < testCaseRows.length; i++) { - // Match Actual Summary const { cell: actual_summary_cell, col_index: actual_summary_col_index } = getCellAndColumnIndexByName("Actual Summary", mockTestData, i); @@ -467,7 +466,7 @@ describe("When Search Run Tests is clicked ", () => { // Get the config parameters from the config table const config = await excelSearchRunner.getSearchConfig(); - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; // Prepare the request response mock the call to VertexAISearch const { requestJson, expectedResponse } = mockDiscoveryEngineRequestResponse( diff --git a/test/test_vertex_ai.js b/test/test_vertex_ai.js index 0f42e82..1855980 100644 --- a/test/test_vertex_ai.js +++ b/test/test_vertex_ai.js @@ -177,7 +177,8 @@ describe("When callVertexAISearch is called", () => { const query = "What is Google's revenue for the year ending December 31, 2021"; const config = { accessToken: "YOUR_ACCESS_TOKEN", - preamble: "", + preamble: + "You are an expert financial analyst. Only use the data returned from documents. All finance numbers must be reported in billions, millions or thousands. Be brief. Answer should be no more than 2 sentences please.", extractiveContentSpec: { maxExtractiveAnswerCount: "2", maxExtractiveSegmentCount: "0", @@ -188,11 +189,11 @@ describe("When callVertexAISearch is called", () => { ignoreAdversarialQuery: true, ignoreNonSummarySeekingQuery: true, vertexAISearchProjectNumber: "YOUR_PROJECT_NUMBER", - vertexAISearchDataStoreName: "YOUR_DATASTORE_NAME", + vertexAISearchAppId: "YOUR_DATASTORE_NAME", vertexAILocation: "YOUR_LOCATION", }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; await testRequestResponse( 1, url, @@ -217,10 +218,10 @@ describe("When callVertexAISearch is called", () => { ignoreAdversarialQuery: true, ignoreNonSummarySeekingQuery: true, vertexAISearchProjectNumber: "YOUR_PROJECT_NUMBER", - vertexAISearchDataStoreName: "YOUR_DATASTORE_NAME", + vertexAISearchAppId: "YOUR_DATASTORE_NAME", vertexAILocation: "YOUR_LOCATION", }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; await testRequestResponse( 1, url, @@ -245,10 +246,10 @@ describe("When callVertexAISearch is called", () => { ignoreAdversarialQuery: true, ignoreNonSummarySeekingQuery: true, vertexAISearchProjectNumber: "YOUR_PROJECT_NUMBER", - vertexAISearchDataStoreName: "YOUR_DATASTORE_NAME", + vertexAISearchAppId: "YOUR_DATASTORE_NAME", vertexAILocation: "YOUR_LOCATION", }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; await testRequestResponse( 1, url, @@ -330,10 +331,10 @@ describe("When callVertexAISearch is called", () => { ignoreAdversarialQuery: true, ignoreNonSummarySeekingQuery: true, vertexAISearchProjectNumber: "YOUR_PROJECT_NUMBER", - vertexAISearchDataStoreName: "YOUR_DATASTORE_NAME", + vertexAISearchAppId: "YOUR_DATASTORE_NAME", vertexAILocation: "YOUR_LOCATION", }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; const { requestJson, expectedResponse } = mockDiscoveryEngineRequestResponse( 1, url, @@ -368,10 +369,10 @@ describe("When callVertexAISearch is called", () => { ignoreAdversarialQuery: true, ignoreNonSummarySeekingQuery: true, vertexAISearchProjectNumber: "YOUR_PROJECT_NUMBER", - vertexAISearchDataStoreName: "YOUR_DATASTORE_NAME", + vertexAISearchAppId: "YOUR_DATASTORE_NAME", vertexAILocation: "YOUR_LOCATION", }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; const { requestJson, expectedResponse } = mockDiscoveryEngineRequestResponse( 1, url, @@ -402,11 +403,11 @@ describe("When callVertexAISearch is called", () => { ignoreAdversarialQuery: false, ignoreNonSummarySeekingQuery: false, vertexAISearchProjectNumber: "YOUR_PROJECT_NUMBER", - vertexAISearchDataStoreName: "YOUR_DATASTORE_NAME", + vertexAISearchAppId: "YOUR_DATASTORE_NAME", vertexAILocation: "YOUR_LOCATION", }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; var response = fetchMock.postOnce(url, { throws: new Error("Mocked error"), @@ -437,10 +438,10 @@ describe("When callVertexAISearch is called", () => { ignoreAdversarialQuery: true, ignoreNonSummarySeekingQuery: true, vertexAISearchProjectNumber: "YOUR_PROJECT_NUMBER", - vertexAISearchDataStoreName: "YOUR_DATASTORE_NAME", + vertexAISearchAppId: "YOUR_DATASTORE_NAME", vertexAILocation: "YOUR_LOCATION", }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; const { requestJson, expectedResponse } = mockDiscoveryEngineRequestResponse( 1, url, @@ -472,10 +473,10 @@ describe("When callVertexAISearch is called", () => { ignoreAdversarialQuery: true, ignoreNonSummarySeekingQuery: true, vertexAISearchProjectNumber: "YOUR_PROJECT_NUMBER", - vertexAISearchDataStoreName: "YOUR_DATASTORE_NAME", + vertexAISearchAppId: "YOUR_DATASTORE_NAME", vertexAILocation: "YOUR_LOCATION", }; - const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/dataStores/${config.vertexAISearchDataStoreName}/servingConfigs/default_search:search`; + const url = `https://discoveryengine.googleapis.com/v1alpha/projects/${config.vertexAISearchProjectNumber}/locations/global/collections/default_collection/engines/${config.vertexAISearchAppId}/servingConfigs/default_search:search`; const { requestJson, expectedResponse } = mockDiscoveryEngineRequestResponse( 1, url,