Skip to content

Add document chunks SDK methods#19

Merged
suguanYang merged 1 commit into
mainfrom
feat/will/document-chunks-api
Apr 27, 2026
Merged

Add document chunks SDK methods#19
suguanYang merged 1 commit into
mainfrom
feat/will/document-chunks-api

Conversation

@suguanYang
Copy link
Copy Markdown
Collaborator

@suguanYang suguanYang commented Apr 27, 2026

Summary

  • Add client.documents.list_chunks(document_id, ...) for GET /v1/documents/{document_id}/chunks.
  • Add client.documents.get_chunk(document_id, document_chunk_id, ...) for GET /v1/documents/{document_id}/chunks/{document_chunk_id}.
  • Add Pydantic response models, sync/async resource methods, README/docs usage, and focused resource tests.
  • Keep asset URL generation opt-in via include_asset_urls only.

Verification

  • uv run --python 3.11 --extra dev pytest tests/test_documents.py
  • uv run --python 3.11 --extra dev mypy src/knowhere
  • uv run --python 3.11 --extra dev ruff check src/knowhere tests/test_documents.py
  • git diff --check
  • Live staging smoke against https://api-staging.knowhereto.ai:
    • client.documents.list(namespace="default") returned 9 documents.
    • client.documents.list_chunks(document_id, page=1, page_size=2) returned 2 chunks with total 651.
    • client.documents.get_chunk(document_id, chunk_id) returned the same chunk.
    • include_asset_urls=True returned asset URLs for sampled image and table chunks.

Upstream API

@suguanYang suguanYang merged commit 987b3fd into main Apr 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant