EmbedderConfig

On this page

embeddings.config_embedder.EmbedderConfig — a @dataclass holding every default value referenced by other modules in the module.

Purpose

Centralizes default constructor argument values so that multiple embedder classes can reference the same defaults (e.g. batch_size=32) without repeating literals. See Configuration for the full field-by-field table and important caveats about how (and how little) this is actually shared at runtime.

Definition

Python · 31 lines
@dataclass
class EmbedderConfig:
    model_name: str = "multilingual"
    device: Optional[str] = None
    cache_dir: Optional[str] = None

    batch_size: int = 32
    normalize_embeddings: bool = True
    max_seq_length: int = 512

    enable_preprocessing: bool = True
    enable_arabic_normalization: bool = True

    enable_cache: bool = False
    cache_size: int = 10000

    show_progress_bar: bool = False
    convert_to_numpy: bool = True
    skip_preprocessing: bool = False
    return_valid_indices: bool = False

    extra_config: Dict[str, Any] = field(default_factory=dict)

    track_processing_stats: bool = True
    auto_download: bool = True
    trust_remote_code: bool = False

    base_url: str = "http://127.0.0.1:11434"
    host: str = "localhost"
    port: int = 11434
    embedding_model: str = "nomic-embed-text"

All fields are optional with defaults, so EmbedderConfig() always succeeds; every field can also be overridden via keyword argument, e.g. EmbedderConfig(batch_size=64).

Usage

Python · 4 lines
from zerda.embeddings import EmbedderConfig

config = EmbedderConfig(batch_size=64, show_progress_bar=True)
print(config.base_url)  # "http://127.0.0.1:11434"

Because extra_config uses field(default_factory=dict), each EmbedderConfig() instance gets its own independent dict — this avoids the classic mutable-default-argument bug, though extra_config isn't read anywhere else in the source.

Version history

Cannot be determined from the provided source — no changelog, git history, or version markers are present in the analyzed files.

Related pages