Skip to main content

documents.fetch_text_data

List stored text and summary chunks from a text namespace. Returns one page at a time (up to 100 items). Pass next_token from the previous response to fetch the next page.
client.documents.fetch_text_data(
    namespace_name: str,
    *,
    limit: int | None = None,
    next_token: str | None = None,
) -> dict[str, Any]
API: GET /namespaces/{namespace_name}/documents/fetch-text-data — see Fetch text data

Parameters

namespace_name
string
required
Text namespace to read from.
limit
integer
Page size. Default 100, maximum 100.
next_token
string
Cursor from pagination.next_token in a previous response.

Examples

from moorcheh import MoorchehClient

with MoorchehClient("http://localhost:8080") as client:
    all_items = []
    next_token = None

    while True:
        page = client.documents.fetch_text_data("my-documents", limit=100, next_token=next_token)
        all_items.extend(page.get("items", []))
        pagination = page.get("pagination", {})
        if not pagination.get("has_more"):
            break
        next_token = pagination.get("next_token")

    print(f"Fetched {len(all_items)} chunks")

Response fields

Same shape as the REST API: status, message, namespace, statistics, items, pagination, execution_time.