garak.langservice

The langservice module in garak is designed to handle text language tasks using various translation services and models. It provides an entry point to translation support backed by translators, each implementing different translation strategies and models, including both cloud-based services, like DeepL and NVIDIA Riva, and local models like facebook/m2m100 available on Hugging Face.

Centralized language specific service to support plugins.

garak.langservice.enabled() bool

are all requirements met for language service to be enabled

garak.langservice.get_langprovider(source: str, *, reverse: bool = False)

Provides a singleton runtime language provider consumed in probes and detectors.

returns a single direction langprovider for the _config.run.target_lang to encapsulate target language outside plugins

garak.langservice.load()

Loads all language providers defined in configuration and validate bi-directional support

garak.langservice.start_msg() str

return a start message, assumes enabled

garak.langservice.tasks() List[str]

number of translators to deal with, minus the no-op one