GoodMem
ReferenceAPIgRPC API

Reranker

Reranker service API reference

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.

Permissions are enforced based on ownership and granted roles:

  • *_OWN permissions allow operations on rerankers owned by the authenticated user
  • *_ANY permissions allow operations on rerankers owned by any user (admin-level)

CreateReranker

Summary: Creates a new neural reranking service configuration.

Type
Requestgoodmem.v1.CreateRerankerRequest
Responsegoodmem.v1.Reranker

Auth: gRPC metadata authorization: Bearer <api-key>

Permissions Required: CREATE_RERANKER_OWN or CREATE_RERANKER_ANY

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 by stripping trailing slash
  • api_path (OPTIONAL): API path component; defaults to "/rerank" if empty
  • 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): If provided, requires CREATE_RERANKER_ANY permission

Response:

  • Returns the created Reranker with all fields populated
  • credentials field is omitted from response for security

Side Effects:

  • Creates new reranker record in database
  • Sets owner_id to authenticated user or specified value (if permitted)
  • Sets created_by_id to authenticated user
  • Performs duplicate detection based on {endpoint_url, api_path, model_identifier}

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

Error Codes:

  • UNAUTHENTICATED: Missing or invalid authentication
  • PERMISSION_DENIED: User lacks CREATE_RERANKER_OWN or CREATE_RERANKER_ANY permission
  • INVALID_ARGUMENT: Required fields empty/missing; invalid URLs; label constraints violated; provider_type unspecified
  • ALREADY_EXISTS: Duplicate reranker exists with same {owner_id, provider_type, endpoint_url, api_path, model_identifier, credentials_fingerprint} after URL canonicalization; credentials_fingerprint is SHA-256 hash of normalized credentials
  • INTERNAL: Unexpected server error

Examples:

grpcurl -plaintext \
-H 'authorization: Bearer <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 authorization: Bearer <api-key>

Permissions Required: READ_RERANKER_OWN or READ_RERANKER_ANY

Side Effects: None (read-only operation)

Error Codes:

  • UNAUTHENTICATED: Missing or invalid authentication
  • PERMISSION_DENIED: User lacks READ_RERANKER_OWN for own resources or READ_RERANKER_ANY for others
  • 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 'authorization: Bearer <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 user.

Type
Requestgoodmem.v1.ListRerankersRequest
Responsegoodmem.v1.ListRerankersResponse

Auth: gRPC metadata authorization: Bearer <api-key>

Permissions Required: LIST_RERANKER_OWN or LIST_RERANKER_ANY

Request Parameters:

  • owner_id (optional, bytes UUID): Filter by owner; requires LIST_RERANKER_ANY if not authenticated user
  • 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 user
  • credentials fields omitted from all responses for security
  • Results ordered by created_at descending

Side Effects: None (read-only operation)

Error Codes:

  • UNAUTHENTICATED: Missing or invalid authentication
  • PERMISSION_DENIED: User lacks LIST_RERANKER_OWN or specified owner_id without LIST_RERANKER_ANY
  • 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 'authorization: Bearer <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 authorization: Bearer <api-key>

Permissions Required: UPDATE_RERANKER_OWN or UPDATE_RERANKER_ANY

Summary:

  • Only mutable fields can be updated: display_name, description, endpoint_url, api_path, model_identifier, supported_modalities, credentials, version, monitoring_endpoint, labels
  • provider_type and owner_id are immutable
  • Label updates support replace (clear all, set new) or merge (upsert) strategies

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: User lacks UPDATE_RERANKER_OWN for own resources or UPDATE_RERANKER_ANY for others
  • 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: Update would create duplicate with same {endpoint_url, api_path, model_identifier}
  • INTERNAL: Unexpected server error

Idempotency: Idempotent with identical input; safe to retry.

Examples:

grpcurl -plaintext \
-H 'authorization: Bearer <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 authorization: Bearer <api-key>

Permissions Required: DELETE_RERANKER_OWN or DELETE_RERANKER_ANY

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: User lacks DELETE_RERANKER_OWN for own resources or DELETE_RERANKER_ANY for others
  • 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 'authorization: Bearer <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 is INPUT_ONLY and is omitted from all responses.

Immutability:

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

Duplicate detection:

  • Uniqueness is enforced per-owner by the combination of {owner_id, provider_type, endpoint_url, api_path, model_identifier, credentials_fingerprint} after URL canonicalization (trailing slash stripped, case-insensitive host comparison).
  • Credentials are hashed (SHA-256) for uniqueness checking while remaining encrypted for storage.

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 by stripping trailing slash; used in duplicate detection
api_pathstringOPTIONAL API path component; defaults to "/rerank" if empty on create
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.EndpointAuthenticationINPUT_ONLY; optional when provider allows anonymous requests; never returned in responses
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
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 user UUID (16 bytes); derived from auth context at creation
updated_by_idbytesOUTPUT_ONLY last modifier user 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 strips trailing slash; duplicate detection uses canonical form
api_pathstringOptional: API path; if empty, defaults to "/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 ID (16 bytes UUID); if omitted → authenticated user; requires CREATE_RERANKER_ANY if different from caller

CreateRerankerRequest.LabelsEntry

FieldTypeDescription
keystring
valuestring

GetRerankerRequest

Request for retrieving a specific reranker by ID.

FieldTypeDescription
reranker_idbytesRequired: Reranker ID (16 bytes UUID)

ListRerankersRequest

Request for listing rerankers with optional filtering.

FieldTypeDescription
owner_idbytesOptional: Filter by owner (16 bytes UUID); requires LIST_RERANKER_ANY if not caller
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 (credentials omitted for security).

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 strips trailing slash; omit to keep existing
api_pathstringOptional: Updated API path; omit to keep existing
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. See: goodmem.v1.Modality
credentials...dmem.v1.EndpointAuthenticationUpdate credentials; omit to leave unchanged; replaces stored payload when set
versionstringOptional: Updated version information; omit to keep existing
monitoring_endpointstringOptional: Updated monitoring endpoint URL; omit to keep existing
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)