Current section

Files

Jump to
xberg lib xberg sparse_embedding_config.ex
Raw

lib/xberg/sparse_embedding_config.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:61b2c8938c132132f6ac987a5658fed582bea2f8248dbe1d25aa618e0ec0b375
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule Xberg.SparseEmbeddingConfig do
@moduledoc """
Configuration for the sparse-embedding pipeline.
Controls which model to use, batching, and download/cache behavior for the
local ONNX SPLADE model.
Since v5.0.0.
"""
@typedoc "Configuration for the sparse-embedding pipeline."
@type t :: %__MODULE__{
model: String.t() | nil,
batch_size: non_neg_integer(),
max_length: non_neg_integer(),
show_download_progress: boolean(),
cache_dir: String.t() | nil,
acceleration: Xberg.AccelerationConfig.t() | nil,
max_embed_duration_secs: non_neg_integer() | nil
}
defstruct model: :preset,
batch_size: 0,
max_length: 0,
show_download_progress: false,
cache_dir: nil,
acceleration: nil,
max_embed_duration_secs: nil
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end