-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Description
The file I referenced created a rag and imported the file. How can I query the status of the index? Is there any corresponding API support?
https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/rag-api?hl=zh-cn
This is my import code:
async function importRagFile(ragCorpusName: string, uris: string[]) {
const data = await getSecretValue("GOOGLE-VERTEXAI-CREDENTIALS");
const credentials = JSON.parse(data);
const aiplatformClient = new VertexRagDataServiceClient({
credentials: credentials,
apiEndpoint: `${location}-aiplatform.googleapis.com`
})
try {
// Construct request
const request = {
parent: ragCorpusName,
importRagFilesConfig: {
gcsSource: { uris: uris }
}
};
console.log("request:", JSON.stringify(request));
// Run the request and wait for the operation to complete
const [operation] = await aiplatformClient.importRagFiles(request);
const [response] = await operation.promise();
console.log("importRagFile response", response);
return response;
} catch (error) {
console.error('Error importRagFile:', error);
}
}
This is my search code:
const ragRetrievalTool = {
retrieval: {
vertexRagStore: {
ragResources: [{
ragCorpus: ragCorpusName
}]
}
},
};
const generativeModel = vertexAI.getGenerativeModel({
model: 'gemini-1.5-flash-002',
tools: [ragRetrievalTool],
});
const chat = generativeModel.startChat();
const chatInput = text;
const result = await chat.sendMessage(chatInput);
console.log('result: ', JSON.stringify(result));
const response = result.response;
I can import and query it successfully, but how can I query the index status?
Metadata
Metadata
Assignees
Labels
No labels