GoodMemGoodMem
ReferenceSdkV2Go

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 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.

HTTPPOST /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 on req.

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)
}
_ = reranker

func (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.

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

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.DisplayName

func (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.

HTTPGET /v1/rerankers

Parameters

  • ctx (context.Context) — carries the deadline and cancellation signal for the call.
  • params (*RerankersListParams, optional) — typed query parameters; pass nil for 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.

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

Parameters

  • ctx (context.Context) — carries the deadline and cancellation signal for the call.
  • id (string) — The unique identifier of the reranker to update
  • req (*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.RerankerID

func (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.

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

Parameters

  • ctx (context.Context) — carries the deadline and cancellation signal for the call.
  • id (string) — The unique identifier of the reranker to delete

Returnserrornil 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, wire displayName) — User-facing name of the reranker
  • Description (string, optional, wire description) — Description of the reranker
  • ProviderType (models.ProviderType, wire providerType) — Type of reranking provider
  • EndpointURL (string, wire endpointUrl) — API endpoint URL
  • APIPath (string, optional, wire apiPath) — API path for reranking request (defaults: Cohere /v2/rerank, Jina /v1/rerank, others /rerank)
  • ModelIdentifier (string, wire modelIdentifier) — Model identifier
  • SupportedModalities ([]models.Modality, optional, wire supportedModalities) — Supported content modalities (defaults to TEXT if not provided)
  • Credentials (models.EndpointAuthentication, optional, wire credentials) — 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, wire labels) — User-defined labels for categorization
  • Version (string, optional, wire version) — Version information
  • MonitoringEndpoint (string, optional, wire monitoringEndpoint) — Monitoring endpoint URL
  • OwnerID (string, optional, wire ownerId) — Optional owner ID. If not provided, derived from the authentication context. Requires CREATE_RERANKER_ANY permission if specified.
  • RerankerID (string, optional, wire 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.

type RerankerResponse

type RerankerResponse struct{ … }

Reranker configuration information

  • RerankerID (string, wire rerankerId) — Unique identifier of the reranker
  • DisplayName (string, wire displayName) — User-facing name of the reranker
  • Description (string, optional, wire description) — Description of the reranker
  • ProviderType (models.ProviderType, wire providerType) — Type of reranking provider
  • EndpointURL (string, wire endpointUrl) — API endpoint URL
  • APIPath (string, optional, wire apiPath) — API path for reranking request
  • ModelIdentifier (string, wire modelIdentifier) — Model identifier
  • SupportedModalities ([]models.Modality, wire supportedModalities) — Supported content modalities
  • Credentials (models.EndpointAuthentication, optional, wire credentials) — Structured credential payload used for upstream authentication
  • Labels (map[string]string, wire labels) — User-defined labels for categorization
  • Version (string, optional, wire version) — Version information
  • MonitoringEndpoint (string, optional, wire monitoringEndpoint) — Monitoring endpoint URL
  • OwnerID (string, wire ownerId) — Owner ID of the reranker
  • CreatedAt (int64, wire createdAt) — Creation timestamp (milliseconds since epoch)
  • UpdatedAt (int64, wire updatedAt) — Last update timestamp (milliseconds since epoch)
  • CreatedByID (string, wire createdById) — ID of the user who created the reranker
  • UpdatedByID (string, wire updatedById) — ID of the user who last updated the reranker

type ListRerankersResponse

type ListRerankersResponse struct{ … }

Response containing a list of rerankers

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, wire displayName) — User-facing name of the reranker
  • Description (string, optional, wire description) — Description of the reranker
  • EndpointURL (string, optional, wire endpointUrl) — API endpoint URL
  • APIPath (string, optional, wire apiPath) — API path for reranking request
  • ModelIdentifier (string, optional, wire modelIdentifier) — Model identifier
  • SupportedModalities ([]models.Modality, optional, wire 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)
  • Credentials (models.EndpointAuthentication, optional, wire credentials) — Structured credential payload describing how to authenticate with the provider. Omit to keep existing credentials.
  • ReplaceLabels (map[string]string, optional, wire replaceLabels) — Replace all existing labels with these (mutually exclusive with mergeLabels)
  • MergeLabels (map[string]string, optional, wire mergeLabels) — Merge these labels with existing ones (mutually exclusive with replaceLabels)
  • Version (string, optional, wire version) — Version information
  • MonitoringEndpoint (string, optional, wire monitoringEndpoint) — Monitoring endpoint URL