OpenSearchConfig

org.llm4s.vectorstore.opensearch.OpenSearchConfig
See theOpenSearchConfig companion object
final case class OpenSearchConfig

What OpenSearchVectorStore needs to reach one index of an OpenSearch cluster with the k-NN plugin.

Load it from configuration with org.llm4s.config.OpenSearchVectorStoreConfigLoader, which reads llm4s.vectorstore.opensearch, or build one in code:

val config = OpenSearchConfig("https://search.example.com:9200")
 .withIndex("docs")
 .withAuth(OpenSearchAuth.Basic("llm4s", password))
 .withEngine(OpenSearchEngine.Faiss)

The store checks it with OpenSearchConfig#validate when it is built.

Value parameters

auth

the credentials, OpenSearchAuth.NoAuth by default

baseUrl

the cluster's root URL, optionally with a path prefix (a proxy), without a query. It must be https when credentials are sent; plain http is accepted for a loopback host (localhost, 127.0.0.0/8, ::1) or when there are no credentials to protect.

dimensions

the vector size the index is created with; when unset, the size of the first record upserted. When set, a record of another size is refused before it is sent.

efConstruction

the HNSW graph's ef_construction; when unset, the engine's default

engine

the k-NN engine the index is created with; it decides whether filters are applied inside the kNN search (OpenSearchEngine#filtersInsideKnn)

index

the index holding the vectors; OpenSearch's index-name rules apply (lower case, no \ / * ? " < > | , # or space, not starting with -, _ or +)

m

the HNSW graph's m (links per node); when unset, the engine's default

numCandidates

the kNN query's k, the neighbours each shard returns before the result is cut to topK. When unset: topK with efficient filtering, and max(100, 10 * topK) with a post-filter, so that enough candidates survive the filter. Never below topK, at most 10,000.

refreshOnWrite

whether writes wait for a refresh (refresh=wait_for), so that a search straight after an upsert or delete sees it. Turn it off for bulk ingestion.

spaceType

the knn_vector space the index is created with

timeout

how long each HTTP request may take

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

Checks the config; the first problem is reported, naming the setting.

Checks the config; the first problem is reported, naming the setting.

Attributes

def withBaseUrl(baseUrl: String): OpenSearchConfig
def withDimensions(dimensions: Int): OpenSearchConfig
def withDimensions(dimensions: Option[Int]): OpenSearchConfig
def withEfConstruction(efConstruction: Int): OpenSearchConfig
def withEfConstruction(efConstruction: Option[Int]): OpenSearchConfig
def withIndex(index: String): OpenSearchConfig
def withM(m: Int): OpenSearchConfig
def withM(m: Option[Int]): OpenSearchConfig
def withNumCandidates(numCandidates: Int): OpenSearchConfig
def withNumCandidates(numCandidates: Option[Int]): OpenSearchConfig
def withRefreshOnWrite(refreshOnWrite: Boolean): OpenSearchConfig
def withTimeout(timeout: FiniteDuration): OpenSearchConfig

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product