RetrievalSettings

data class RetrievalSettings(val storage: SearchStorage<TextDocument, SearchRequest>, val searchQueryProvider: SearchQueryProvider = LastUserMessageQueryProvider(), val searchStrategy: SearchStrategy = SimilaritySearchStrategy(), val promptAugmenter: PromptAugmenter = SystemPromptAugmenter(), val enableAutomaticRetrieval: Boolean = true, val namespace: String? = null, val failurePolicy: FailurePolicy = FailurePolicy.FAIL_FAST)(source)

Settings controlling how memory records are retrieved and injected into prompts (RAG).

Parameters

storage

The retrieval storage to search for relevant memory records.

searchQueryProvider

The provider that defines how to derive the search query from the prompt. Defaults to ai.koog.agents.longtermmemory.retrieval.search.LastUserMessageQueryProvider, which uses the last user message content.

searchStrategy

The strategy that defines how to search the retrieval store.

promptAugmenter

The augmenter that defines how retrieved context is inserted into the prompt.

enableAutomaticRetrieval

When true (default), retrieval and prompt augmentation happen automatically before each LLM call. When false, the storage and strategy are still accessible for manual use inside graph strategy nodes via ai.koog.agents.longtermmemory.feature.withLongTermMemory.

namespace

Namespace (table/collection name) for a request.

failurePolicy

How to react to failures from storage or searchStrategy. Defaults to FailurePolicy.FAIL_FAST so that retrieval errors stop the LLM call instead of silently producing an answer without the required memory context.

Constructors

Link copied to clipboard
constructor(storage: SearchStorage<TextDocument, SearchRequest>, searchQueryProvider: SearchQueryProvider = LastUserMessageQueryProvider(), searchStrategy: SearchStrategy = SimilaritySearchStrategy(), promptAugmenter: PromptAugmenter = SystemPromptAugmenter(), enableAutomaticRetrieval: Boolean = true, namespace: String? = null, failurePolicy: FailurePolicy = FailurePolicy.FAIL_FAST)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard