Skip to content

feat: integrate retrieval service v1 in Python SDK#11

Merged
suguanYang merged 2 commits into
mainfrom
feat/wangbinqi/retrieval-service-v1-sdk
Apr 21, 2026
Merged

feat: integrate retrieval service v1 in Python SDK#11
suguanYang merged 2 commits into
mainfrom
feat/wangbinqi/retrieval-service-v1-sdk

Conversation

@suguanYang
Copy link
Copy Markdown
Collaborator

Summary

Adds Python SDK support for the new retrieval-service v1 API surface introduced by knowhere-api#204.

This PR depends on https://github.com/Ontos-AI/knowhere-api/pull/204, which is not merged yet, so live compatibility was verified against a local API checkout of that branch.

Client-facing changes

  • Adds client.retrieval.query(...) and async_client.retrieval.query(...) for POST /v1/retrieval/query.
  • Adds client.documents.list(...), client.documents.get(...), client.documents.archive(...) and async equivalents for /v1/documents lifecycle APIs.
  • Extends jobs.create(...) and parse(...) with namespace and document_id so callers can create retrievable documents and update existing documents.
  • Extends Job and JobResult models with namespace and document_id.
  • Adds typed response models for retrieval results, citations, documents, and document lists.
  • Updates README and usage docs with caller workflows for create, update, query, exclusions, list/get/archive.

Local verification

SDK checks:

uv run pytest
uv run ruff check .
uv run mypy src

Results:

  • 224 passed
  • ruff: all checks passed
  • mypy: no issues found in 25 source files

Live local compatibility smoke against unmerged knowhere-api#204:

  • API checkout: feat/wangbinqi/retrieval-service-v1 at bd391ef
  • Local API base URL: http://127.0.0.1:5005
  • Local DB: knowhere_e2e_will_204
  • Namespace: e2e-will-204-nokia
  • Document: doc_da46b74e3b83

Verified through the SDK:

  • sync client.retrieval.query(namespace="e2e-will-204-nokia", query="Bluetooth", top_k=3) returned 3 results from the Nokia PDF document
  • sync client.documents.list(namespace="e2e-will-204-nokia") returned the active Nokia document
  • sync client.documents.get("doc_da46b74e3b83") returned the active document state
  • async client.retrieval.query(...) returned the Nokia document result
  • async client.documents.list(...) returned the Nokia document list

Note: because knowhere-api#204 is unmerged, this PR should be revalidated after the API PR lands or if its public contract changes before merge.

@suguanYang suguanYang merged commit bce7aa8 into main Apr 21, 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