Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions openlrc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
# All rights reserved.

from dataclasses import dataclass
from pathlib import Path

from openlrc.models import ModelConfig


@dataclass
Expand Down Expand Up @@ -35,24 +32,33 @@ class TranslationConfig:
"""
Configuration for the translation stage.

All fields use primitive, serialization-friendly types so that the config
can be parsed by CLI frameworks (simple_parsing, HfArgumentParser, Hydra)
and serialized to JSON/YAML without custom encoders.

For programmatic use with richer types (e.g. ``ModelConfig``), pass them
directly to ``LRCer.__init__`` or ``LLMTranslator.__init__`` instead.

Args:
chatbot_model: The chatbot model to use. Can be a string like
``'gpt-4.1-nano'`` or ``'provider:model-name'``, or a ``ModelConfig``
instance. Default: ``gpt-4.1-nano``
chatbot_model: The chatbot model to use, as a string like
``'gpt-4.1-nano'`` or ``'provider:model-name'``.
Default: ``gpt-4.1-nano``
fee_limit: Maximum fee per translation call in USD. Default: ``0.8``
consumer_thread: Number of parallel translation threads. Default: ``4``
proxy: Proxy for API requests. e.g. ``'http://127.0.0.1:7890'``
base_url_config: Base URL dict for OpenAI & Anthropic.
glossary: Dictionary or path mapping source words to translations.
retry_model: Fallback model for translation retries.
glossary: Path to a JSON glossary file mapping source words to
translations, or None. To pass a dict directly, use the
``LRCer`` or ``LLMTranslator`` API instead.
retry_model: Fallback model name for translation retries, or None.
is_force_glossary_used: Force glossary usage in context. Default: ``False``
"""

chatbot_model: str | ModelConfig = "gpt-4.1-nano"
chatbot_model: str = "gpt-4.1-nano"
fee_limit: float = 0.8
consumer_thread: int = 4
proxy: str | None = None
base_url_config: dict | None = None
glossary: dict | str | Path | None = None
retry_model: str | ModelConfig | None = None
glossary: str | None = None
retry_model: str | None = None
is_force_glossary_used: bool = False
Loading