GoodMemGoodMem
ReferenceClient SDKs.NET

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

MethodSummary
CreateAsyncCreate a new reranker.
GetAsyncGet a reranker by ID.
ListAsyncList rerankers.
UpdateAsyncUpdate a reranker.
DeleteAsyncDelete 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)

HTTPPOST /v1/rerankers

Parameters

TypeNameDescription
RerankerCreationRequestrequestThe request payload; the linked model lists every field and its JSON wire name.
stringapiKeyBare 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)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<RerankerResponse> — an awaitable that resolves to RerankerResponse.

Exceptions

TypeCondition
ArgumentNullExceptionrequest is null.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe 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)

HTTPGET /v1/rerankers/&#123;id&#125;

Parameters

TypeNameDescription
stringidThe unique identifier of the reranker to retrieve
RerankersGetOptionsoptionsOptions bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<RerankerResponse> — an awaitable that resolves to RerankerResponse.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe 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)

HTTPGET /v1/rerankers

Parameters

TypeNameDescription
RerankersListOptionsoptionsOptions bag carrying the lookup key(s) / convenience knobs; the linked type lists them all. (optional)
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<ListRerankersResponse> — an awaitable that resolves to ListRerankersResponse.

Exceptions

TypeCondition
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe 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)

HTTPPUT /v1/rerankers/&#123;id&#125;

Parameters

TypeNameDescription
stringidThe unique identifier of the reranker to update
UpdateRerankerRequestrequestThe request payload; the linked model lists every field and its JSON wire name.
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task<RerankerResponse> — an awaitable that resolves to RerankerResponse.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
ArgumentNullExceptionrequest is null.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe 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)

HTTPDELETE /v1/rerankers/&#123;id&#125;

Parameters

TypeNameDescription
stringidThe unique identifier of the reranker to delete
CancellationTokenctCancellation / deadline signal for the call. (optional)

Returns

Task — completes when the operation finishes; there is no response body.

Exceptions

TypeCondition
ArgumentExceptionid is null or empty.
NetworkExceptionThe request could not reach the server (DNS, connection, or TLS failure).
ApiExceptionThe 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.

PropertyTypeJSON (wire)Description
DisplayNamestringdisplayNameUser-facing name of the reranker
DescriptionstringdescriptionDescription of the reranker (optional)
ProviderTypeProviderTypeproviderTypeType of reranking provider
EndpointUrlstringendpointUrlAPI endpoint URL
ApiPathstringapiPathAPI path for reranking request (defaults: Cohere /v2/rerank, Jina /v1/rerank, others /rerank) (optional)
ModelIdentifierstringmodelIdentifierModel identifier
SupportedModalitiesIReadOnlyList<Modality>supportedModalitiesSupported content modalities (defaults to TEXT if not provided) (optional)
CredentialsEndpointAuthenticationcredentialsStructured credential payload describing how to authenticate with the provider. Required for SaaS providers; optional for local or proxy providers. (optional)
LabelsIReadOnlyDictionary<string, string>labelsUser-defined labels for categorization (optional)
VersionstringversionVersion information (optional)
MonitoringEndpointstringmonitoringEndpointMonitoring endpoint URL (optional)
OwnerIdstringownerIdOptional owner principal UUID. If omitted, defaults to the authenticated principal. CREATE_RERANKER is evaluated against the proposed reranker and owner. (optional)
RerankerIdstringrerankerIdOptional client-provided UUID for idempotent creation. If not provided, server generates a new UUID. Returns ALREADY_EXISTS if ID is already in use. (optional)
DashscopeApiDialectDashScopeApiDialectdashscopeApiDialectDashScope 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

PropertyTypeJSON (wire)Description
RerankerIdstringrerankerIdUnique identifier of the reranker
DisplayNamestringdisplayNameUser-facing name of the reranker
DescriptionstringdescriptionDescription of the reranker (optional)
ProviderTypeProviderTypeproviderTypeType of reranking provider
EndpointUrlstringendpointUrlAPI endpoint URL
ApiPathstringapiPathAPI path for reranking request (optional)
ModelIdentifierstringmodelIdentifierModel identifier
SupportedModalitiesIReadOnlyList<Modality>supportedModalitiesSupported content modalities
CredentialsEndpointAuthenticationcredentialsStored credentials; present only when GetReranker explicitly requests them and the caller has READ_RERANKER_CREDENTIALS. Always omitted from create, update, and list responses. (optional)
LabelsIReadOnlyDictionary<string, string>labelsUser-defined labels for categorization
VersionstringversionVersion information (optional)
MonitoringEndpointstringmonitoringEndpointMonitoring endpoint URL (optional)
OwnerIdstringownerIdOwner ID of the reranker
CreatedAtDateTimeOffsetcreatedAtCreation timestamp (milliseconds since epoch)
UpdatedAtDateTimeOffsetupdatedAtLast update timestamp (milliseconds since epoch)
CreatedByIdstringcreatedByIdID of the user who created the reranker
UpdatedByIdstringupdatedByIdID of the user who last updated the reranker
DashscopeApiDialectDashScopeApiDialectdashscopeApiDialectConfigured DashScope request and response API dialect; present only for DashScope configurations with a persisted dialect. (optional)

ListRerankersResponse

Response containing a list of rerankers

PropertyTypeJSON (wire)Description
RerankersIReadOnlyList<RerankerResponse>rerankersList 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.

PropertyTypeJSON (wire)Description
DisplayNamestringdisplayNameUser-facing name of the reranker (optional)
DescriptionstringdescriptionDescription of the reranker (optional)
EndpointUrlstringendpointUrlAPI endpoint URL (optional)
ApiPathstringapiPathAPI path for reranking request (optional)
ModelIdentifierstringmodelIdentifierModel identifier (optional)
SupportedModalitiesIReadOnlyList<Modality>supportedModalitiesUpdate 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)
CredentialsEndpointAuthenticationcredentialsReplace stored credentials. Omit this field to preserve the current credentials; a present empty payload is invalid and never clears them. (optional)
ReplaceLabelsIReadOnlyDictionary<string, string>replaceLabelsReplace all existing labels with these (mutually exclusive with mergeLabels) (optional)
MergeLabelsIReadOnlyDictionary<string, string>mergeLabelsMerge these labels with existing ones (mutually exclusive with replaceLabels) (optional)
VersionstringversionVersion information (optional)
MonitoringEndpointstringmonitoringEndpointMonitoring endpoint URL (optional)
DashscopeApiDialectDashScopeApiDialectdashscopeApiDialectUpdate 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)