Ragex.Embeddings.Registry
(Ragex v0.13.0)
View Source
Registry of available embedding models with metadata.
Provides model definitions, metadata, and lookup functions for different embedding models that can be used with Ragex.
Summary
Functions
Returns all available models.
Lists models by type.
Checks if two models are compatible (same dimensions).
Returns the default model ID.
Gets dimension count for a model.
Finds a model by repository name.
Gets a model by ID.
Gets a model by ID, raises if not found.
Returns model recommendations as a formatted string.
Validates if a model ID is valid.
Types
@type model_id() :: atom()
@type model_info() :: %{ id: model_id(), name: String.t(), repo: String.t(), dimensions: pos_integer(), max_tokens: pos_integer(), description: String.t(), type: :sentence_transformer | :code_model | :multilingual, recommended_for: [String.t()] }
Functions
@spec all() :: [model_info()]
Returns all available models.
@spec by_type(:sentence_transformer | :code_model | :multilingual) :: [model_info()]
Lists models by type.
Examples
iex> Registry.by_type(:code_model)
[%{id: :codebert_base, ...}]
Checks if two models are compatible (same dimensions).
@spec default() :: model_id()
Returns the default model ID.
@spec dimensions(model_id()) :: {:ok, pos_integer()} | {:error, :not_found}
Gets dimension count for a model.
@spec find_by_repo(String.t()) :: {:ok, model_info()} | {:error, :not_found}
Finds a model by repository name.
Examples
iex> Registry.find_by_repo("sentence-transformers/all-MiniLM-L6-v2")
{:ok, %{id: :all_minilm_l6_v2, ...}}
@spec get(model_id()) :: {:ok, model_info()} | {:error, :not_found}
Gets a model by ID.
Examples
iex> Registry.get(:all_minilm_l6_v2)
{:ok, %{id: :all_minilm_l6_v2, ...}}
iex> Registry.get(:invalid)
{:error, :not_found}
@spec get!(model_id()) :: model_info()
Gets a model by ID, raises if not found.
@spec recommendations() :: String.t()
Returns model recommendations as a formatted string.
Validates if a model ID is valid.