GoodMemGoodMem
ReferenceSdkV2.NET

Rerankers

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 identical {ownerId, providerType, endpointUrl, apiPath, modelIdentifier, credentialsFingerprint} after URL canonicalization. Uniqueness is enforced per-owner, allowing different users to have identical configurations. Credentials are hashed (SHA-256) for uniqueness while remaining encrypted. DEFAULTS: apiPath defaults to '/v2/rerank' for Cohere and '/rerank' for other providers if omitted; supportedModalities defaults to [TEXT] if omitted. Requires CREATE_RERANKER_OWN permission (or CREATE_RERANKER_ANY for admin users). 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. Response payloads include stored credentials, matching gRPC response semantics. Requires READ_RERANKER_OWN permission for rerankers you own (or READ_RERANKER_ANY for admin users). This is a read-only operation with no side effects and is safe to retry.

Declaration

public Task<RerankerResponse> GetAsync(string id, CancellationToken ct = default)

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

Parameters

TypeNameDescription
stringidThe unique identifier of the reranker to retrieve
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. Responses include stored credentials, matching gRPC response semantics. LABEL FILTERS: Label filters accept either label.<key>=<value> or label[key]=value (for example, label.environment=production or label[environment]=production). PERMISSION-BASED FILTERING: With LIST_RERANKER_OWN permission, only your own rerankers are shown. With LIST_RERANKER_ANY permission, you can see all rerankers or filter by any ownerId. Specifying ownerId without LIST_RERANKER_ANY permission returns PERMISSION_DENIED.

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 duplicate with same {ownerId, providerType, endpointUrl, apiPath, modelIdentifier, credentialsFingerprint} after URL canonicalization (HTTP 409 Conflict / ALREADY_EXISTS). Requires UPDATE_RERANKER_OWN permission for rerankers you own (or UPDATE_RERANKER_ANY for admin users). 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_OWN permission for rerankers you own (or DELETE_RERANKER_ANY for admin users). 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 ID. If not provided, derived from the authentication context. Requires CREATE_RERANKER_ANY permission if specified. (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)

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
CredentialsEndpointAuthenticationcredentialsStructured credential payload used for upstream authentication (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

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)
CredentialsEndpointAuthenticationcredentialsStructured credential payload describing how to authenticate with the provider. Omit to keep existing credentials. (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)