Skip to content

feat: add rerank endpoint support#20

Merged
tbille merged 6 commits into
mainfrom
add-rerank-endpoint
Apr 28, 2026
Merged

feat: add rerank endpoint support#20
tbille merged 6 commits into
mainfrom
add-rerank-endpoint

Conversation

@tbille
Copy link
Copy Markdown
Member

@tbille tbille commented Apr 17, 2026

Description

Add rerank support to the Rust SDK, allowing users to rerank documents by relevance to a query via the gateway provider. This is the first non-completion, non-moderation endpoint and follows the established SUPPORTS_STREAMING / SUPPORTS_TOOLS trait extension pattern.

Changes:

  • New RerankParams, RerankResult, RerankMeta, RerankUsage, and RerankResponse types in src/types/rerank.rs
  • SUPPORTS_RERANK associated constant and rerank()/rerank_fn() two-level dispatch methods on the Provider trait
  • Gateway provider implementation via reqwest POST to /v1/rerank, reusing convert_error() for HTTP error mapping
  • GatewayRerankRequest wire type that maps model_id to model (consistent with completions)
  • Public rerank() free function and RerankOptions in src/api.rs
  • Re-exports in src/lib.rs

PR Type

  • 🆕 New Feature

Relevant issues

Checklist

  • I understand the code I am submitting.
  • I have added unit tests that prove my fix/feature works
  • I have run this code locally and verified it fixes the issue.
  • New and existing tests pass locally (cargo test --all-features)
  • Code passes linting (cargo clippy --all-features -- -D warnings)
  • Code is formatted (cargo fmt)
  • Documentation was updated where necessary
  • I have read and followed the contribution guidelines
  • AI Usage:
    • No AI was used.
    • AI was used for drafting/refactoring.
    • This is fully AI-generated.

AI Usage Information

  • AI Model used: Claude claude-opus-4-6
  • AI Developer Tool used: OpenCode
  • Any other info you'd like to share: Implementation follows the spec in any-llm-rust-spec.md for adding rerank endpoint support.

@tbille tbille merged commit 56a9f5e into main Apr 28, 2026
7 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