GoodMemGoodMem
ReferenceAPIgRPC API

Reranker

gRPC RerankerService reference for CreateReranker, GetReranker, ListRerankers, UpdateReranker and other RPCs, with request messages, response types, and service documentation.

Services

RerankerService Service

Service for managing Rerankers in the GoodMem system.

Authentication: All methods require valid API key authentication via gRPC metadata:

  • Metadata key: authorization
  • Value format: Bearer <api-key>

Global errors: All RPCs may return DEADLINE_EXCEEDED, CANCELLED, UNAVAILABLE, RESOURCE_EXHAUSTED, INTERNAL.

Authorization model:

  • Every RPC evaluates a typed authorization operation against the GoodMem instance or a particular reranker.
  • Ownership, code-defined role assignments, and direct grants can supply authority; an API-key ceiling may further restrict the authenticated principal's effective authority.
  • Listing requires LIST_RERANKER on the instance and returns only rerankers on which the caller has READ_RERANKER.

CreateReranker

Summary: Creates a new neural reranking service configuration.

Type
Requestgoodmem.v1.CreateRerankerRequest
Responsegoodmem.v1.Reranker

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: CREATE_RERANKER on the proposed reranker, evaluated using its proposed owner.

Request Parameters:

  • display_name (REQUIRED): User-facing name; ≤255 chars after trimming
  • description (OPTIONAL): Descriptive text
  • provider_type (REQUIRED): Service provider type; becomes IMMUTABLE after creation
  • endpoint_url (REQUIRED): HTTP(S) URL; server canonicalizes (trim, lowercase scheme/host, remove default ports, strip trailing '/' from path; preserve query)
  • api_path (OPTIONAL): API path component; if empty, defaults to "/v2/rerank" (Cohere), otherwise "/rerank"
  • model_identifier (REQUIRED): Model name/ID; non-empty after trimming
  • supported_modalities (OPTIONAL): Defaults to [TEXT] if omitted
  • credentials (OPTIONAL): Structured credentials; required only for SaaS providers that enforce authentication
  • labels (OPTIONAL): ≤20 entries; keys/values ≤255 chars; keys [a-z0-9._-]
  • version (OPTIONAL): Version information
  • monitoring_endpoint (OPTIONAL): HTTP(S) URL for health/metrics
  • owner_id (OPTIONAL): Proposed owner principal; defaults to the authenticated principal

Response:

  • Returns the created Reranker with all fields populated
  • credentials is omitted from the response; use GetReranker with include_credentials=true when the stored secret is required

Side Effects:

  • Creates new reranker record in database
  • Sets owner_id to the authenticated principal or specified value after authorization
  • Sets created_by_id from the authenticated actor
  • Performs duplicate detection using the effective provider connection, model configuration, and equivalent credentials after endpoint canonicalization and provider-default resolution

Idempotency: Not idempotent - each call creates a new reranker. Clients SHOULD NOT auto-retry blindly.

Error Codes:

  • UNAUTHENTICATED: Missing or invalid authentication
  • PERMISSION_DENIED: Caller lacks CREATE_RERANKER on the proposed reranker
  • INVALID_ARGUMENT: Required fields empty/missing; invalid URLs; label constraints violated; provider_type unspecified
  • ALREADY_EXISTS: Another reranker for the same owner has the same effective provider connection and model configuration after endpoint canonicalization and provider-default resolution; equivalent credentials participate in this comparison
  • INTERNAL: Unexpected server error

Examples:

grpcurl -plaintext \
-H 'x-api-key: <api-key>' \
-d '{
"display_name": "Cohere Rerank v3",
"provider_type": "COHERE",
"endpoint_url": "https://api.cohere.ai",
"model_identifier": "rerank-english-v3.0",
"credentials": "your-cohere-api-key"
}' \
localhost:8080 goodmem.v1.RerankerService/CreateReranker

Note: bytes fields in JSON must be base64.

GetReranker

Retrieves details of a specific reranker configuration.

Type
Requestgoodmem.v1.GetRerankerRequest
Responsegoodmem.v1.Reranker

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: READ_RERANKER on the requested reranker. When include_credentials is true, the caller must also hold READ_RERANKER_CREDENTIALS; only the current owner or an instance administrator can supply that authority.

Side Effects: None (read-only operation)

Error Codes:

  • UNAUTHENTICATED: Missing or invalid authentication
  • PERMISSION_DENIED: Caller lacks READ_RERANKER, or requests credentials without READ_RERANKER_CREDENTIALS
  • INVALID_ARGUMENT: Invalid reranker_id format (not 16-byte UUID)
  • NOT_FOUND: Reranker with specified ID does not exist
  • INTERNAL: Unexpected server error

