org.llm4s.vectorstore.testkit
Members list
Type members
Classlikes
The contract every org.llm4s.vectorstore.KeywordIndex must meet (#3000), as a ScalaTest suite: mix it into a spec, implement newStore and releaseStore, and every case below runs against your index:
The contract every org.llm4s.vectorstore.KeywordIndex must meet (#3000), as a ScalaTest suite: mix it into a spec, implement newStore and releaseStore, and every case below runs against your index:
class SQLiteKeywordIndexContractSpec extends AnyFunSuite with KeywordIndexContract {
protected def newStore(): KeywordIndex = SQLiteKeywordIndex.inMemory().toOption.get
protected def releaseStore(index: KeywordIndex): Unit = index.close()
}
The cases:
- '''Reads and writes.'''
index,indexBatch,get,delete,deleteBatch,deleteByPrefix(a literal prefix),countandclear, on an empty index, a populated one and afterclear; re-indexing an existing id, throughindex,indexBatchorupdate, leaving none of its old terms searchable and the document found once. - '''Queries.''' A term finding the documents that hold it, best first, cut at
topK; quotes, operator words and symbols, hyphens and colons searched as text rather than failing as syntax; a blank query answered with nothing; a query of only stopwords answered, not failed; a natural-language question finding a document that lacks some of its words; non-Latin text, both space-separated and unsegmented. - '''Filters.''' MetadataFilterMatrix in
searchandsearchWithHighlights; filters on keys holding., a space or:. - '''Metadata''' and content read back exactly as written; highlights that show the matched term.
A backend with a known defect lists the case in knownFailures with its issue; one that cannot run a case lists it in unsupported (see StoreContractCases).
Attributes
- Source
- KeywordIndexContract.scala
- Supertypes
-
trait StoreContractCases[KeywordIndex]trait Matcherstrait Explicitlytrait MatcherWordstrait ShouldVerbtrait Tolerancetrait AnyFunSuiteLiketrait Documentingtrait Alertingtrait Notifyingtrait Informingtrait TestRegistrationtrait TestSuitetrait Suitetrait Serializabletrait Assertionstrait TripleEqualstrait TripleEqualsSupportclass Objecttrait Matchableclass AnyShow all
The filter matrix every VectorStore and KeywordIndex answers alike (#2996, #3000): five records and, for each filter, the ids it selects.
The filter matrix every VectorStore and KeywordIndex answers alike (#2996, #3000): five records and, for each filter, the ids it selects.
The answers are the trait's semantics, written out by hand rather than read from a reference backend: Equals and Contains are exact and case-sensitive, Contains is a literal substring test (% and _ are not wildcards), HasKey asks whether the key is present, Not keeps a record that lacks the key, and an empty In or Not(All) selects nothing.
Attributes
- Source
- MetadataFilterMatrix.scala
- Supertypes
- Self type
-
MetadataFilterMatrix.type
How VectorStoreContract and KeywordIndexContract register their cases against a store: a fresh store per case, released afterwards, and two ways for a backend's spec to say that a case does not hold for it yet.
How VectorStoreContract and KeywordIndexContract register their cases against a store: a fresh store per case, released afterwards, and two ways for a backend's spec to say that a case does not hold for it yet.
- knownFailures: a case the backend fails today because of a known defect, named with the issue that tracks it. The case still runs, as ScalaTest's
pendingUntilFixed: it is reported pending while it fails and fails once it passes, so the change that fixes the defect also removes the entry. - unsupported: a case the backend cannot run at all, such as a query a search engine does not offer, with the reason. It is cancelled.
A name in either map that matches no case fails the suite, so a renamed case cannot silently stop being excused.
Attributes
- Source
- StoreContractCases.scala
- Supertypes
-
trait Matcherstrait Explicitlytrait MatcherWordstrait ShouldVerbtrait Tolerancetrait AnyFunSuiteLiketrait Documentingtrait Alertingtrait Notifyingtrait Informingtrait TestRegistrationtrait TestSuitetrait Suitetrait Serializabletrait Assertionstrait TripleEqualstrait TripleEqualsSupportclass Objecttrait Matchableclass AnyShow all
- Known subtypes
-
trait KeywordIndexContracttrait VectorStoreContract
The contract every org.llm4s.vectorstore.VectorStore must meet (#3000), as a ScalaTest suite: mix it into a spec, implement newStore and releaseStore, and every case below runs against your store:
The contract every org.llm4s.vectorstore.VectorStore must meet (#3000), as a ScalaTest suite: mix it into a spec, implement newStore and releaseStore, and every case below runs against your store:
class SQLiteVectorStoreContractSpec extends AnyFunSuite with VectorStoreContract {
protected def newStore(): VectorStore = SQLiteVectorStore.inMemory().toOption.get
protected def releaseStore(store: VectorStore): Unit = store.close()
}
The cases:
- '''Reads and writes.'''
upsert,upsertBatch,get,getBatch(missing ids skipped),delete,deleteBatch,deleteByPrefix(a literal prefix:%and_are not wildcards),deleteByFilterandclear, on an empty store, on a populated one and afterclear; an upsert of an existing id replacing its embedding, content and metadata. - '''Filters.''' MetadataFilterMatrix in
list,count,searchanddeleteByFilter; filters on keys holding., a space or:. - '''Metadata''' read back exactly as written:
",\, newline, tab, unicode,%,_, and keys with., a space or:. - '''Search.''' Results best first, cut at
topK, the filter applied before the cut; scores of(1 + cos) / 2(identical1, orthogonal0.5, opposite0); a zero vector stored or queried never failing a search or giving a score outside[0, 1]; a query of another dimension refused. - '''Listing.'''
listin insertion order, and pages that together hold every record once;countwith and without a filter. - '''Batches''' larger than a statement's parameter limit or a server's request limit (largeIdBatch, largeUpsertBatch).
A backend with a known defect lists the case in knownFailures with its issue; one that cannot run a case lists it in unsupported (see StoreContractCases).
Attributes
- Source
- VectorStoreContract.scala
- Supertypes
-
trait StoreContractCases[VectorStore]trait Matcherstrait Explicitlytrait MatcherWordstrait ShouldVerbtrait Tolerancetrait AnyFunSuiteLiketrait Documentingtrait Alertingtrait Notifyingtrait Informingtrait TestRegistrationtrait TestSuitetrait Suitetrait Serializabletrait Assertionstrait TripleEqualstrait TripleEqualsSupportclass Objecttrait Matchableclass AnyShow all
