ModelDimensionRegistry

org.llm4s.llmconnect.config.ModelDimensionRegistry
@Stable

Lookup service for embedding model vector dimensions.

Answers from the embedding providers in the caller's org.llm4s.llmconnect.spi.ProviderRegistry: each org.llm4s.llmconnect.spi.EmbeddingProviderDescriptor declares the dimensions of the models it knows, so a provider module brings its own and nothing here needs editing when one is added.

The one provider answered locally is local, the non-text encoders used by ModelSelector (llm4s-rag). It is not an embedding provider - nothing can be configured with it - so it has no descriptor to declare them. That table is only a fallback: an application that registers a real embedding provider under the id local gets that provider's dimensions, exactly as EmbeddingClient.from gets that provider's client.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def getDimension(provider: String, model: String)(using registry: ProviderRegistry): Result[Int]

The vector dimensions model produces under provider.

The vector dimensions model produces under provider.

Value parameters

provider

an embedding provider id or alias, as in EMBEDDING_MODEL=<provider>/<model>.

Attributes

Returns

Left with a org.llm4s.error.ConfigurationError when the provider is not registered - the registry's error, naming what is - or is registered but does not declare model.

def localDimension(model: String): Result[Int]

The vector dimensions of one of the local non-text encoders.

The vector dimensions of one of the local non-text encoders.

Separate from getDimension so that selecting a local model never triggers provider discovery, which it has no use for.

Attributes

Concrete fields

val LocalProvider: String

The provider name under which the local non-text encoders are looked up.

The provider name under which the local non-text encoders are looked up.

Attributes