Idempotency: Read-only; safe to retry; results may differ as state changes.

Examples:

grpcurl -plaintext \
-H 'x-api-key: <api-key>' \
-d '{"reranker_id": "base64-encoded-uuid-bytes"}' \
localhost:8080 goodmem.v1.RerankerService/GetReranker

Note: bytes fields in JSON must be base64.

ListRerankers

Lists reranker configurations accessible to the authenticated principal.

Type
Requestgoodmem.v1.ListRerankersRequest
Responsegoodmem.v1.ListRerankersResponse

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: LIST_RERANKER on the GoodMem instance and READ_RERANKER on each returned reranker. The standard user role may enumerate the catalog and read owned rerankers; direct grants can expose additional rerankers.

Request Parameters:

  • owner_id (optional, bytes UUID): Filter the already-authorized result set by owner
  • provider_type (optional): Filter by provider type; PROVIDER_TYPE_UNSPECIFIED ignored
  • label_selectors (optional): AND of exact key=value matches (case-sensitive)

Response:

  • Returns list of Reranker records accessible to the principal
  • credentials fields are always omitted from list responses
  • Results ordered by created_at descending

Side Effects: None (read-only operation)

Error Codes:

  • UNAUTHENTICATED: Missing or invalid authentication
  • PERMISSION_DENIED: Caller lacks instance-level LIST_RERANKER
  • INVALID_ARGUMENT: Invalid owner_id format (not 16-byte UUID)
  • INTERNAL: Unexpected server error

Idempotency: Read-only; safe to retry; results may change over time.

Examples:

grpcurl -plaintext \
-H 'x-api-key: <api-key>' \
-d '{"provider_type": "COHERE"}' \
localhost:8080 goodmem.v1.RerankerService/ListRerankers

Note: bytes fields in JSON must be base64.

UpdateReranker

Updates mutable properties of a reranker configuration.

Type
Requestgoodmem.v1.UpdateRerankerRequest
Responsegoodmem.v1.Reranker

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: UPDATE_RERANKER on the requested reranker.

Summary:

  • Only mutable fields can be updated: display_name, description, endpoint_url, api_path, model_identifier, supported_modalities, credentials, version, monitoring_endpoint, labels
  • For supported_modalities, a non-empty list replaces the stored set; omission or an empty list leaves it unchanged and does not count as an update by itself
  • provider_type and owner_id are immutable
  • Label updates support replace (clear all, set new) or merge (upsert) strategies
  • Omitting credentials preserves the stored value; a present empty payload is invalid
  • The response always omits stored credentials

Side Effects:

  • Persists changes; updates updated_at and updated_by_id
  • Performs duplicate detection if endpoint_url, api_path, or model_identifier changed

Error Codes:

  • UNAUTHENTICATED: Missing or invalid authentication
  • PERMISSION_DENIED: Caller lacks UPDATE_RERANKER on the requested reranker
  • INVALID_ARGUMENT: Invalid reranker_id format; both label strategies set; provider_type specified; empty required fields
  • NOT_FOUND: Reranker with specified ID does not exist
  • ALREADY_EXISTS: The resulting effective provider connection and model configuration would duplicate another reranker for the same owner
  • INTERNAL: Unexpected server error

Idempotency: Idempotent with identical input; safe to retry.

Examples:

grpcurl -plaintext \
-H 'x-api-key: <api-key>' \
-d '{
"reranker_id": "base64-encoded-uuid-bytes",
"display_name": "Updated Reranker Name",
"merge_labels": {"labels": {"environment": "production"}}
}' \
localhost:8080 goodmem.v1.RerankerService/UpdateReranker

Note: bytes fields in JSON must be base64.

DeleteReranker

Permanently deletes a reranker configuration.

Type
Requestgoodmem.v1.DeleteRerankerRequest
Responsegoogle.protobuf.Empty

Auth: gRPC metadata x-api-key: <api-key>

Authorization Required: DELETE_RERANKER on the requested reranker.

Side Effects:

  • Permanently removes reranker record from database
  • Invalidates any cached references to this reranker
  • Does not affect historical usage data or audit logs

Error Codes:

  • UNAUTHENTICATED: Missing or invalid authentication
  • PERMISSION_DENIED: Caller lacks DELETE_RERANKER on the requested reranker
  • INVALID_ARGUMENT: Invalid reranker_id format (not 16-byte UUID)
  • NOT_FOUND: Reranker with specified ID does not exist or was already deleted
  • INTERNAL: Unexpected server error

