RagOptions

data class RagOptions constructor(val similarityThreshold: <Error class: unknown class> = 0.7, val topK: Int = 8, val hyDE: HyDE? = null, val desiredMaxLatency: Duration = Duration.ofMillis(5000), val compressionConfig: CompressionConfig = CompressionConfig(), val llm: <Error class: unknown class> = LlmOptions.withAutoLlm(), val contentElementSearch: ContentElementSearch = ContentElementSearch.CHUNKS_ONLY, val entitySearch: EntitySearch? = null, val ragResponseFormatter: RagResponseFormatter = SimpleRagResponseFormatter, val service: String? = null, val listener: RagEventListener = RagEventListener.NOOP, val dualShot: DualShotConfig? = null) : RagRequestRefinement<RagOptions>

Operations for RAG use as an LLM tool. Options are immutable and stable.

Parameters

similarityThreshold

minimum similarity threshold for results (0.0 to 1.0)

topK

maximum number of results to return returned. If set, only the given entities will be searched for.

ragResponseFormatter

formatter to convert RagResponse to String

service

optional name of the RAG service to use. If null, the default service will be used.

dualShot

whether to use dual-shot RAG, where the first tool returns a summary and the second tool returns detailed results.

Constructors

Link copied to clipboard
constructor(similarityThreshold: <Error class: unknown class> = 0.7, topK: Int = 8, hyDE: HyDE? = null, desiredMaxLatency: Duration = Duration.ofMillis(5000), compressionConfig: CompressionConfig = CompressionConfig(), llm: <Error class: unknown class> = LlmOptions.withAutoLlm(), contentElementSearch: ContentElementSearch = ContentElementSearch.CHUNKS_ONLY, entitySearch: EntitySearch? = null, ragResponseFormatter: RagResponseFormatter = SimpleRagResponseFormatter, service: String? = null, listener: RagEventListener = RagEventListener.NOOP, dualShot: DualShotConfig? = null)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val desiredMaxLatency: Duration
Link copied to clipboard
Link copied to clipboard
open override val entitySearch: EntitySearch? = null
Link copied to clipboard
open override val hyDE: HyDE? = null
Link copied to clipboard
Link copied to clipboard
val llm: <Error class: unknown class>
Link copied to clipboard
val service: String? = null
Link copied to clipboard
open val similarityThreshold: <Error class: unknown class> = 0.7
Link copied to clipboard
open val topK: Int = 8

Functions

Link copied to clipboard
open fun toRequest(query: String): RagRequest

Create a RagRequest from this refinement and a query.

Link copied to clipboard
open override fun withCompression(compressionConfig: CompressionConfig): RagOptions
Link copied to clipboard
open override fun withContentElementSearch(contentElementSearch: ContentElementSearch): RagOptions
Link copied to clipboard
open override fun withDesiredMaxLatency(desiredMaxLatency: Duration): RagOptions
Link copied to clipboard
Link copied to clipboard
open override fun withEntitySearch(entitySearch: EntitySearch): RagOptions
Link copied to clipboard
open override fun withHyDE(hyDE: HyDE): RagOptions
Link copied to clipboard
Link copied to clipboard

Return an instance using the given Rag service name.

Link copied to clipboard
open override fun withSimilarityThreshold(similarityThreshold: <Error class: unknown class>): RagOptions
Link copied to clipboard
open override fun withTopK(topK: Int): RagOptions