feat: sync HTTP types and auth with Node SDK 2.2.0 - #35
Merged
Conversation
Add document metadata telemetry, planned document_id on job create, page citation source helpers, and auth_token_provider so unpublished 2.0.0 can match Node HTTP/type parity. Co-authored-by: Cursor <cursoragent@cursor.com>
CI has no lockfile, so uv sync pulled ruff 0.16 which fails on pre-existing Optional annotations. Cap the pin and sort the imports that 0.16 already flagged in this change. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
document_metadataon job create/parse (officialcreated_by_client=python-sdk/client_versiondefaults; caller keys win), planneddocument_idonJobcreate responses, anddocument_metadataonDocument.documents.get_page_citation_sourceand typedPageCitationAssetforchunk.metadata["pageAssets"]. The SDK does not generate citation assets.auth_token_providerfor short-lived bearer tokens. A staticapi_keystill wins; the provider is called per request.Closes #34 for the P0 HTTP/type slice. Knowledge/parsed-storage (P1) is out of scope. Do not merge release PR #32 first — release-please should rewrite it so 2.0.0 includes these commits.
Test plan
uv run ruff check src/ tests/uv run mypy src/knowhereuv run pytest -qdocument_metadataand confirm the body includescreated_by_client=python-sdkandclient_versioncreated_by_clientand confirm the caller value winsJob.document_idis populated when the API returns a planned iddocuments.get_page_citation_sourceand confirmGET /v2/documents/{id}/files/page-citation-sourceKnowhere(auth_token_provider=...)withoutapi_keyand confirm the Authorization header refreshes per requestMade with Cursor