Skip to content

feat(client): add list_providers() — closes provider-listing parity gap#164

Merged
saurabhjain1592 merged 2 commits intomainfrom
feature/qf-sdk-parity
Apr 28, 2026
Merged

feat(client): add list_providers() — closes provider-listing parity gap#164
saurabhjain1592 merged 2 commits intomainfrom
feature/qf-sdk-parity

Conversation

@saurabhjain1592
Copy link
Copy Markdown
Member

Summary

Adds `client.list_providers()` to the Python SDK, closing the parity gap with the Java SDK (which has had the listing capability for some time) and with the platform's `GET /api/v1/llm-providers` endpoint. Surfaced by the Phase 1 quality-freeze sweep against `examples/llm-routing/e2e-tests/python` — the example was silently swallowing `AttributeError` when the method didn't exist.

What changed

  • `AxonFlow.list_providers(provider_type=None, enabled=None)` async method
  • `SyncAxonFlow.list_providers(...)` synchronous wrapper
  • `LLMProvider` and `LLMProviderHealth` types in `axonflow.types`
  • Both types re-exported from `axonflow`
  • 5 regression tests pinning the wire-shape contract (dict shape, empty list, type filter, enabled filter, provider without health field)

Test plan

  • `tests/test_list_providers.py` — 5/5 pass locally (`pytest tests/test_list_providers.py`)
  • `ruff check` clean
  • `ruff format --check` clean
  • `mypy axonflow` clean
  • Falsey-clobber baseline refreshed for line-number shift (no new findings)

Out of scope (separate PRs)

  • Same parity additions for Go SDK / TS SDK / Java SDK (already track-able from this branch's commits — they all need the same `ListProviders` method)
  • Example correctness improvements in `examples/llm-routing/e2e-tests/python` (the example's lying `ALL TESTS PASSED` despite swallowed `AttributeError` is a separate bug — to be addressed once the example is updated to use the new method explicitly)

@saurabhjain1592 saurabhjain1592 merged commit 602df66 into main Apr 28, 2026
13 checks passed
saurabhjain1592 added a commit that referenced this pull request Apr 28, 2026
…tion, defensive health (#165)

Three review-driven fixes on the just-shipped list_providers() (PR #164):

1. Wire-shape: LLMProvider was silently dropping endpoint, model, region,
   rate_limit, timeout_seconds, and settings — every provider config the
   SDK couldn't introspect. Surfaced all six fields so the SDK matches the
   platform's LLMProviderResource schema.

2. Pagination: GET /api/v1/llm-providers is paginated (server-side cap 100,
   default 20). list_providers() ignored that and would silently truncate
   results in any deployment with more than 20 providers. Added:
   - list_providers(page=, page_size=) — single page, list-shaped return
   - list_providers_paged(...) — single page, returns
     LLMProviderListResponse with pagination metadata
   - list_all_providers(...) — walks every page (page_size=100 default)

3. Defensive health parsing: a single malformed `health` snapshot on one
   provider would raise ValidationError out of pydantic and crash the
   entire list call. Wrapped the per-provider health construction in
   try/except and set health=None for the bad row, with a debug warning.

6 regression tests pin the new behavior, including the empty-string
edge case in min_sdk_version_for("python") (no upgrade warning fires).

Both async and sync entry points; types re-exported from `axonflow`
(LLMProviderListResponse, PaginationMeta).
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