Idempotency: Safe to retry; may return NOT_FOUND if already deleted or never existed.

Examples:

grpcurl -plaintext \
-H 'x-api-key: <api-key>' \
-d '{"reranker_id": "base64-encoded-uuid-bytes"}' \
localhost:8080 goodmem.v1.RerankerService/DeleteReranker

Note: bytes fields in JSON must be base64.

Messages

Reranker

Represents a connection to a neural reranking service for post-processing search results.

Rerankers improve search relevance by re-scoring and re-ordering initial retrieval results using sophisticated neural networks or large language models. This includes cross-encoder neural networks, LLM-based reranking services, and other AI-powered relevance models. Algorithmic rerankers (like MMR) are built into the platform and don't require configuration.

Security:

  • credentials are returned only by GetReranker when explicitly requested and separately authorized. Create, update, and list responses omit them.

Immutability:

  • provider_type is IMMUTABLE after creation.
  • owner_id is set at creation and cannot be modified.

Duplicate detection:

  • Uniqueness is enforced per-owner after endpoint canonicalization and provider-default resolution. The effective provider connection, model configuration, and equivalent credentials participate in the comparison.

Notes:

  • All timestamps are UTC (google.protobuf.Timestamp).

See also: goodmem.v1.ProviderType, goodmem.v1.Modality

FieldTypeDescription
reranker_idbytesOUTPUT_ONLY UUID (16 bytes); immutable primary identifier
display_namestringREQUIRED on create; ≤255 chars after trimming; cannot be empty; user-facing name
descriptionstringOPTIONAL descriptive text
provider_typegoodmem.v1.ProviderTypeREQUIRED on create; IMMUTABLE thereafter; service provider type. See: goodmem.v1.ProviderType
endpoint_urlstringREQUIRED HTTP(S) URL; server canonicalizes (trim, lowercase scheme/host, remove default ports, strip trailing '/' from path; preserve query); used in duplicate detection
api_pathstringOPTIONAL relative path (no scheme/host; preserve trailing '/' and query); if empty on create, defaults to "/v2/rerank" (Cohere), otherwise "/rerank"
model_identifierstringREQUIRED on create; non-empty after trimming; model name or ID
supported_modalitiesgoodmem.v1.ModalityOUTPUT semantics: server-stored set; defaults to [TEXT] if omitted at create. See: goodmem.v1.Modality
credentials...dmem.v1.EndpointAuthenticationOPTIONAL structured credentials for upstream authentication; may be empty when provider allows anonymous requests
labels...oodmem.v1.Reranker.LabelsEntryOPTIONAL; ≤20 entries; keys/values ≤255 chars; keys [a-z0-9._-] case-sensitive; merge overwrites on exact key match
versionstringOPTIONAL version information
monitoring_endpointstringOPTIONAL HTTP(S) URL for health checks or metrics
owner_idbytesOUTPUT_ONLY owner UUID (16 bytes); set at creation from auth context or request; immutable
dashscope_api_dialectgoodmem.v1.DashScopeApiDialectOPTIONAL persisted DashScope API dialect; present only for PROVIDER_TYPE_DASHSCOPE. See: goodmem.v1.DashScopeApiDialect
created_atgoogle.protobuf.TimestampOUTPUT_ONLY creation timestamp (UTC). See: `google.protobuf.Timestamp`
updated_atgoogle.protobuf.TimestampOUTPUT_ONLY last modification timestamp (UTC). See: `google.protobuf.Timestamp`
created_by_idbytesOUTPUT_ONLY creator actor UUID (16 bytes); derived from auth context at creation
updated_by_idbytesOUTPUT_ONLY last modifier actor UUID (16 bytes); derived from auth context on update

Reranker.LabelsEntry

FieldTypeDescription
keystring
valuestring

CreateRerankerRequest

Structured request for creating a reranker configuration.

