I have created a Custom Search app using Vertex AI Agent Builder with confluence based data store. I am able to use the app using the Preview UI and able to ask questions and get correct answers.
Now I want to integrate the search app into another application using API. I am using following Node.js code. For the same question that works in preview, I always get 'No results could be found. Try rephrasing the search query.'
import { ConversationalSearchServiceClient } from '@google-cloud/discoveryengine';
async function call2(input) {
const apiEndpoint = 'us-discoveryengine.googleapis.com';
const discoveryClient = new ConversationalSearchServiceClient({ apiEndpoint: apiEndpoint });
const serviceConfig = "projects/<projectId>/locations/us/collections/default_collection/engines/<engineid>/servingConfigs/default_search:search";
const request = {
pageSize: 10,
query: { text: input },
servingConfig: serviceConfig
};
console.log("request = ", request);
// Perform search request
const response = await discoveryClient.answerQuery(request);
console.log("response = ", response);
}
const result = await call2("<question>");
console.log('Search Results:', result);
What could be the issue? I am using ServiceAccount key and set the GOOGLE_APPLICATION_CREDENTIALS env var.
I used following as reference: https://cloud.google.com/generative-ai-app-builder/docs/samples/genappbuilder-answer-query?hl=en
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |