Skip to content

[Feature Request]: Return total count in Python SDK list_document API to support pagination #11788

@VVX94

Description

@VVX94

Self Checks

  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (Language Policy).
  • Non-english title submitions will be closed directly ( 非英文标题的提交将会被直接关闭 ) (Language Policy).
  • Please do not modify this template :) and fill in all the required fields.

Is your feature request related to a problem?

I am currently using the RAGFlow Python SDK to build a backend service for a hospital TCM system. I need to display a list of documents from a dataset with pagination support on the frontend (e.g., displaying "Showing 1-10 of 500 documents").

However, the current Python SDK API for querying/listing documents (e.g., `rag.list_document` or similar methods) seems to return only the list of document objects for the current page, without providing the **total count** of documents in that dataset.

Without the `total` count, I cannot calculate the total number of pages, making it impossible to implement a standard pagination component in the UI.

Describe the feature you'd like

I would like to request an update to the Python SDK list_document (or get_document_list) method.

Current Behavior (Hypothetical):

docs = rag.list_document(dataset_id="xxx", page=1, page_size=10)
# Returns: [Doc1, Doc2, ..., Doc10] (Type: List)

**Expected Behavior: **
The API should return a wrapper object or a tuple that includes the total count, OR provide a separate method to get the count.

```python
# example code
response = rag.list_document(dataset_id="xxx", page=1, page_size=10)
print(response.total) # Output: 500
print(response.data)  # Output: [Doc1, Doc2, ...]

Describe implementation you've considered

No response

Documentation, adoption, use case

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    💞 featureFeature request, pull request that fullfill a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions