ContractEmbeddings

org.llm4s.agent.memory.testkit.MemoryStoreContract.ContractEmbeddings
final class ContractEmbeddings extends EmbeddingService

An embedding service for the contract: a text it was given a vector for embeds as that vector, any other as a deterministic 3-dimensional one; a text it was told to refuse fails. It counts its calls.

Attributes

Source
MemoryStoreContract.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def define(text: String, vector: Array[Float]): Unit

Attributes

Source
MemoryStoreContract.scala
override def dimensions: Int

Get the dimensionality of the embeddings produced.

Get the dimensionality of the embeddings produced.

Attributes

Definition Classes
Source
MemoryStoreContract.scala
override def embed(text: String): Result[Array[Float]]

Generate an embedding for a single text.

Generate an embedding for a single text.

Value parameters

text

The text to embed

Attributes

Returns

Embedding vector or error

Definition Classes
Source
MemoryStoreContract.scala
override def embedBatch(texts: Seq[String]): Result[Seq[Array[Float]]]

Generate embeddings for multiple texts in a batch.

Generate embeddings for multiple texts in a batch.

Value parameters

texts

The texts to embed

Attributes

Returns

Embedding vectors (one per input) or error

Definition Classes
Source
MemoryStoreContract.scala
def failOn(text: String): Unit

Attributes

Source
MemoryStoreContract.scala
def vectorOf(text: String): Array[Float]

Attributes

Source
MemoryStoreContract.scala

Inherited methods

Generate an embedding for a search query, to be compared with the embeddings of the memories.

Generate an embedding for a search query, to be compared with the embeddings of the memories.

Some embedding models embed a query and a document differently, and a query is only matched correctly if it is embedded as one. A memory store calls this, not embed, for the text it searches with. The default delegates to embed, so a service whose model embeds both alike (and every existing implementation) does not need to override it.

Value parameters

text

The query to embed

Attributes

Returns

Embedding vector or error

Inherited from:
EmbeddingService
Source
EmbeddingService.scala

Concrete fields