RAGConfiguration class
RAGConfiguration — low-level pipeline config.
This message carries model ids, not filesystem paths. The commons RAG session ABI (rac_rag_session_create_proto) is responsible for resolving those ids to on-disk paths through the canonical model registry. SDK callers MUST register the embedding / LLM / reranker models first and pass only their ids here.
Constructors
- RAGConfiguration({String? embeddingModelId, String? llmModelId, int? embeddingDimension, int? topK, double? similarityThreshold, int? chunkSize, int? chunkOverlap, int? maxContextTokens, String? promptTemplate, String? embeddingConfigJson, String? llmConfigJson, String? indexPath, bool? persistIndex, bool? rerankResults, String? rerankerModelId})
-
factory
-
RAGConfiguration.fromBuffer(List<
int> data, [ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY]) -
factory
- RAGConfiguration.fromJson(String json, [ExtensionRegistry registry = $pb.ExtensionRegistry.EMPTY])
-
factory
Properties
- chunkOverlap ↔ int
-
Overlap tokens between consecutive chunks. Must be < chunk_size.
Optional so callers can explicitly request zero overlap (no overlap)
without it being silently replaced by the canonical default of 64.
getter/setter pair
- chunkSize ↔ int
-
Tokens per chunk when splitting documents during ingestion.
Optional so callers can distinguish "unset" from an explicit value.
getter/setter pair
- embeddingConfigJson ↔ String
-
Backend-specific config JSON passed to the embedding model/provider.
getter/setter pair
- embeddingDimension ↔ int
-
Embedding vector dimension — must match the embedding model.
Common: 384 (all-MiniLM-L6-v2), 768 (bge-base), 1024 (bge-large).
Leave UNSET: commons derives the dimension from the loaded embedding
model at session create (rac_embeddings_get_info). Set only to
override. No rac_default on purpose — a generated defaults() that
stamped 384 would mark the field present and defeat the derivation.
getter/setter pair
- embeddingModelId ↔ String
-
Registered id of the embedding model (required, e.g. "bge-small-en-v1.5").
Commons resolves this to the primary artifact path via the model registry.
getter/setter pair
- hashCode → int
-
Calculates a hash code based on the contents of the protobuf.
no setterinherited
- indexPath ↔ String
-
Index persistence and retrieval behavior. Empty path = in-memory index.
getter/setter pair
- info_ → BuilderInfo
-
no setter
- isFrozen → bool
-
Returns
trueif this message is marked read-only. Otherwisefalse.no setterinherited - llmConfigJson ↔ String
-
Backend-specific config JSON passed to the LLM provider.
getter/setter pair
- llmModelId ↔ String
-
Registered id of the LLM model (e.g. "qwen3-4b-q4_k_m"). Optional —
leave empty to create an embed-only / retrieval-only pipeline.
getter/setter pair
- maxContextTokens ↔ int
-
Maximum tokens of retrieved context passed to the LLM.
Optional so callers can distinguish "unset" from an explicit value.
getter/setter pair
- persistIndex ↔ bool
-
getter/setter pair
- promptTemplate ↔ String
-
Prompt template with
{context}and{query}placeholders.getter/setter pair - rerankerModelId ↔ String
-
Registered id of the reranker model (optional).
getter/setter pair
- rerankResults ↔ bool
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- similarityThreshold ↔ double
-
Minimum cosine similarity threshold (0.0–1.0). Chunks below this
score are discarded before being passed to the LLM as context.
Optional so callers can distinguish "unset" from explicit 0.0
(accept-everything) without losing the canonical default.
Default is 0.0 (accept-everything): MiniLM-class sentence embeddings
produce cosine similarities that rarely exceed ~0.5 even for relevant
chunks, and chunking a document lowers each chunk's similarity further, so
any positive floor filters out real matches — a multi-chunk document then
retrieves nothing and the answer model reports "no information". top_k
bounds the result count instead of a similarity floor.
getter/setter pair
- topK ↔ int
-
Number of top chunks to retrieve per query.
Optional so callers can distinguish "unset" from an explicit value.
getter/setter pair
- unknownFields → UnknownFieldSet
-
no setterinherited
Methods
-
addExtension(
Extension extension, Object? value) → void -
Adds an extension field value to a repeated field.
inherited
-
check(
) → void -
Throws a StateError if the message has required fields without a value.
inherited
-
clear(
) → void -
Clears all data that was set in this message.
inherited
-
clearChunkOverlap(
) → void -
clearChunkSize(
) → void -
clearEmbeddingConfigJson(
) → void -
clearEmbeddingDimension(
) → void -
clearEmbeddingModelId(
) → void -
clearExtension(
Extension extension) → void -
Clears an extension field and also removes the extension.
inherited
-
clearField(
int tagNumber) → void -
Clears the contents of a given field.
inherited
-
clearIndexPath(
) → void -
clearLlmConfigJson(
) → void -
clearLlmModelId(
) → void -
clearMaxContextTokens(
) → void -
clearPersistIndex(
) → void -
clearPromptTemplate(
) → void -
clearRerankerModelId(
) → void -
clearRerankResults(
) → void -
clearSimilarityThreshold(
) → void -
clearTopK(
) → void -
clone(
) → RAGConfiguration - Creates a deep copy of the fields in this message.
-
copyWith(
void updates(RAGConfiguration)) → RAGConfiguration -
Apply
updatesto a copy of this message. -
createEmptyInstance(
) → RAGConfiguration - Creates an empty instance of the same message type as this.
-
deepCopy(
) → T -
Available on T, provided by the GeneratedMessageGenericExtensions extension
Returns a writable deep copy of this message. -
extensionsAreInitialized(
) → bool -
inherited
-
freeze(
) → GeneratedMessage -
Make this message read-only.
inherited
-
getDefaultForField(
int tagNumber) → dynamic -
Returns the default value for the given field.
inherited
-
getExtension(
Extension extension) → dynamic -
Returns the value of
extension.inherited -
getField(
int tagNumber) → dynamic -
Returns the value of the field associated with
tagNumber, or the default value if it is not set.inherited -
getFieldOrNull(
int tagNumber) → dynamic -
Returns the value of a field, ignoring any defaults.
inherited
-
getTagNumber(
String fieldName) → int? -
inherited
-
hasChunkOverlap(
) → bool -
hasChunkSize(
) → bool -
hasEmbeddingConfigJson(
) → bool -
hasEmbeddingDimension(
) → bool -
hasEmbeddingModelId(
) → bool -
hasExtension(
Extension extension) → bool -
Returns
trueif a value ofextensionis present.inherited -
hasField(
int tagNumber) → bool -
Whether this message has a field associated with
tagNumber.inherited -
hasIndexPath(
) → bool -
hasLlmConfigJson(
) → bool -
hasLlmModelId(
) → bool -
hasMaxContextTokens(
) → bool -
hasPersistIndex(
) → bool -
hasPromptTemplate(
) → bool -
hasRequiredFields(
) → bool -
Whether the message has required fields.
inherited
-
hasRerankerModelId(
) → bool -
hasRerankResults(
) → bool -
hasSimilarityThreshold(
) → bool -
hasTopK(
) → bool -
isInitialized(
) → bool -
Whether all required fields in the message and embedded messages are set.
inherited
-
mergeFromBuffer(
List< int> input, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void -
Merges serialized protocol buffer data into this message.
inherited
-
mergeFromCodedBufferReader(
CodedBufferReader input, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void -
Same as
mergeFromBuffer, but takes aCodedBufferReaderinput.inherited -
mergeFromJson(
String data, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void -
Merges field values from
data, a JSON object, encoded as described byGeneratedMessage.writeToJson.inherited -
mergeFromJsonMap(
Map< String, dynamic> json, [ExtensionRegistry extensionRegistry = ExtensionRegistry.EMPTY]) → void -
Merges field values from a JSON object represented as a Dart map.
inherited
-
mergeFromMessage(
GeneratedMessage other) → void -
Merges the contents of the
otherinto this message.inherited -
mergeFromProto3Json(
Object? json, {TypeRegistry typeRegistry = const TypeRegistry.empty(), bool ignoreUnknownFields = false, bool supportNamesWithUnderscores = true, bool permissiveEnums = false}) → void -
Merges field values from
json, a JSON object using proto3 encoding.inherited -
mergeUnknownFields(
UnknownFieldSet unknownFieldSet) → void -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
rebuild(
void updates(T)) → T -
Available on T, provided by the GeneratedMessageGenericExtensions extension
Applyupdatesto a copy of this message. -
resolvingLifecycleArtifacts(
{required ModelLoadResult embedding, required ModelLoadResult llm}) → RAGConfiguration -
Available on RAGConfiguration, provided by the RAGConfigurationResolvedArtifacts extension
D-6 parity: lifecycle results prove the models were registered/resolved; the RAG session config itself carries model ids for commons to resolve. -
setExtension(
Extension extension, Object value) → void -
Sets the value of a non-repeated extension field to
value.inherited -
setField(
int tagNumber, Object value) → void -
Sets the value of a field by its
tagNumber.inherited -
toBuilder(
) → GeneratedMessage -
Creates a writable, shallow copy of this message.
inherited
-
toDebugString(
) → String -
Returns a String representation of this message.
inherited
-
toProto3Json(
{TypeRegistry typeRegistry = const TypeRegistry.empty()}) → Object? -
Returns an Object representing Proto3 JSON serialization of
this.inherited -
toString(
) → String -
Returns a String representation of this message.
inherited
-
validate(
) → void -
Available on RAGConfiguration, provided by the RAGConfigurationValidate extension
-
writeToBuffer(
) → Uint8List -
Serialize the message as the protobuf binary format.
inherited
-
writeToCodedBufferWriter(
CodedBufferWriter output) → void -
Same as
writeToBuffer, but serializes to the givenCodedBufferWriter.inherited -
writeToJson(
) → String -
Returns a JSON string that encodes this message.
inherited
-
writeToJsonMap(
) → Map< String, dynamic> -
Returns the JSON encoding of this message as a Dart Map.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited