Rerankers
.NET SDK reference for reranker configurations: creation, lookup, listing, updates, and deletion.
Reranker management — re-scoring of retrieval hits.
Namespace: Goodmem.Client.Api · Class: RerankersApi
Reach this surface as client.Rerankers on a GoodmemClient. Every network method is asynchronous — it returns a Task<T> (or an IAsyncEnumerable<T> for pagination and streaming) and accepts a CancellationToken; the Async suffix marks the standard .NET Task-based async pattern.
Methods
| Method | Summary |
|---|---|
CreateAsync | Create a new reranker. |
GetAsync | Get a reranker by ID. |
ListAsync | List rerankers. |
UpdateAsync | Update a reranker. |
DeleteAsync | Delete a reranker. |
CreateAsync
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.
Declaration
public Task<RerankerResponse> CreateAsync(RerankerCreationRequest request, string? apiKey = null, CancellationToken ct = default)
HTTP — POST /v1/rerankers
Parameters
| Type | Name | Description |
|---|---|---|
RerankerCreationRequest | request | The request payload; the linked model lists every field and its JSON wire name. |
string | apiKey | Bare provider API key. The convenience layer auto-fills provider / endpoint / dimensionality from the bundled model registry and converts the key to structured credentials. Pass null to keep any credentials already set on request. (optional) |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<RerankerResponse> — an awaitable that resolves to RerankerResponse.
Exceptions
| Type | Condition |
|---|---|
ArgumentNullException | request is null. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409). |
Example
var reranker = await client.Rerankers.CreateAsync(
new RerankerCreationRequest
{
DisplayName = "Doc Reranker",
ModelIdentifier = "rerank-2",
Labels = new Dictionary<string, string> { ["env"] = "docs" },
},
"voyage-key-..."
);
Console.WriteLine(reranker.RerankerId);GetAsync
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.
Declaration
public Task<RerankerResponse> GetAsync(string id, RerankersGetOptions? options = null, CancellationToken ct = default)
HTTP — GET /v1/rerankers/{id}
Parameters
| Type | Name | Description |
|---|---|---|
string | id | The unique identifier of the reranker to retrieve |
RerankersGetOptions | options | Options bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional) |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<RerankerResponse> — an awaitable that resolves to RerankerResponse.
Exceptions
| Type | Condition |
|---|---|
ArgumentException | id is null or empty. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409). |
Example
var reranker = await client.Rerankers.GetAsync("your-reranker-id");
Console.WriteLine(reranker.DisplayName);ListAsync
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.
Declaration
public Task<ListRerankersResponse> ListAsync(RerankersListOptions? options = null, CancellationToken ct = default)
HTTP — GET /v1/rerankers
Parameters
| Type | Name | Description |
|---|---|---|
RerankersListOptions | options | Options bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional) |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<ListRerankersResponse> — an awaitable that resolves to ListRerankersResponse.
Exceptions
| Type | Condition |
|---|---|
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409). |
Example
var resp = await client.Rerankers.ListAsync();
foreach (var reranker in resp.Rerankers)
Console.WriteLine($"{reranker.RerankerId} {reranker.DisplayName}");UpdateAsync
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.
Declaration
public Task<RerankerResponse> UpdateAsync(string id, UpdateRerankerRequest request, CancellationToken ct = default)
HTTP — PUT /v1/rerankers/{id}
Parameters
| Type | Name | Description |
|---|---|---|
string | id | The unique identifier of the reranker to update |
UpdateRerankerRequest | request | The request payload; the linked model lists every field and its JSON wire name. |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task<RerankerResponse> — an awaitable that resolves to RerankerResponse.
Exceptions
| Type | Condition |
|---|---|
ArgumentException | id is null or empty. |
ArgumentNullException | request is null. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409). |
Example
var updated = await client.Rerankers.UpdateAsync(
"your-reranker-id",
new UpdateRerankerRequest
{
DisplayName = "Doc Reranker (updated)",
MergeLabels = new Dictionary<string, string> { ["version"] = "2" },
}
);
Console.WriteLine(updated.RerankerId);DeleteAsync
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.
Declaration
public Task DeleteAsync(string id, CancellationToken ct = default)
HTTP — DELETE /v1/rerankers/{id}
Parameters
| Type | Name | Description |
|---|---|---|
string | id | The unique identifier of the reranker to delete |
CancellationToken | ct | Cancellation / deadline signal for the call. (optional) |
Returns
Task — completes when the operation finishes; there is no response body.
Exceptions
| Type | Condition |
|---|---|
ArgumentException | id is null or empty. |
NetworkException | The request could not reach the server (DNS, connection, or TLS failure). |
ApiException | The server returned a non-success (non-2xx) status. A status-specific subtype is thrown where it applies — e.g. NotFoundException (404), PermissionDeniedException (403), ConflictException (409). |
Example
await client.Rerankers.DeleteAsync("your-reranker-id");Data Models
Types in the Goodmem.Client.Models namespace. Each row lists the C# property, its type, the JSON wire name, and a description.
RerankerCreationRequest
Request body for creating a new Reranker. A Reranker represents a configuration for reranking search results.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
DisplayName | string | displayName | User-facing name of the reranker |
Description | string | description | Description of the reranker (optional) |
ProviderType | ProviderType | providerType | Type of reranking provider |
EndpointUrl | string | endpointUrl | API endpoint URL |
ApiPath | string | apiPath | API path for reranking request (defaults: Cohere /v2/rerank, Jina /v1/rerank, others /rerank) (optional) |
ModelIdentifier | string | modelIdentifier | Model identifier |
SupportedModalities | IReadOnlyList<Modality> | supportedModalities | Supported content modalities (defaults to TEXT if not provided) (optional) |
Credentials | EndpointAuthentication | credentials | Structured credential payload describing how to authenticate with the provider. Required for SaaS providers; optional for local or proxy providers. (optional) |
Labels | IReadOnlyDictionary<string, string> | labels | User-defined labels for categorization (optional) |
Version | string | version | Version information (optional) |
MonitoringEndpoint | string | monitoringEndpoint | Monitoring endpoint URL (optional) |
OwnerId | string | ownerId | Optional owner principal UUID. If omitted, defaults to the authenticated principal. CREATE_RERANKER is evaluated against the proposed reranker and owner. (optional) |
RerankerId | string | rerankerId | Optional client-provided UUID for idempotent creation. If not provided, server generates a new UUID. Returns ALREADY_EXISTS if ID is already in use. (optional) |
DashscopeApiDialect | DashScopeApiDialect | dashscopeApiDialect | 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. (optional) |
RerankerResponse
Reranker configuration information
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
RerankerId | string | rerankerId | Unique identifier of the reranker |
DisplayName | string | displayName | User-facing name of the reranker |
Description | string | description | Description of the reranker (optional) |
ProviderType | ProviderType | providerType | Type of reranking provider |
EndpointUrl | string | endpointUrl | API endpoint URL |
ApiPath | string | apiPath | API path for reranking request (optional) |
ModelIdentifier | string | modelIdentifier | Model identifier |
SupportedModalities | IReadOnlyList<Modality> | supportedModalities | Supported content modalities |
Credentials | EndpointAuthentication | credentials | Stored credentials; present only when GetReranker explicitly requests them and the caller has READ_RERANKER_CREDENTIALS. Always omitted from create, update, and list responses. (optional) |
Labels | IReadOnlyDictionary<string, string> | labels | User-defined labels for categorization |
Version | string | version | Version information (optional) |
MonitoringEndpoint | string | monitoringEndpoint | Monitoring endpoint URL (optional) |
OwnerId | string | ownerId | Owner ID of the reranker |
CreatedAt | DateTimeOffset | createdAt | Creation timestamp (milliseconds since epoch) |
UpdatedAt | DateTimeOffset | updatedAt | Last update timestamp (milliseconds since epoch) |
CreatedById | string | createdById | ID of the user who created the reranker |
UpdatedById | string | updatedById | ID of the user who last updated the reranker |
DashscopeApiDialect | DashScopeApiDialect | dashscopeApiDialect | Configured DashScope request and response API dialect; present only for DashScope configurations with a persisted dialect. (optional) |
ListRerankersResponse
Response containing a list of rerankers
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
Rerankers | IReadOnlyList<RerankerResponse> | rerankers | List of reranker configurations |
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.
| Property | Type | JSON (wire) | Description |
|---|---|---|---|
DisplayName | string | displayName | User-facing name of the reranker (optional) |
Description | string | description | Description of the reranker (optional) |
EndpointUrl | string | endpointUrl | API endpoint URL (optional) |
ApiPath | string | apiPath | API path for reranking request (optional) |
ModelIdentifier | string | modelIdentifier | Model identifier (optional) |
SupportedModalities | IReadOnlyList<Modality> | supportedModalities | 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) (optional) |
Credentials | EndpointAuthentication | credentials | Replace stored credentials. Omit this field to preserve the current credentials; a present empty payload is invalid and never clears them. (optional) |
ReplaceLabels | IReadOnlyDictionary<string, string> | replaceLabels | Replace all existing labels with these (mutually exclusive with mergeLabels) (optional) |
MergeLabels | IReadOnlyDictionary<string, string> | mergeLabels | Merge these labels with existing ones (mutually exclusive with replaceLabels) (optional) |
Version | string | version | Version information (optional) |
MonitoringEndpoint | string | monitoringEndpoint | Monitoring endpoint URL (optional) |
DashscopeApiDialect | DashScopeApiDialect | dashscopeApiDialect | 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. (optional) |