FieldTypeDescription
reranker_idbytesOptional: client-provided UUID (16 bytes); server generates if omitted; returns ALREADY_EXISTS if ID exists
display_namestringRequired: User-facing name (≤255 chars after trimming; cannot be empty)
descriptionstringOptional: description of the reranker's purpose
provider_typegoodmem.v1.ProviderTypeRequired: Provider type; PROVIDER_TYPE_UNSPECIFIED → INVALID_ARGUMENT. See: goodmem.v1.ProviderType
endpoint_urlstringRequired: HTTP(S) URL; server canonicalizes (trim, lowercase scheme/host, remove default ports, strip trailing '/' from path; preserve query); duplicate detection uses canonical form
api_pathstringOptional: API path; if empty, defaults to "/v2/rerank" (Cohere), otherwise "/rerank"
model_identifierstringRequired: Model identifier string (non-empty after trimming)
supported_modalitiesgoodmem.v1.ModalityOptional: supported modalities; empty defaults to TEXT only. See: goodmem.v1.Modality
credentials...dmem.v1.EndpointAuthenticationOptional: structured credentials; required only for providers that mandate authentication
labels...ateRerankerRequest.LabelsEntryOptional: labels (≤20 entries; keys/values ≤255 chars; keys [a-z0-9._-], case-sensitive)
versionstringOptional: version information for the model/service
monitoring_endpointstringOptional: HTTP(S) URL for health/metrics
owner_idbytesOptional: owner principal UUID (16 bytes); if omitted → authenticated principal; CREATE_RERANKER is evaluated using this proposed owner
dashscope_api_dialectgoodmem.v1.DashScopeApiDialectOptional DashScope API dialect; valid only for PROVIDER_TYPE_DASHSCOPE and inferred from explicit api_path, then the advisory model catalog, when omitted. See: goodmem.v1.DashScopeApiDialect

CreateRerankerRequest.LabelsEntry

FieldTypeDescription
keystring
valuestring

GetRerankerRequest

Request for retrieving a specific reranker by ID.

FieldTypeDescription
reranker_idbytesRequired: Reranker ID (16 bytes UUID)
include_credentialsboolOptional: Include stored credentials; requires READ_RERANKER_CREDENTIALS and defaults to false

ListRerankersRequest

Request for listing rerankers with optional filtering.

FieldTypeDescription
owner_idbytesOptional: Filter the already-authorized result set by owner principal UUID (16 bytes)
provider_typegoodmem.v1.ProviderTypeOptional: Filter by provider; PROVIDER_TYPE_UNSPECIFIED ignored. See: goodmem.v1.ProviderType
label_selectors...ersRequest.LabelSelectorsEntryOptional: Conjunction (AND) of exact key=value matches; case-sensitive

ListRerankersRequest.LabelSelectorsEntry

FieldTypeDescription
keystring
valuestring

ListRerankersResponse

Response containing rerankers accessible to the caller.

FieldTypeDescription
rerankersgoodmem.v1.RerankerOUTPUT_ONLY list ordered by created_at DESC

UpdateRerankerRequest

Structured request for updating mutable reranker fields. Omit properties to keep existing values.

FieldTypeDescription
reranker_idbytesRequired: UUID (16 bytes) of the reranker to update
display_namestringOptional: New display name (≤255 chars after trimming); omit to keep existing
descriptionstringOptional: Updated description; omit to keep existing
endpoint_urlstringOptional: Updated HTTP(S) URL; server canonicalizes (trim, lowercase scheme/host, remove default ports, strip trailing '/' from path; preserve query); omit to keep existing
api_pathstringOptional: Updated API path; omit to keep existing; set blank to reset to provider default
model_identifierstringOptional: Updated model identifier (non-empty after trimming); omit to keep existing
supported_modalitiesgoodmem.v1.ModalityOptional: If provided with >=1 entries, replaces stored set; omit or empty to leave unchanged and does not count as an update by itself. See: goodmem.v1.Modality
credentials...dmem.v1.EndpointAuthenticationUpdate credentials; omit to leave unchanged; a present empty payload is invalid and never clears stored credentials
versionstringOptional: Updated version information; omit to keep existing
monitoring_endpointstringOptional: Updated monitoring endpoint URL; omit to keep existing
dashscope_api_dialectgoodmem.v1.DashScopeApiDialectOptional: Updated DashScope API dialect; valid only for PROVIDER_TYPE_DASHSCOPE; omit to preserve the stored value. A recognized canonical api_path selects its matching dialect; an unrecognized custom path preserves the stored dialect. See: goodmem.v1.DashScopeApiDialect
replace_labelsgoodmem.v1.StringMapReplaces all labels with provided set (empty clears all labels). See: goodmem.v1.StringMap
merge_labelsgoodmem.v1.StringMapMerges provided entries with existing labels (upsert semantics). See: goodmem.v1.StringMap

DeleteRerankerRequest

Request for permanently deleting a reranker configuration.

FieldTypeDescription
reranker_idbytesRequired: Reranker ID (16 bytes UUID)