Common
Common service API reference
Messages
GeminiEndpointConfig
Shared routing configuration for a Gemini-backed resource.
The Developer backend forbids project and location. The Google Cloud backend requires a resource
project and defaults an empty location to global. The resource project is distinct from the
quota project carried by GCP ADC credentials for billing and quota attribution. Each resource
API owns its field and may apply additional resource-specific presence and validation rules.
| Field | Type | Description |
|---|---|---|
backend | goodmem.v1.GeminiApiBackend | Required when this message is explicitly supplied; UNSPECIFIED is invalid |
project_id | string | Google Cloud resource project; required only for GOOGLE_CLOUD |
location | string | Google Cloud location; empty defaults to global; valid only for GOOGLE_CLOUD |
ModelInputFormat
Shapes the text that GoodMem sends to an embedder or a reranker.
Some models expect an instruction, a prefix, or a suffix around the text they embed or rank. An input format stores that shaping on the resource: one task instruction and two templates, one applied to query text and one applied to document text. Every field is optional. An absent template sends the text unchanged. An empty format is accepted for every provider; nonempty formats follow the resource's provider policy. Gemini embedder creation stores default templates when the entire input_format is omitted; an explicitly empty format suppresses those defaults.
Templates:
- A template is a Pebble template that uses
{{ }}expressions only.{% %}tags and comments are rejected. Supported filters aredefault,upper,lower,trim, andlength. Case conversion is locale-independent. Supported operators are concatenation, comparisons, boolean logic, and the conditional operator. Supported tests areempty,defined, andnull. Other operations, including functions and methods, are rejected. {{ content }}stands for the query or document text. It must appear exactly once, with no filter applied to it.query_templatecan also readinstruction.document_templatecan also readmemory.metadata.<key>,memory.createdAt(ISO-8601, UTC, three fractional-second digits), andchunk.sequenceNumber(zero-based). These names are literal template identifiers in every SDK.memory.metadata.<key>reads a top-level key of the memory's metadata. String, number, and boolean values are available; a missing key or any other value renders empty, so thedefaultfilter applies. A string value is trimmed, each run of whitespace becomes one space, and the result is cut to 256 Unicode code points.- Literal line breaks (LF, CRLF, and CR) are kept, including those directly after
}}and at the end of a template. Leading and trailing whitespace is part of what the model receives. - The JSON escape
\nin a REST request becomes a literal line break before GoodMem reads the template. This differs from a backslash escape such as\ninside a Pebble quoted string: Pebble does not interpret that escape, and GoodMem rejects it.
Instruction:
- The instruction is plain text, not a template. A blank instruction counts as unset. Instructions and templates cannot contain U+0000 (NUL).
- GoodMem selects one instruction delivery channel. When
query_templatereferencesinstruction, the template controls the rendered text and GoodMem omits the provider's own instruction field. Otherwise GoodMem sends the instruction in that field when the provider has one. An instruction with neither channel isINVALID_ARGUMENT. - A template can transform, omit, or repeat the instruction through its expressions. Referencing
instructiondoes not guarantee one verbatim occurrence in the rendered text. To preserve it, output{{ instruction }}once without a filter or condition. - A
query_templatethat reads{{ instruction }}needs an instruction, unless it gives a fallback such as{{ instruction | default('...') }}.
Limits: instruction and each template hold at most 2,048 Unicode code points. Each expression
holds at most 128 tokens. Every intermediate value is conservatively bounded to 8,192 UTF-16
code units before evaluation, including values in both conditional branches and filter
arguments. Rendered text added around the content also holds at most 8,192 UTF-16 code units;
actual content is excluded. These limits apply on every rendering, including cached templates.
See
Model input formats for the shared reference.
Validation failures are INVALID_ARGUMENT and name the field and the rule.
| Field | Type | Description |
|---|---|---|
instruction | string | OPTIONAL plain-text task instruction; ≤2,048 Unicode code points; blank counts as unset |
query_template | string | OPTIONAL Pebble template applied to query text; must output {{ content }} exactly once; can read instruction; ≤2,048 Unicode code points; empty counts as unset |
document_template | string | OPTIONAL Pebble template applied to document text; must output {{ content }} exactly once; can read memory.metadata.<key>, memory.createdAt, chunk.sequenceNumber; ≤2,048 Unicode code points; empty counts as unset |
StringMap
A wrapper for a string-to-string map.
This is a workaround for a limitation in Protocol Buffers where a map field
cannot be directly placed in a oneof. By wrapping the map in this message,
it can be used in oneof fields for update strategies, such as replacing vs.
merging labels in update RPCs.
| Field | Type | Description |
|---|---|---|
labels | ...odmem.v1.StringMap.LabelsEntry | The string-to-string map |
StringMap.LabelsEntry
| Field | Type | Description |
|---|---|---|
key | string | |
value | string |
ScalarValue
One scalar value used in caller-supplied attribute maps.
This intentionally excludes nulls, arrays, and nested objects so attribute maps stay small, flat, and query-friendly.
| Field | Type | Description |
|---|---|---|
string_value | string | Exact string value. |
int64_value | int64 | Exact signed 64-bit integer value. |
double_value | double | Exact floating-point value; NaN/Inf invalid. |
bool_value | bool | Exact boolean value. |
GoodMemStatus
Represents a non-fatal status or warning message for GoodMem operations.
This is typically used in streaming RPCs to provide progress updates or report partial failures without stopping the stream.
| Field | Type | Description |
|---|---|---|
code | goodmem.v1.GoodMemStatusCode | A programmatic status code for client-side handling |
message | string | A human-readable description of the status |
details | ....v1.GoodMemStatus.DetailsEntry | Additional context (e.g., embedder_id, space_id) |
GoodMemStatus.DetailsEntry
| Field | Type | Description |
|---|---|---|
key | string | |
value | string |
ChunkingConfig
Defines the strategy for splitting a single document into multiple chunks.
This is a top-level configuration that can be set as a default for a Space or specified for an individual Memory, overriding the space's default. Exactly one chunking strategy must be selected.
| Field | Type | Description |
|---|---|---|
none | ...m.v1.ChunkingConfig.NoChunking | Do not split the document |
recursive | ...unkingConfig.RecursiveChunking | Use the recursive splitting strategy |
sentence | ...hunkingConfig.SentenceChunking | Use the sentence-based splitting strategy |
ChunkingConfig.RecursiveChunking
A strategy that splits text recursively based on a list of separators.
This method iterates through a list of separators (e.g., "\n\n", "\n", " ", ""),
splitting the text at each level until the chunks are smaller than the
specified size.
| Field | Type | Description |
|---|---|---|
chunk_size | uint32 | The target size for each chunk (e.g., 1024). Must be > 0 |
chunk_overlap | uint32 | The number of characters or tokens to overlap between chunks |
separators | string | Hierarchical list of separators to split on, in order of preference |
keep_strategy | ...ngConfig.SeparatorKeepStrategy | How to handle separators after splitting |
separator_is_regex | bool | Whether the separator strings are to be treated as regular expressions |
length_measurement | ...unkingConfig.LengthMeasurement | The method for measuring chunk length |
ChunkingConfig.SentenceChunking
A strategy that splits text based on sentence boundaries.
This method is generally more semantically aware than recursive splitting but may be less predictable in chunk size.
| Field | Type | Description |
|---|---|---|
max_chunk_size | uint32 | The maximum size of a chunk. Must be > 0 |
min_chunk_size | uint32 | The minimum size of a chunk before creating a new one |
enable_language_detection | bool | Whether to detect the language for more accurate sentence segmentation |
length_measurement | ...unkingConfig.LengthMeasurement | The method for measuring chunk length |
ChunkingConfig.NoChunking
A strategy that performs no chunking, treating the document as a single chunk.
Enums
ChunkingConfig.SeparatorKeepStrategy
Defines how to handle separators during recursive chunking.
| Name | Value | Description |
|---|---|---|
SEPARATOR_KEEP_STRATEGY_UNSPECIFIED | 0 | The default value. Invalid on writes |
KEEP_NONE | 1 | Deprecated alias for KEEP_END |
KEEP_START | 2 | Prepend the separator to the following chunk |
KEEP_END | 3 | Append the separator to the preceding chunk (LangChain default) |
ChunkingConfig.LengthMeasurement
Defines the method for measuring the length of a chunk.
| Name | Value | Description |
|---|---|---|
LENGTH_MEASUREMENT_UNSPECIFIED | 0 | The default value. Invalid on writes |
CHARACTER_COUNT | 1 | Measure length by number of characters (default) |
TOKEN_COUNT | 2 | Measure length by number of tokens (requires a server-side tokenizer) |
CUSTOM | 3 | Reserved for custom, server-side-only length functions |
SortOrder
Specifies the sort order for list operations.
| Name | Value | Description |
|---|---|---|
SORT_ORDER_UNSPECIFIED | 0 | The default value. This is invalid on writes and will be rejected. |
ASCENDING | 1 | Sorts results in ascending order (e.g., A-Z, 0-9) |
DESCENDING | 2 | Sorts results in descending order (e.g., Z-A, 9-0) |
ProviderType
Defines the backend provider for an embedder or reranker model.
Note: This enum is shared between embedders and rerankers.
A potential risk is that the list of supported providers may diverge.
For LLMs, a separate LLMProviderType enum is used to avoid this issue.
| Name | Value | Description |
|---|---|---|
PROVIDER_TYPE_UNSPECIFIED | 0 | The default value. This is invalid on writes and will be rejected |
PROVIDER_TYPE_OPENAI | 1 | Models provided by OpenAI (e.g., text-embedding-ada-002) |
PROVIDER_TYPE_VLLM | 2 | Models served via a vLLM-compatible API endpoint |
PROVIDER_TYPE_TEI | 3 | Models served via the HuggingFace Text-Embeddings-Inference (TEI) toolkit |
PROVIDER_TYPE_LLAMA_CPP | 4 | Models served via a Llama.cpp-compatible API endpoint |
PROVIDER_TYPE_VOYAGE | 5 | Models provided by Voyage AI (e.g., rerank-2.5) |
PROVIDER_TYPE_COHERE | 6 | Models provided by Cohere's platform |
PROVIDER_TYPE_JINA | 7 | Models provided by Jina AI or Jina-compatible endpoints |
PROVIDER_TYPE_DASHSCOPE | 8 | Models hosted by Alibaba Cloud Model Studio through GoodMem's DashScope integration |
PROVIDER_TYPE_GEMINI | 9 | Models served by Google's Gemini Developer API or Google Cloud backend |
DashScopeApiDialect
Selects the API dialect used for a DashScope-backed resource.
This is a persisted routing choice, not a provider capability guarantee. It is valid only when the resource's provider is DashScope, and each resource accepts only its corresponding native dialect(s) or compatible dialect. When omitted at creation, the server infers and persists a suggestion from an explicitly supplied API path first, then from its advisory model catalog.
| Name | Value | Description |
|---|---|---|
DASHSCOPE_API_DIALECT_UNSPECIFIED | 0 | Invalid when explicitly supplied on writes |
DASHSCOPE_API_DIALECT_EMBEDDING_NATIVE_TEXT | 1 | Native embedding input.texts envelope |
DASHSCOPE_API_DIALECT_EMBEDDING_NATIVE_CONTENTS | 2 | Native embedding input.contents envelope |
DASHSCOPE_API_DIALECT_LLM_NATIVE_TEXT | 3 | Native text-generation message envelope |
DASHSCOPE_API_DIALECT_LLM_NATIVE_MULTIMODAL | 4 | Native multimodal-generation content envelope |
DASHSCOPE_API_DIALECT_RERANK_NATIVE_NESTED | 5 | Native nested input/parameters rerank envelope |
DASHSCOPE_API_DIALECT_OPENAI_COMPATIBLE | 6 | OpenAI-compatible chat or embedding envelope |
DASHSCOPE_API_DIALECT_RERANK_COMPATIBLE_FLAT | 7 | Flat Cohere/Jina-compatible rerank envelope |
GeminiApiBackend
Selects the Google API surface used by a Gemini-backed resource.
This value is persisted so process-level Google SDK environment variables cannot silently redirect a stored resource between the Gemini Developer API and Google Cloud.
| Name | Value | Description |
|---|---|---|
GEMINI_API_BACKEND_UNSPECIFIED | 0 | Invalid when explicitly supplied on writes |
GEMINI_API_BACKEND_DEVELOPER | 1 | Gemini Developer API at generativelanguage.googleapis.com |
GEMINI_API_BACKEND_GOOGLE_CLOUD | 2 | Google Cloud resource API using project and location routing |
Modality
Defines the type of content a model can process.
Used by embedders, rerankers, and LLMs to declare their capabilities.
| Name | Value | Description |
|---|---|---|
MODALITY_UNSPECIFIED | 0 | The default value. This is invalid on writes and will be rejected |
MODALITY_TEXT | 1 | Textual content |
MODALITY_IMAGE | 2 | Image content |
MODALITY_AUDIO | 3 | Audio content |
MODALITY_VIDEO | 4 | Video content |
GoodMemStatusCode
Defines granular, non-fatal status codes for GoodMem operations.
These codes are sent in the GoodMemStatus message, typically in streaming
responses, to provide clients with programmatic insight into the progress or
partial failures of a request without terminating the entire operation.
| Name | Value | Description |
|---|---|---|
GOODMEM_STATUS_CODE_UNSPECIFIED | 0 | The default value. Should not be used |
INVALID_ARGUMENT | 3 | Standard gRPC status codes (mirrored for client independence) Invalid request parameters (mirrors gRPC INVALID_ARGUMENT) |
NOT_FOUND | 5 | Requested resource not found (mirrors gRPC NOT_FOUND) |
PERMISSION_DENIED | 7 | Access denied to resource (mirrors gRPC PERMISSION_DENIED) |
FAILED_PRECONDITION | 9 | Operation requires specific preconditions (mirrors gRPC FAILED_PRECONDITION) |
EMBEDDER_FAILED | 1000 | Embedder-related warnings Embedding generation failed for a specific embedder |
EMBEDDER_UNAVAILABLE | 1001 | Embedder service is temporarily unavailable |
EMBEDDER_TIMEOUT | 1002 | Embedding request timed out |
VECTOR_SEARCH_FAILED | 2000 | Vector search warnings Vector search failed for a specific embedder/space |
VECTOR_SEARCH_PARTIAL | 2001 | Vector search returned partial results |
VECTOR_SEARCH_TIMEOUT | 2002 | Vector search timed out |
SPACE_INACCESSIBLE | 3000 | Space access warnings User lacks permission to access a requested space |
SPACE_NOT_FOUND | 3001 | Requested space does not exist |
SPACE_NO_EMBEDDERS | 3002 | Space has no configured embedders |
CHUNK_NOT_FOUND | 4000 | Memory/chunk warnings Referenced chunk was not found in database |
MEMORY_LOAD_FAILED | 4001 | Failed to load memory data |
MEMORY_CONTENT_UNAVAILABLE | 4002 | Memory content could not be retrieved |
RERANKING_FAILED | 5000 | Processing warnings Post-processing reranking failed |
SUMMARIZATION_FAILED | 5001 | Summary generation failed |
SUMMARIZATION_TIMEOUT | 5002 | Summary generation timed out |
RATE_LIMITED | 6000 | System warnings Request was rate limited |
RESOURCE_EXHAUSTED | 6001 | System resources exhausted (memory, CPU, etc.) |
CONFIGURATION_ERROR | 6002 | System configuration issue detected |
LLM_CAPABILITY_INFERRED | 7000 | LLM-related warnings LLM capability was auto-filled by the system. |
FEATURE_DISABLED | 9000 | Informational status messages (non-error) Feature disabled due to missing configuration |
InternalStatusCode
Stable internal failure reasons. These are diagnostics, not public RPC status categories.
Server Status values retain these reasons and their causes until the transport boundary maps them to canonical gRPC/HTTP categories. No public response field uses this enum. Reserve a separate block of at least 10,000 numbers for each additional subsystem; never renumber a reason.
| Name | Value | Description |
|---|---|---|
INTERNAL_STATUS_CODE_UNSPECIFIED | 0 | |
DOCUMENT_INVALID_REQUEST | 10000 | Document ingestion: 10,000-19,999. Required extraction inputs are absent or invalid. |
DOCUMENT_EMPTY_SOURCE | 10001 | Inline source has no bytes. |
DOCUMENT_SOURCE_READ_FAILED | 10002 | Immutable source cannot be opened or read. |
DOCUMENT_PARSE_FAILED | 10003 | Parser rejects the source format or structure. |
DOCUMENT_ENCRYPTED | 10004 | Source requires unavailable decryption credentials. |
DOCUMENT_TEXT_EMPTY | 10005 | Parsing succeeds but produces no usable text. |
DOCUMENT_TEXT_SPOOL_CREATE_FAILED | 10006 | Temporary text storage cannot be allocated. |
DOCUMENT_TEXT_SPOOL_WRITE_FAILED | 10007 | Text cannot be written or sealed. |
DOCUMENT_TEXT_SPOOL_READ_FAILED | 10008 | Deferred text replay fails. |
DOCUMENT_CHUNK_SPOOL_CREATE_FAILED | 10009 | Temporary chunk storage cannot be allocated. |
DOCUMENT_CHUNK_SPOOL_WRITE_FAILED | 10010 | Chunk serialization or sealing fails. |
DOCUMENT_CHUNK_SPOOL_READ_FAILED | 10011 | Deferred chunk replay fails. |
DOCUMENT_CHUNKING_FAILED | 10012 | Splitting or chunk construction fails. |
DOCUMENT_CLEANUP_FAILED | 10013 | Owned resources cannot be closed or deleted. |
DOCUMENT_CANCELLED | 10014 | Processing was interrupted or cancelled. |
DOCUMENT_LIMIT_EXCEEDED | 10015 | A bounded extraction resource limit is reached. |
DOCUMENT_RESOURCE_STATE_INVALID | 10016 | A resource is used in an invalid lifecycle state. |
DOCUMENT_ARABIC_MODEL_UNAVAILABLE | 10017 | A bundled scoring model cannot be loaded or used. |
DOCUMENT_ARABIC_FEATURES_INVALID | 10018 | Forest inputs violate the fixed feature contract. |
DOCUMENT_ARABIC_SELECTION_FAILED | 10019 | Optional page-order selection cannot complete. |
DOCUMENT_PDF_CONFIG_UNAVAILABLE | 10020 | The effective PDF parser configuration is absent. |
DOCUMENT_PAGE_SPANS_INVALID | 10021 | Candidate page spans are inconsistent or invalid. |
DOCUMENT_LANGUAGE_DETECTION_FAILED | 10022 | Arabic eligibility cannot be determined. |
DOCUMENT_EXTRACTION_FAILED | 10023 | Unexpected failure in the extraction adapter. |
DOCUMENT_PARSER_STORAGE_FAILED | 10024 | The PDF parser cannot access its source or temporary working storage. |