Skip to content

How to check one Ragfile index status? #6108

Closed

Description

@ReginaLiang

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?

Activity

  1. sofisl commented on Mar 3, 2025

    @sofisl
    Contributor

    Hi @ReginaLiang! Since this is mostly an autogenerated library, we don't provide API-specific question support. Please consult the documentation on cloud.google.com, or hopefully consult within our community. Thank you!

  2. locked and limited conversation to collaborators on Mar 3, 2025
  3. converted this issue into a discussion #6110 on Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions