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
| 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 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)
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. 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)
HTTP — GET /v1/rerankers/{id}
Parameters
| Type | Name | Description |
|---|---|---|
string | id | The unique identifier of the reranker to retrieve |
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. 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)
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 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)
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_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)
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 ID. If not provided, derived from the authentication context. Requires CREATE_RERANKER_ANY permission if specified. (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) |
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 | Structured credential payload used for upstream authentication (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 |
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 | Structured credential payload describing how to authenticate with the provider. Omit to keep existing credentials. (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) |