Rerankers
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 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.
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) (*models.RerankerResponse, error)
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.
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 retrieve
Returns — (*models.RerankerResponse, error)
Example
reranker, err := client.Rerankers().Get(ctx, "your-reranker-id")
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. 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.
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. The linked pkg.go.dev page lists every field.
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 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.
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_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.
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 ID. If not provided, derived from the authentication context. Requires CREATE_RERANKER_ANY permission if specified.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.
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) — Structured credential payload used for upstream authenticationLabels(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 reranker
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) — Structured credential payload describing how to authenticate with the provider. Omit to keep existing credentials.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 URL