Rerankers
Reranker management.
Methods on this page are called through client.rerankers.
client.rerankers.create
client.rerankers.create(request: RerankersCreateRequest, requestOptions?: ProviderApiKeyOptions): Promise<RerankerResponseShape>Creates a new reranker configuration for ranking search results. Rerankers represent connections to different reranking API services (like TEI, OpenAI, etc.) and include all the necessary configuration to use them for result ranking. DUPLICATE DETECTION: Returns HTTP 409 Conflict (ALREADY_EXISTS) if another reranker exists with the same effective provider connection and model configuration for this owner after endpoint canonicalization and provider-default resolution. Equivalent credentials participate in the comparison. DEFAULTS: apiPath defaults to '/v2/rerank' for Cohere and '/rerank' for other providers if omitted; supportedModalities defaults to [TEXT] if omitted. OWNER DEFAULTS: Owner defaults to the authenticated principal unless ownerId is provided; CREATE_RERANKER is evaluated against the proposed reranker and owner. This operation is NOT idempotent - each request creates a new reranker record.
HTTP: POST /v1/rerankers
Parameters
| Parameter | Type | Description |
|---|---|---|
request | RerankersCreateRequest | Creation request. Known modelIdentifier values fill provider, endpoint, dimensionality, and modality defaults. |
requestOptions | ProviderApiKeyOptions optional | Provider API key plus per-call signal, timeout, or headers. |
Returns: Promise<RerankerResponseShape>
Example
const reranker = await client.rerankers.create(
{
displayName: "Doc Reranker",
modelIdentifier: "rerank-2",
labels: { env: "docs" },
},
{ apiKey: "voyage-key-..." },
);client.rerankers.delete
client.rerankers.delete(id: string, requestOptions?: RequestOptions): Promise<void>Permanently deletes a reranker configuration. This operation cannot be undone and immediately removes the reranker record from the database. SIDE EFFECTS: Invalidates any cached references to this reranker; does not affect historical usage data or audit logs. Requires DELETE_RERANKER on the requested reranker. This operation is safe to retry - may return NOT_FOUND if already deleted.
HTTP: DELETE /v1/rerankers/{id}
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the reranker to delete |
requestOptions | RequestOptions optional | Per-call signal, timeout, or headers. |
Returns: Promise<void>
Example
await client.rerankers.delete("your-reranker-id");client.rerankers.get
client.rerankers.get(id: string, options?: RerankersGetOptions, requestOptions?: RequestOptions): Promise<RerankerResponseShape>Retrieves the details of a specific reranker configuration by its unique identifier. Stored credentials are omitted unless includeCredentials is true and the caller also has READ_RERANKER_CREDENTIALS. Requires READ_RERANKER on the requested reranker. The service distinguishes a missing reranker from an existing reranker the caller cannot read. This is a read-only operation with no side effects and is safe to retry.
HTTP: GET /v1/rerankers/{id}
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the reranker to retrieve |
options | RerankersGetOptions optional | Optional query parameters. |
requestOptions | RequestOptions optional | Per-call signal, timeout, or headers. |
Returns: Promise<RerankerResponseShape>
Example
const fetchedReranker = await client.rerankers.get("your-reranker-id");
console.log(fetchedReranker.displayName);client.rerankers.list
client.rerankers.list(options?: RerankersListOptions, requestOptions?: RequestOptions): Promise<Array<RerankerResponseShape>>Retrieves a list of reranker configurations accessible to the caller, with optional filtering. IMPORTANT: Pagination is NOT supported - all matching results are returned. Results are ordered by created_at descending. Stored credentials are never included in list responses. LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production). AUTHORIZATION: Requires LIST_RERANKER on the GoodMem instance. Each returned reranker must also be visible through READ_RERANKER; unauthorized rerankers are filtered in PostgreSQL. The ownerId parameter filters that already-authorized result set and does not grant additional visibility.
HTTP: GET /v1/rerankers
Parameters
| Parameter | Type | Description |
|---|---|---|
options | RerankersListOptions optional | Optional query parameters. |
requestOptions | RequestOptions optional | Per-call signal, timeout, or headers. |
Returns: Promise<Array<RerankerResponseShape>>
Example
for (const item of await client.rerankers.list()) {
console.log(item.rerankerId, item.displayName);
}client.rerankers.update
client.rerankers.update(id: string, request: UpdateRerankerRequest, requestOptions?: RequestOptions): Promise<RerankerResponseShape>Updates an existing reranker configuration including display information, endpoint configuration, model parameters, credentials, and labels. All fields are optional - only specified fields will be updated. IMMUTABLE FIELDS: providerType and ownerId cannot be changed after creation. SUPPORTED_MODALITIES UPDATE: If the array contains >=1 elements, it replaces the stored set; if empty or omitted, no change occurs and it does not count as an update by itself. Returns ALREADY_EXISTS if update would create an equivalent reranker configuration for this owner after endpoint canonicalization and provider-default resolution (HTTP 409 Conflict / ALREADY_EXISTS). Requires UPDATE_RERANKER on the requested reranker. This operation is idempotent.
HTTP: PUT /v1/rerankers/{id}
Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The unique identifier of the reranker to update |
request | UpdateRerankerRequest | Request body. |
requestOptions | RequestOptions optional | Per-call signal, timeout, or headers. |
Returns: Promise<RerankerResponseShape>
Example
const updatedReranker = await client.rerankers.update("your-reranker-id", {
displayName: "Doc Reranker (updated)",
mergeLabels: { version: "2" },
});
console.log(updatedReranker.rerankerId);Data Models
Interfaces
ListRerankersResponse
Response containing a list of rerankers
| Field | Type | Required | Description |
|---|---|---|---|
rerankers | Array<RerankerResponse> | yes | List of reranker configurations |
RerankerCreationRequest
Request body for creating a new Reranker. A Reranker represents a configuration for reranking search results.
| Field | Type | Required | Description |
|---|---|---|---|
displayName | string | yes | User-facing name of the reranker |
description | string | null | no | Description of the reranker |
providerType | ProviderType | yes | Type of reranking provider |
endpointUrl | string | yes | API endpoint URL |
apiPath | string | null | no | API path for reranking request (defaults: Cohere /v2/rerank, Jina /v1/rerank, others /rerank) |
modelIdentifier | string | yes | Model identifier |
supportedModalities | Array<Modality> | null | no | Supported content modalities (defaults to TEXT if not provided) |
credentials | EndpointAuthentication | null | no | Structured credential payload describing how to authenticate with the provider. Required for SaaS providers; optional for local or proxy providers. |
labels | Record<string, string> | null | no | User-defined labels for categorization |
version | string | null | no | Version information |
monitoringEndpoint | string | null | no | Monitoring endpoint URL |
ownerId | string | null | no | Optional owner principal UUID. If omitted, defaults to the authenticated principal. CREATE_RERANKER is evaluated against the proposed reranker and owner. |
rerankerId | string | null | no | Optional client-provided UUID for idempotent creation. If not provided, server generates a new UUID. Returns ALREADY_EXISTS if ID is already in use. |
dashscopeApiDialect | DashScopeApiDialect | null | no | DashScope request and response API dialect. Valid only for the DASHSCOPE provider. Omit to infer the dialect from apiPath, the model catalog, or the native reranking default. |
RerankerResponse
Reranker configuration information
| Field | Type | Required | Description |
|---|---|---|---|
rerankerId | string | yes | Unique identifier of the reranker |
displayName | string | yes | User-facing name of the reranker |
description | string | null | no | Description of the reranker |
providerType | ProviderType | yes | Type of reranking provider |
endpointUrl | string | yes | API endpoint URL |
apiPath | string | null | no | API path for reranking request |
modelIdentifier | string | yes | Model identifier |
supportedModalities | Array<Modality> | yes | Supported content modalities |
credentials | EndpointAuthentication | null | no | Stored credentials; present only when GetReranker explicitly requests them and the caller has READ_RERANKER_CREDENTIALS. Always omitted from create, update, and list responses. |
labels | Record<string, string> | yes | User-defined labels for categorization |
version | string | null | no | Version information |
monitoringEndpoint | string | null | no | Monitoring endpoint URL |
ownerId | string | yes | Owner ID of the reranker |
createdAt | number | yes | Creation timestamp (milliseconds since epoch) |
updatedAt | number | yes | Last update timestamp (milliseconds since epoch) |
createdById | string | yes | ID of the user who created the reranker |
updatedById | string | yes | ID of the user who last updated the reranker |
dashscopeApiDialect | DashScopeApiDialect | null | no | Configured DashScope request and response API dialect; present only for DashScope configurations with a persisted dialect. |
UpdateRerankerRequest
Request body for updating an existing Reranker. Only fields that should be updated need to be included. supportedModalities replaces the stored set only when the array contains at least one value; empty or omitted leaves it unchanged and does not count as an update by itself.
| Field | Type | Required | Description |
|---|---|---|---|
displayName | string | null | no | User-facing name of the reranker |
description | string | null | no | Description of the reranker |
endpointUrl | string | null | no | API endpoint URL |
apiPath | string | null | no | API path for reranking request |
modelIdentifier | string | null | no | Model identifier |
supportedModalities | Array<Modality> | null | no | Update supported modalities (if array contains >=1 elements, replaces stored set; if empty or omitted, no change and does not count as an update by itself) |
credentials | EndpointAuthentication | null | no | Replace stored credentials. Omit this field to preserve the current credentials; a present empty payload is invalid and never clears them. |
replaceLabels | Record<string, string> | null | no | Replace all existing labels with these (mutually exclusive with mergeLabels) |
mergeLabels | Record<string, string> | null | no | Merge these labels with existing ones (mutually exclusive with replaceLabels) |
version | string | null | no | Version information |
monitoringEndpoint | string | null | no | Monitoring endpoint URL |
dashscopeApiDialect | DashScopeApiDialect | null | no | Update the DashScope request and response API dialect. Valid only for the DASHSCOPE provider. Omit to preserve the stored dialect. Changing apiPath to a recognized canonical DashScope dialect infers its matching dialect; a custom path preserves an existing dialect, while a legacy null dialect is inferred. |
Response Shapes
Response shape types model values returned by the SDK after forward-compatible unknown enum strings are coerced to null.
ListRerankersResponseShape
| Field | Type | Required | Description |
|---|---|---|---|
rerankers | Array<RerankerResponseShape> | yes | List of reranker configurations |
RerankerResponseShape
| Field | Type | Required | Description |
|---|---|---|---|
rerankerId | string | yes | Unique identifier of the reranker |
displayName | string | yes | User-facing name of the reranker |
description | string | null | no | Description of the reranker |
providerType | ProviderType | null | yes | Type of reranking provider |
endpointUrl | string | yes | API endpoint URL |
apiPath | string | null | no | API path for reranking request |
modelIdentifier | string | yes | Model identifier |
supportedModalities | Array<Modality | null> | yes | Supported content modalities |
credentials | EndpointAuthenticationResponseShape | null | no | Stored credentials; present only when GetReranker explicitly requests them and the caller has READ_RERANKER_CREDENTIALS. Always omitted from create, update, and list responses. |
labels | Record<string, string> | yes | User-defined labels for categorization |
version | string | null | no | Version information |
monitoringEndpoint | string | null | no | Monitoring endpoint URL |
ownerId | string | yes | Owner ID of the reranker |
createdAt | number | yes | Creation timestamp (milliseconds since epoch) |
updatedAt | number | yes | Last update timestamp (milliseconds since epoch) |
createdById | string | yes | ID of the user who created the reranker |
updatedById | string | yes | ID of the user who last updated the reranker |
dashscopeApiDialect | DashScopeApiDialect | null | no | Configured DashScope request and response API dialect; present only for DashScope configurations with a persisted dialect. |