Rerankers
Go SDK reference for reranker configurations: creation, lookup, listing, updates, and deletion.
package goodmem // import "fury.io/pairsys/goodmem"Reranker management — re-scoring of retrieval hits.
Methods are called as client.Rerankers().<Method>(ctx, ...) on a *goodmem.Client. Service: RerankersService.
Index
- type RerankersService
- type RerankerCreationRequest
- type RerankerResponse
- type ListRerankersResponse
- type UpdateRerankerRequest
type RerankersService
type RerankersService struct{ … }
Access this service as client.Rerankers() on a *goodmem.Client. Its methods follow.
func (s *RerankersService) Create
func (s *RerankersService) Create(ctx context.Context, req *models.RerankerCreationRequest, apiKey string) (*models.RerankerResponse, error)
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
ctx(context.Context) — carries the deadline and cancellation signal for the call.req(*models.RerankerCreationRequest) — the request payload. The linked type documents every field and its JSON wire name.apiKey(string) — bare provider API key. The convenience layer auto-fills provider / endpoint / dimensionality from the bundled model registry (keyed by the request's model identifier) and converts the key to structured credentials. Pass""to keep any credentials already set onreq.
Returns — (*models.RerankerResponse, error)
Example
reranker, err := client.Rerankers().Create(ctx, &models.RerankerCreationRequest{
DisplayName: "Doc Reranker",
ModelIdentifier: "rerank-2",
Labels: map[string]string{"env": "docs"},
}, "voyage-key-...")
if err != nil {
log.Fatal(err)
}
_ = rerankerfunc (s *RerankersService) Get
func (s *RerankersService) Get(ctx context.Context, id string, params *RerankersGetParams) (*models.RerankerResponse, error)
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
ctx(context.Context) — carries the deadline and cancellation signal for the call.id(string) — The unique identifier of the reranker to retrieveparams(*RerankersGetParams, optional) — typed query parameters; passnilfor an empty filter set.
Returns — (*models.RerankerResponse, error)
Example
reranker, err := client.Rerankers().Get(ctx, "your-reranker-id", nil)
if err != nil {
log.Fatal(err)
}
_ = reranker.DisplayNamefunc (s *RerankersService) List
func (s *RerankersService) List(ctx context.Context, params *RerankersListParams) (*models.ListRerankersResponse, error)
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
ctx(context.Context) — carries the deadline and cancellation signal for the call.params(*RerankersListParams, optional) — typed query parameters; passnilfor an empty filter set.
Returns — (*models.ListRerankersResponse, error)
Example
resp, err := client.Rerankers().List(ctx, nil)
if err != nil {
log.Fatal(err)
}
for _, rr := range resp.Rerankers {
_ = rr.RerankerID
_ = rr.DisplayName
}func (s *RerankersService) Update
func (s *RerankersService) Update(ctx context.Context, id string, req *models.UpdateRerankerRequest) (*models.RerankerResponse, error)
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
ctx(context.Context) — carries the deadline and cancellation signal for the call.id(string) — The unique identifier of the reranker to updatereq(*models.UpdateRerankerRequest) — the request payload. The linked type documents every field and its JSON wire name.
Returns — (*models.RerankerResponse, error)
Example
updated, err := client.Rerankers().Update(ctx, "your-reranker-id", &models.UpdateRerankerRequest{
DisplayName: goodmem.Ptr("Doc Reranker (updated)"),
MergeLabels: map[string]string{"version": "2"},
})
if err != nil {
log.Fatal(err)
}
_ = updated.RerankerIDfunc (s *RerankersService) Delete
func (s *RerankersService) Delete(ctx context.Context, id string) error
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
ctx(context.Context) — carries the deadline and cancellation signal for the call.id(string) — The unique identifier of the reranker to delete
Returns — error — nil on success.
Example
err := client.Rerankers().Delete(ctx, "your-reranker-id")
if err != nil {
log.Fatal(err)
}type RerankerCreationRequest
type RerankerCreationRequest struct{ … }
Request body for creating a new Reranker. A Reranker represents a configuration for reranking search results.
DisplayName(string, wiredisplayName) — User-facing name of the rerankerDescription(string, optional, wiredescription) — Description of the rerankerProviderType(models.ProviderType, wireproviderType) — Type of reranking providerEndpointURL(string, wireendpointUrl) — API endpoint URLAPIPath(string, optional, wireapiPath) — API path for reranking request (defaults: Cohere /v2/rerank, Jina /v1/rerank, others /rerank)ModelIdentifier(string, wiremodelIdentifier) — Model identifierSupportedModalities([]models.Modality, optional, wiresupportedModalities) — Supported content modalities (defaults to TEXT if not provided)Credentials(models.EndpointAuthentication, optional, wirecredentials) — Structured credential payload describing how to authenticate with the provider. Required for SaaS providers; optional for local or proxy providers.Labels(map[string]string, optional, wirelabels) — User-defined labels for categorizationVersion(string, optional, wireversion) — Version informationMonitoringEndpoint(string, optional, wiremonitoringEndpoint) — Monitoring endpoint URLOwnerID(string, optional, wireownerId) — Optional owner principal UUID. If omitted, defaults to the authenticated principal. CREATE_RERANKER is evaluated against the proposed reranker and owner.RerankerID(string, optional, wirererankerId) — 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(models.DashScopeApiDialect, optional, wiredashscopeApiDialect) — 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.
type RerankerResponse
type RerankerResponse struct{ … }
Reranker configuration information
RerankerID(string, wirererankerId) — Unique identifier of the rerankerDisplayName(string, wiredisplayName) — User-facing name of the rerankerDescription(string, optional, wiredescription) — Description of the rerankerProviderType(models.ProviderType, wireproviderType) — Type of reranking providerEndpointURL(string, wireendpointUrl) — API endpoint URLAPIPath(string, optional, wireapiPath) — API path for reranking requestModelIdentifier(string, wiremodelIdentifier) — Model identifierSupportedModalities([]models.Modality, wiresupportedModalities) — Supported content modalitiesCredentials(models.EndpointAuthentication, optional, wirecredentials) — 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(map[string]string, wirelabels) — User-defined labels for categorizationVersion(string, optional, wireversion) — Version informationMonitoringEndpoint(string, optional, wiremonitoringEndpoint) — Monitoring endpoint URLOwnerID(string, wireownerId) — Owner ID of the rerankerCreatedAt(int64, wirecreatedAt) — Creation timestamp (milliseconds since epoch)UpdatedAt(int64, wireupdatedAt) — Last update timestamp (milliseconds since epoch)CreatedByID(string, wirecreatedById) — ID of the user who created the rerankerUpdatedByID(string, wireupdatedById) — ID of the user who last updated the rerankerDashscopeAPIDialect(models.DashScopeApiDialect, optional, wiredashscopeApiDialect) — Configured DashScope request and response API dialect; present only for DashScope configurations with a persisted dialect.
type ListRerankersResponse
type ListRerankersResponse struct{ … }
Response containing a list of rerankers
Rerankers([]models.RerankerResponse, wirererankers) — List of reranker configurations
type UpdateRerankerRequest
type UpdateRerankerRequest struct{ … }
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.
DisplayName(string, optional, wiredisplayName) — User-facing name of the rerankerDescription(string, optional, wiredescription) — Description of the rerankerEndpointURL(string, optional, wireendpointUrl) — API endpoint URLAPIPath(string, optional, wireapiPath) — API path for reranking requestModelIdentifier(string, optional, wiremodelIdentifier) — Model identifierSupportedModalities([]models.Modality, optional, wiresupportedModalities) — 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(models.EndpointAuthentication, optional, wirecredentials) — Replace stored credentials. Omit this field to preserve the current credentials; a present empty payload is invalid and never clears them.ReplaceLabels(map[string]string, optional, wirereplaceLabels) — Replace all existing labels with these (mutually exclusive with mergeLabels)MergeLabels(map[string]string, optional, wiremergeLabels) — Merge these labels with existing ones (mutually exclusive with replaceLabels)Version(string, optional, wireversion) — Version informationMonitoringEndpoint(string, optional, wiremonitoringEndpoint) — Monitoring endpoint URLDashscopeAPIDialect(models.DashScopeApiDialect, optional, wiredashscopeApiDialect) — 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.