You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 17, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 17, 2026. It is now read-only.
Feature request: expose knowledge base reranking_config (bge-reranker-v2-m3) in the SDK #95
The DigitalOcean Gradient REST API supports configuring a reranker model on a knowledge base via a reranking_config object on the create/update knowledge base endpoints, but the current Python SDK (3.12.1, generated from the Stainless OpenAPI spec) does not expose this field. As a result, SDK users have to drop down to raw HTTP calls to enable reranking, which defeats the purpose of using the typed SDK.
Please regenerate / update the SDK so reranking_config is available on the knowledge base create and update methods.
What exists in the REST API today
The official digitalocean/openapi spec already documents reranking_config in the gen-ai knowledge base examples:
This matches the reranking feature described in the DigitalOcean blog post "Smarter Knowledge Bases for Smarter AI Agents", which announced support for the BAAI bge-reranker-v2-m3 reranker.
What is missing in the SDK
In gradient 3.12.1 (and on main at time of writing):
grep -ri rerank across the SDK source returns zero matches (verified via GitHub code search: q=rerank repo:digitalocean/gradient-python → 0 results).
gradient.types.api_retrieval_method.APIRetrievalMethod only contains:
RETRIEVAL_METHOD_UNKNOWN
RETRIEVAL_METHOD_REWRITE
RETRIEVAL_METHOD_STEP_BACK
RETRIEVAL_METHOD_SUB_QUERIES
RETRIEVAL_METHOD_NONE
The knowledge_bases.create(...) / knowledge_bases.update(...) methods do not accept a reranking_config parameter, and there is no RerankingConfig / KnowledgeBaseRerankingConfig model type exported.
Proposed change
Add a reranking_config parameter to:
client.gen_ai.knowledge_bases.create(...)
client.gen_ai.knowledge_bases.update(...)
Add a corresponding typed model, e.g. KnowledgeBaseRerankingConfig, with fields:
enabled: bool
model: Literal["bge-reranker-v2-m3", ...] (or str if more models will be added)
Expose reranking_config on the response model returned by knowledge_bases.retrieve(...) so callers can read the current state.
If reranking ever becomes configurable per-agent (rather than per-KB), expose it there too — but per the current spec it lives on the KB.
Since the SDK is generated by Stainless from the OpenAPI spec, this likely requires updating the gen-ai schema in digitalocean/openapi to declare reranking_config as a real schema (not just an example), and then regenerating.
Why this matters
Without SDK support, every user who wants to enable reranking has to:
Construct a raw httpx/requests call,
Manage auth headers separately from the SDK client,
Forgo type checking and IDE autocompletion on a feature DO is actively marketing.
This is a small, additive change that significantly improves the SDK's coverage of the Gradient AI Platform.
Environment
SDK: gradient 3.12.1 (latest on PyPI as of 2026-03-25)
Activity